public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
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	[thread overview]
Message-ID: <bug-1001656-104-eB0m5GTpOi@http.bugs.ecos.sourceware.org/> (raw)
In-Reply-To: <bug-1001656-104@http.bugs.ecos.sourceware.org/>

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001656

--- Comment #6 from Bernd Edlinger <bernd.edlinger@hotmail.de> ---
(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[8];' instead of
> 'u_char sll_addr[22];'.
> 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.

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2013-07-15 12:58 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-17 13:50 [Bug 1001656] New: " bugzilla-daemon
2012-08-17 13:54 ` [Bug 1001656] " bugzilla-daemon
2012-08-17 15:12 ` bugzilla-daemon
2012-09-14 14:08 ` bugzilla-daemon
2013-06-25 17:11 ` bugzilla-daemon
2013-07-15 12:01 ` bugzilla-daemon
2013-07-15 12:58 ` bugzilla-daemon [this message]
2013-07-15 15:39 ` bugzilla-daemon
2013-07-23 18:48 ` bugzilla-daemon
2013-11-26  9:49 ` bugzilla-daemon
2013-11-26 10:21 ` bugzilla-daemon
2013-12-06 10:03 ` bugzilla-daemon
2013-12-06 15:37 ` bugzilla-daemon
2013-12-09 14:25 ` bugzilla-daemon
2013-12-31  0:13 ` bugzilla-daemon
2014-01-21 16:46 ` bugzilla-daemon
2014-01-22  7:46 ` bugzilla-daemon
2014-01-31 10:39 ` bugzilla-daemon
2014-01-31 10:41 ` bugzilla-daemon
2014-01-31 10:43 ` bugzilla-daemon
2014-01-31 10:44 ` bugzilla-daemon
2014-01-31 10:51 ` bugzilla-daemon
2015-06-10  8:48 ` bugzilla-daemon
2015-06-10  8:53 ` bugzilla-daemon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-1001656-104-eB0m5GTpOi@http.bugs.ecos.sourceware.org/ \
    --to=bugzilla-daemon@bugs.ecos.sourceware.org \
    --cc=ecos-patches@ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).