On Sun, Jan 22, 2017 at 07:07:28AM +1000, Philip Guenther wrote:
> On Sun, 22 Jan 2017, Martin Pieuchot wrote:
> > On 21/01/17(Sat) 20:40, Philip Guenther wrote:
> > > 
> > > This is your periodic reminder that it's pointless for userspace to set 
> > > the {sun,sin,sin6,etc}_len field in sockaddrs being passed to the POSIX 
> > > APIs.  An application can use it internally for its own purposes, but the 
> > > kernel always overwrites the value when passed in.
> > 
> > I'd say explicit is better than implicit.  Is there any bug in the code
> > below?
> > 
> > I believe it is simpler to always set the length, it makes our life easier
> > when review code between kernel and userland.  Or should we have two
> > different practices because history screwed up?
> 
> Let's something that has no effect, just for visual consistency?  When the 
> value there is ignored, what reason is there to believe the correct value 
> is being used?
> 
> Meanwhile, new code coming in from elsewhere is unlikely to set it, as 
> that field doesn't exist on non-BSDs, so we either (a) add ignored 
> assignments, or (b) be inconsistent inside userland.  Oh, and -portable 
> projects have to patch out use of it.
> 
> I would rather have userland be consistent with itself and inconsistent 
> with the kernel, than try for an incomplete consistency between userland 
> and the kernel that spreads the inconsistency inside userland.
> 
> Kernel and userland best practices are already quite different, including 
> this in that list is the lesser evil.
> 

I would love to remove this from smtpd to reduce diff with portable,
so i'm generally ok with the idea


-- 
Gilles Chehade

https://www.poolp.org                                          @poolpOrg

Reply via email to