Git development
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Brandon Casey <casey@nrlssc.navy.mil>
Cc: git@vger.kernel.org, git@mlists.thewrittenword.com,
	kusmabite@gmail.com, martin@martin.st,
	Brandon Casey <drafnel@gmail.com>
Subject: Re: [PATCH] daemon.c: avoid accessing ss_family member of struct sockaddr_storage
Date: Mon, 15 Mar 2010 17:29:15 -0400	[thread overview]
Message-ID: <20100315212915.GB25342@coredump.intra.peff.net> (raw)
In-Reply-To: <XI3O9HirgFwPkEqC3RdYR4j56mg_uuJQZk1YFST6ukqbKXjgxaqJdNDHwlLXg5R_FVXWmWQSGmg@cipher.nrlssc.navy.mil>

On Mon, Mar 15, 2010 at 04:03:00PM -0500, Brandon Casey wrote:

> When NO_SOCKADDR_STORAGE is set for a platform, either sockaddr_in or
> sockaddr_in6 is used intead.  Neither of which has an ss_family member.
> They have an sin_family and sin6_family member respectively.  Since the
> addrcmp() function accesses the ss_family member of a sockaddr_storage
> struct, compilation fails on platforms which define NO_SOCKADDR_STORGAGE.
> 
> Since any sockaddr_* structure can be cast to a struct sockaddr and
> have its sa_family member read, do so here to workaround this issue.

Didn't Gary say that AIX 5.2 sticks sa_len at the front of their
sockaddr?

We know that whatever we actually have (an actual sockaddr_storage, or a
sockaddr_in, or a sockaddr_in6) will have the family at the front, so
can you just cast it to sa_family_t?

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.

-Peff

  reply	other threads:[~2010-03-15 21:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-11 16:37 [PATCH 5/5] struct sockaddr_storage->ss_family is not portable Gary V. Vaughan
2010-03-11 16:40 ` Martin Storsjö
2010-03-12  4:56   ` Gary V. Vaughan
2010-03-12  7:24     ` Martin Storsjö
2010-03-15 21:03       ` [PATCH] daemon.c: avoid accessing ss_family member of struct sockaddr_storage Brandon Casey
2010-03-15 21:29         ` Jeff King [this message]
2010-03-15 21:41           ` Martin Storsjö
2010-03-15 21:42           ` Brandon Casey
2010-04-25  8:37             ` Gary V. Vaughan
2010-03-15 21:37         ` Martin Storsjö
2010-03-15 22:10           ` [PATCH v2] " Brandon Casey
2010-03-16  7:52             ` Martin Storsjö
2010-04-25  8:36       ` [PATCH 5/5] struct sockaddr_storage->ss_family is not portable Gary V. Vaughan
2010-04-25 19:05         ` Martin Storsjö
2010-04-26 16:55           ` Gary V. Vaughan
2010-03-11 22:27 ` Jeff King
2010-03-11 23:57   ` Brandon Casey

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=20100315212915.GB25342@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=casey@nrlssc.navy.mil \
    --cc=drafnel@gmail.com \
    --cc=git@mlists.thewrittenword.com \
    --cc=git@vger.kernel.org \
    --cc=kusmabite@gmail.com \
    --cc=martin@martin.st \
    /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