inpcb: Save local group index
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 21 Sep 2014 13:00:32 +0000 (21:00 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 28 Sep 2014 12:49:11 +0000 (20:49 +0800)
commitd31e82302ae39c4b008419f7fda0c1ac5f927f3b
tree57e303b2c2c486c6a584b7246d402891d6082f34
parent06f8943e75900ef8c6df45f3c6f828c26e164da6
inpcb: Save local group index

So that the caller, e.g. UDP protocol, could redistribute the inpcb
accordingly.

We keep the local group sorted by the inpcb local group index in
ascending order.  This eases the multi-process userland application
which uses SO_REUSEPORT sockets and binds process to the owner cpu
of the SO_REUSEPORT socket:
If we didn't sort the local group by the inpcb local group index and
one of the process owning an inpcb in this local group restarted, e.g.
crashed and restarted by watchdog, other processes owning a inpcb in
this local group would have to detect that event, refetch its socket's
owner cpu, and re-bind.
sys/netinet/in_pcb.c
sys/netinet/in_pcb.h