From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8536 invoked by alias); 15 Jul 2013 15:39:55 -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 8488 invoked by uid 89); 15 Jul 2013 15:39:55 -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 15:39:54 +0000 Received: from localhost (hagrid.ecoscentric.com [127.0.0.1]) by mail.ecoscentric.com (Postfix) with ESMTP id EFFC54680019 for ; Mon, 15 Jul 2013 16:39:45 +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 8xFFZvh6jZ6h; Mon, 15 Jul 2013 16:39:41 +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 15:39: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: J.Lambrecht@televic.com 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/msg00006.txt.bz2 Please do not reply to this email, use the link below. http://bugs.ecos.sourceware.org/show_bug.cgi?id=3D1001656 --- Comment #7 from Juergen Lambrecht --- (In reply to comment #6) > (In reply to comment #5) > Hi J=C3=BCrgen, >=20 > > Because I am porting the busybox dhcp server to eCos, I am using your r= aw > > packet patch. > > When I do 'man 7 packet' on my linux, I get a slightly different defini= tion > > of 'struct sockaddr_ll' (as also used by busybox): I have 'int sll_ifin= dex;' > > instead of 'u_short sll_index;' and 'unsigned char sll_addr[8];' instea= d of > > 'u_char sll_addr[22];'. > > I guess the naming difference is because your code is based on the free= BSD, > > 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)? >=20 > good questions... >=20 > 1. actually the name should be sll_ifindex. I somehow missed that typo. >=20 > 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. >=20 > 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. >=20 > Note: All socket addressses should be exactly 32 bytes in eCos, > because of this code in ./io/fileio/current/src/socket.cxx: >=20 > __externC int bind (int s, const struct sockaddr *sa, unsigned int len) > { > ... > struct sockaddr sa2 =3D *sa; >=20 >=20 >=20 > regading 1, I will change the name. OK, I did the same >=20 > regarding 2, I could change the type to int, and cast it > to u_short later, but only if that improves protability. >=20 > Is it your impression that this change would improve the > portability of the busybox dhcp server? No, it's OK. The code compiled without warnings so far. >=20 > regarding 3, the sizeof sll_addr should be irrelevant to > the application as only 6 bytes are really used. >=20 > Does the existion code use the size of the sll_addr array > for anything? Does it break unless this array is exactly 8 bytes? No. Busybox code also only uses 6B instead of the 8 they have. So it is OK. Thanks for your reply, J=C3=BCrgen >=20 >=20 > Regards > Bernd. --=20 You are receiving this mail because: You are on the CC list for the bug.