From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28756 invoked by alias); 15 Jul 2013 12:58:11 -0000 Mailing-List: contact ecos-patches-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-patches-owner@ecos.sourceware.org Received: (qmail 28747 invoked by uid 89); 15 Jul 2013 12:58:10 -0000 X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_NO,RDNS_NONE autolearn=ham version=3.3.1 Received: from Unknown (HELO mail.ecoscentric.com) (212.13.207.197) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 15 Jul 2013 12:58:10 +0000 Received: from localhost (hagrid.ecoscentric.com [127.0.0.1]) by mail.ecoscentric.com (Postfix) with ESMTP id 13F4C4680016 for ; Mon, 15 Jul 2013 13:58:02 +0100 (BST) Received: from mail.ecoscentric.com ([127.0.0.1]) by localhost (hagrid.ecoscentric.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2yAb0GYlqqTv; Mon, 15 Jul 2013 13:57:55 +0100 (BST) From: bugzilla-daemon@bugs.ecos.sourceware.org To: ecos-patches@ecos.sourceware.org Subject: [Bug 1001656] FreeBSD: add AF_PACKET socket familiy Date: Mon, 15 Jul 2013 12:58:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: eCos X-Bugzilla-Component: Patches and contributions X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: bernd.edlinger@hotmail.de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: high X-Bugzilla-Assigned-To: unassigned@bugs.ecos.sourceware.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.ecos.sourceware.org/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-07/txt/msg00005.txt.bz2 Please do not reply to this email, use the link below. http://bugs.ecos.sourceware.org/show_bug.cgi?id=3D1001656 --- Comment #6 from Bernd Edlinger --- (In reply to comment #5) Hi J=C3=BCrgen, > Because I am porting the busybox dhcp server to eCos, I am using your raw > packet patch. > When I do 'man 7 packet' on my linux, I get a slightly different definiti= on > of 'struct sockaddr_ll' (as also used by busybox): I have 'int sll_ifinde= x;' > instead of 'u_short sll_index;' and 'unsigned char sll_addr[8];' instead = of > 'u_char sll_addr[22];'. > I guess the naming difference is because your code is based on the freeBS= D, > and the busybox is based on Linux. > But why 22 bytes for the address ('ssl_addr'), you only use 6B of it > (EHTER_ADDR_LEN)? good questions... 1. actually the name should be sll_ifindex. I somehow missed that typo. 2. the data type that is used by the bsd stack to index the interfaces is u_short, therefore I thought it would be better to use that instead. Same for the SIOCGIFINDEX ioctl, which uses only u_short. 3. in linux sizeof (struct sockaddr_ll) =3D 20 which is larger than sizeof(struct sockaddr) =3D 16. But on eCos the sockaddr is 32 bytes. Therefore the sockaddr_ll must be at least 32 bytes. Therefore I enlarged the sll_addr to 22. Note: All socket addressses should be exactly 32 bytes in eCos, because of this code in ./io/fileio/current/src/socket.cxx: __externC int bind (int s, const struct sockaddr *sa, unsigned int len) { ... struct sockaddr sa2 =3D *sa; regading 1, I will change the name. regarding 2, I could change the type to int, and cast it to u_short later, but only if that improves protability. Is it your impression that this change would improve the portability of the busybox dhcp server? regarding 3, the sizeof sll_addr should be irrelevant to the application as only 6 bytes are really used. Does the existion code use the size of the sll_addr array for anything? Does it break unless this array is exactly 8 bytes? Regards Bernd. --=20 You are receiving this mail because: You are on the CC list for the bug.