On Wed, 7 Aug 2013 07:11:38 +0200
Claudio Jeker <cje...@diehard.n-r-g.com> wrote:

> On Tue, Aug 06, 2013 at 09:24:13PM +0200, Christopher Zimmermann
> wrote:
> > Hi,
> > 
> > I'm currently working towards an IP_SENDSRCADDR implementation.
> > As a first step I moved the calls to in_pcbrehash() from 
> > in_pcb(dis)connect() and in_pcbbind() to the call sites of those 
> > functions. This should save some calls to in_pcbrehash() in the 
> > in_pcbconnect() codepath.
> > Also I improved code sharing between the IPv4 and IPv6 stacks by 
> > implementing a generic in_pcbsetport used by both stacks.
> > The next step will be to replace in_pcbconnect() by in_selectsrc() 
> > and in_pcbsetport() in udp_output() like the IPv6 stack does it.
> > The splsoftnet() lock could then be removed. Also implementing
> > IP_SENDSRCADDR will become trivial because in_selectsrc() won't
> > modify the struct inpcb like in_pcbconnect() does at the moment.
> > 
> > Not much testing yet. Just surfing the web and sending this mail...
> > 
> > I'd really like some feedback on whether I'm on the right track or 
> > doing something stupid here. I have no experience in the OpenBSD 
> > IP-stack yet.
> > 
> > 
> 
> Moving the calls of of in_pcbrehash() to outside of in_pcb.c is wrong.
> This is an internal function for the specific way fast PCB lookups are
> done at the moment.  Having that all over the place in higher level
> code where someone does a bind or connect call is not an option IMO.
> This needs to be done differently, sorry.
> 
> -- 
> :wq Claudio

Fixed this. Since I won't call in_pcbconnect from udp_output() anymore
when I'm finished this is no problem at all :)

Now I'm wondering whether the call to in6_pcbsetport() in udp6_output()
should be splnet protected? Isn't it possible for two processes to
acquire the same free port when one finds it before the other has
claimed it via in_pcbrehash() ?

Christopher


-- 
http://gmerlin.de
OpenPGP: http://gmerlin.de/christopher.pub
1917 680A 723C BF3D 2CA3  0E44 7E24 D19F 34B8 2A2A

Reply via email to