This is the mail archive of the
mailing list for the eCos project.
[Bug 1001656] FreeBSD: add AF_PACKET socket familiy
- From: bugzilla-daemon at bugs dot ecos dot sourceware dot org
- To: unassigned at bugs dot ecos dot sourceware dot org
- Date: Mon, 15 Jul 2013 15:39:40 +0000
- Subject: [Bug 1001656] FreeBSD: add AF_PACKET socket familiy
- Auto-submitted: auto-generated
- References: <bug-1001656-777 at http dot bugs dot ecos dot sourceware dot org/>
Please do not reply to this email, use the link below.
--- Comment #7 from Juergen Lambrecht <J.Lambrecht@televic.com> ---
(In reply to comment #6)
> (In reply to comment #5)
> Hi JÃrgen,
> > 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 definition
> > of 'struct sockaddr_ll' (as also used by busybox): I have 'int sll_ifindex;'
> > instead of 'u_short sll_index;' and 'unsigned char sll_addr;' instead of
> > 'u_char sll_addr;'.
> > I guess the naming difference is because your code is based on the freeBSD,
> > 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) = 20 which is larger than
> sizeof(struct sockaddr) = 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 = *sa;
> regading 1, I will change the name.
OK, I did the same
> 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?
No, it's OK. The code compiled without warnings so far.
> 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?
No. Busybox code also only uses 6B instead of the 8 they have.
So it is OK.
Thanks for your reply,
You are receiving this mail because:
You are the assignee for the bug.