Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Oct 2001 10:58:11 -0700 (PDT)
From:      John Polstra <jdp@polstra.com>
To:        hackers@freebsd.org
Cc:        dillon@earth.backplane.com
Subject:   Re: sin_zero & bind problems
Message-ID:  <200110131758.f9DHwB009026@vashon.polstra.com>
In-Reply-To: <200110131717.f9DHHLR43887@earth.backplane.com>
References:  <20011013135842.A415@iv.nn.kiev.ua> <200110131717.f9DHHLR43887@earth.backplane.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <200110131717.f9DHHLR43887@earth.backplane.com>,
Matt Dillon  <dillon@earth.backplane.com> wrote:

>     Nobody in their right mind uses a struct sockaddr_in or any other 
>     struct sock* type of structure without zeroing it first.

That's definitely true in reality, but I'm not sure it's a desirable
situation.  It runs counter to what POSIX generally requires.  For
example, if you use sigaction() you only have to set the struct
sigaction members that are documented in the spec, even though the
structure may have additional members on some platforms.  In POSIX the
rule is generally that you don't have to set any extra members unless
an additional non-standard flag is set (e.g., in sa_flags) indicating
that the member is valid.

On the other hand (now arguing against myself), I guess by setting
sin_len = sizeof(struct sockaddr_in) one is saying that the entire
structure is valid, including sin_zero.  *Grumble* I wish they had
never put the sin_zero member in there in the first place.

John
-- 
  John Polstra
  John D. Polstra & Co., Inc.                        Seattle, Washington USA
  "Disappointment is a good sign of basic intelligence."  -- Chögyam Trungpa


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200110131758.f9DHwB009026>