On Thu, Jun 14, 2018 at 10:59:30AM +0200, Claudio Jeker wrote: > I'm not sure if I like this reachover from in_pcbconnect to > in6_pcbconnect. It is a bit of a layer violation from the old times. > Would be nice if those INET6 specifix reacovers could be removed from the > low level INET functions in the long run. In this regard this feels a bit > like a step back.
I am a bit unsure in which direction to move. Having in_pcb... and in6_pcb... functions means code duplication. in_pcbbind() handles both. Often this is better as the v4 and v6 code cannot diverge. I if the requirements of v4 and v6 are different, distinct functions make sense. But that should not be exposed as API. Why should the caller care that in_pcbbind() is one function while in_pcbconnect() and in6_pcbconnect() are two? Would it be better to always call in_pcb...() and the implementation handles the details? In the old times the IPv4 code was copied to IPv6 and hacked until it worked. While this is a reasonable approach to achieve quick results, we should clean that up. There is more mess like in_pcblookup_local() which takes a void * address to handle both families. I tried to improve that but I am not statisfied with the result. In general I think we should move the switch(af) down, but be careful that the result is indeed better. bluhm
