git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] daemon.c: avoid accessing ss_family member of struct sockaddr_storage

From
GVGary V. Vaughan <git@mlists.thewrittenword.com>
Date
Apr 25, 2010, 08:37 UTC
Message-ID
<20100316065127.GA26370@thor.il.thewrittenword.com>
In-Reply-To
<s0MQZSOEsdBJUhITxC3jwfFJk5PnIEo0WR5z_GEnSOw@cipher.nrlssc.navy.mil>

The git@mlists... address is the one subscribed to this list, to make it easy for us to filter list messages into shared folders. Because we manage so many packages, one or other of us will drop in and out of contact on the relevant lists depending what package we happen to be working on.

Anyway, you can always put a post directly in my INBOX by Cc:ing gary@thewrittenword.com and/or gary@gnu.org if you'd like to be sure that I will read something. :)

On Mon, Mar 15, 2010 at 04:42:57PM -0500, Brandon Casey wrote:
Show 21 quoted lines
> I expect that the layout of the sockaddr_* family of structures will
> follow the layout of struct sockaddr, otherwise they wouldn't be
> compatible.
> 
> In other words, I think that if struct sockaddr looks like this:
> 
>   struct sockaddr {
>         uchar_t         sa_len;         /* total length */
>         sa_family_t     sa_family;      /* address family */
>         char            sa_data[14];    /* actually longer; address value */
>   };
> 
> then somewhere else, struct sockaddr_in looks like this:
> 
>   struct sockaddr_in {
>         uchar_t         sin_len;
>         sin_family_t    sin_family;
>         sin_port;
>         sin_addr;
>         ...
>   };
Show 8 quoted lines
> On 03/15/2010 04:29 PM, Jeff King wrote:
> > Or am I wrong in assuming that, and on AIX sockaddr_in actually has
> > sa_len at the front, so casting to sockaddr does the right thing (and my
> > recommendation above would actually be broken)? The AIX boxen I have
> > access to are all down at the moment.
> 
> Maybe Gary can check for us... Gary, what does the declaration for
> struct sockaddr_in look like in your AIX header file?
/usr/include/netinet/in.h excerpt:
/*
 * Socket address, internet style.
 */
struct sockaddr_in {
        uchar_t        sin_len;
        sa_family_t    sin_family;
        in_port_t      sin_port;
        struct in_addr sin_addr;
        uchar_t        sin_zero[8];
};
Cheers,
-- 
Gary V. Vaughan (gary@thewrittenword.com)
Previous: Brandon CaseyNext: Martin Storsjö
Message 9 of 17 in “struct sockaddr_storage->ss_family is not portable”
  1. 5/5 struct sockaddr_storage->ss_family is not portableGary V. Vaughan, Mar 11, 2010
  2. Martin StorsjöMar 11, 2010
  3. Gary V. VaughanMar 12, 2010
  4. Martin StorsjöMar 12, 2010
  5. daemon.c: avoid accessing ss_family member of struct sockaddr_storageBrandon Casey, Mar 15, 2010
  6. Jeff KingMar 15, 2010
  7. Martin StorsjöMar 15, 2010
  8. Brandon CaseyMar 15, 2010
  9. Gary V. VaughanApr 25, 2010
  10. Martin StorsjöMar 15, 2010
  11. daemon.c: avoid accessing ss_family member of struct sockaddr_storageBrandon Casey, Mar 15, 2010
  12. Martin StorsjöMar 16, 2010
  13. Gary V. VaughanApr 25, 2010
  14. Martin StorsjöApr 25, 2010
  15. Gary V. VaughanApr 26, 2010
  16. Jeff KingMar 11, 2010
  17. Brandon CaseyMar 11, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.