Rename some fields of struct inpcbinfo to have the ipi_ prefix,
consistent with the naming of other structure field members, and reducing improper grep matches. Clean up and comment structure fields in structure definition.
This commit is contained in:
parent
2f9f08b635
commit
712fc218a0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=169154
@ -216,7 +216,7 @@ in_pcballoc(struct socket *so, struct inpcbinfo *pcbinfo)
|
||||
inp->inp_flags |= IN6P_IPV6_V6ONLY;
|
||||
}
|
||||
#endif
|
||||
LIST_INSERT_HEAD(pcbinfo->listhead, inp, inp_list);
|
||||
LIST_INSERT_HEAD(pcbinfo->ipi_listhead, inp, inp_list);
|
||||
pcbinfo->ipi_count++;
|
||||
so->so_pcb = (caddr_t)inp;
|
||||
#ifdef INET6
|
||||
@ -408,7 +408,7 @@ in_pcbbind_setup(struct inpcb *inp, struct sockaddr *nam, in_addr_t *laddrp,
|
||||
if (inp->inp_flags & INP_HIGHPORT) {
|
||||
first = ipport_hifirstauto; /* sysctl */
|
||||
last = ipport_hilastauto;
|
||||
lastport = &pcbinfo->lasthi;
|
||||
lastport = &pcbinfo->ipi_lasthi;
|
||||
} else if (inp->inp_flags & INP_LOWPORT) {
|
||||
error = priv_check_cred(cred,
|
||||
PRIV_NETINET_RESERVEDPORT, SUSER_ALLOWJAIL);
|
||||
@ -416,11 +416,11 @@ in_pcbbind_setup(struct inpcb *inp, struct sockaddr *nam, in_addr_t *laddrp,
|
||||
return error;
|
||||
first = ipport_lowfirstauto; /* 1023 */
|
||||
last = ipport_lowlastauto; /* 600 */
|
||||
lastport = &pcbinfo->lastlow;
|
||||
lastport = &pcbinfo->ipi_lastlow;
|
||||
} else {
|
||||
first = ipport_firstauto; /* sysctl */
|
||||
last = ipport_lastauto;
|
||||
lastport = &pcbinfo->lastport;
|
||||
lastport = &pcbinfo->ipi_lastport;
|
||||
}
|
||||
/*
|
||||
* For UDP, use random port allocation as long as the user
|
||||
@ -846,7 +846,7 @@ in_pcbnotifyall(struct inpcbinfo *pcbinfo, struct in_addr faddr, int errno,
|
||||
struct inpcbhead *head;
|
||||
|
||||
INP_INFO_WLOCK(pcbinfo);
|
||||
head = pcbinfo->listhead;
|
||||
head = pcbinfo->ipi_listhead;
|
||||
for (inp = LIST_FIRST(head); inp != NULL; inp = ninp) {
|
||||
INP_LOCK(inp);
|
||||
ninp = LIST_NEXT(inp, inp_list);
|
||||
@ -875,7 +875,7 @@ in_pcbpurgeif0(struct inpcbinfo *pcbinfo, struct ifnet *ifp)
|
||||
int i, gap;
|
||||
|
||||
INP_INFO_RLOCK(pcbinfo);
|
||||
LIST_FOREACH(inp, pcbinfo->listhead, inp_list) {
|
||||
LIST_FOREACH(inp, pcbinfo->ipi_listhead, inp_list) {
|
||||
INP_LOCK(inp);
|
||||
imo = inp->inp_moptions;
|
||||
if ((inp->inp_vflag & INP_IPV4) &&
|
||||
@ -932,7 +932,8 @@ in_pcblookup_local(struct inpcbinfo *pcbinfo, struct in_addr laddr,
|
||||
* Look for an unconnected (wildcard foreign addr) PCB that
|
||||
* matches the local address and port we're looking for.
|
||||
*/
|
||||
head = &pcbinfo->hashbase[INP_PCBHASH(INADDR_ANY, lport, 0, pcbinfo->hashmask)];
|
||||
head = &pcbinfo->ipi_hashbase[INP_PCBHASH(INADDR_ANY, lport,
|
||||
0, pcbinfo->ipi_hashmask)];
|
||||
LIST_FOREACH(inp, head, inp_hash) {
|
||||
#ifdef INET6
|
||||
if ((inp->inp_vflag & INP_IPV4) == 0)
|
||||
@ -961,8 +962,8 @@ in_pcblookup_local(struct inpcbinfo *pcbinfo, struct in_addr laddr,
|
||||
* First see if this local port is in use by looking on the
|
||||
* port hash list.
|
||||
*/
|
||||
porthash = &pcbinfo->porthashbase[INP_PCBPORTHASH(lport,
|
||||
pcbinfo->porthashmask)];
|
||||
porthash = &pcbinfo->ipi_porthashbase[INP_PCBPORTHASH(lport,
|
||||
pcbinfo->ipi_porthashmask)];
|
||||
LIST_FOREACH(phd, porthash, phd_hash) {
|
||||
if (phd->phd_port == lport)
|
||||
break;
|
||||
@ -1035,8 +1036,8 @@ in_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in_addr faddr,
|
||||
/*
|
||||
* First look for an exact match.
|
||||
*/
|
||||
head = &pcbinfo->hashbase[INP_PCBHASH(faddr.s_addr, lport, fport,
|
||||
pcbinfo->hashmask)];
|
||||
head = &pcbinfo->ipi_hashbase[INP_PCBHASH(faddr.s_addr, lport, fport,
|
||||
pcbinfo->ipi_hashmask)];
|
||||
LIST_FOREACH(inp, head, inp_hash) {
|
||||
#ifdef INET6
|
||||
if ((inp->inp_vflag & INP_IPV4) == 0)
|
||||
@ -1058,8 +1059,8 @@ in_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in_addr faddr,
|
||||
struct inpcb *local_wild_mapped = NULL;
|
||||
#endif
|
||||
|
||||
head = &pcbinfo->hashbase[INP_PCBHASH(INADDR_ANY, lport, 0,
|
||||
pcbinfo->hashmask)];
|
||||
head = &pcbinfo->ipi_hashbase[INP_PCBHASH(INADDR_ANY, lport,
|
||||
0, pcbinfo->ipi_hashmask)];
|
||||
LIST_FOREACH(inp, head, inp_hash) {
|
||||
#ifdef INET6
|
||||
if ((inp->inp_vflag & INP_IPV4) == 0)
|
||||
@ -1114,11 +1115,11 @@ in_pcbinshash(struct inpcb *inp)
|
||||
#endif /* INET6 */
|
||||
hashkey_faddr = inp->inp_faddr.s_addr;
|
||||
|
||||
pcbhash = &pcbinfo->hashbase[INP_PCBHASH(hashkey_faddr,
|
||||
inp->inp_lport, inp->inp_fport, pcbinfo->hashmask)];
|
||||
pcbhash = &pcbinfo->ipi_hashbase[INP_PCBHASH(hashkey_faddr,
|
||||
inp->inp_lport, inp->inp_fport, pcbinfo->ipi_hashmask)];
|
||||
|
||||
pcbporthash = &pcbinfo->porthashbase[INP_PCBPORTHASH(inp->inp_lport,
|
||||
pcbinfo->porthashmask)];
|
||||
pcbporthash = &pcbinfo->ipi_porthashbase[
|
||||
INP_PCBPORTHASH(inp->inp_lport, pcbinfo->ipi_porthashmask)];
|
||||
|
||||
/*
|
||||
* Go through port list and look for a head for this lport.
|
||||
@ -1168,8 +1169,8 @@ in_pcbrehash(struct inpcb *inp)
|
||||
#endif /* INET6 */
|
||||
hashkey_faddr = inp->inp_faddr.s_addr;
|
||||
|
||||
head = &pcbinfo->hashbase[INP_PCBHASH(hashkey_faddr,
|
||||
inp->inp_lport, inp->inp_fport, pcbinfo->hashmask)];
|
||||
head = &pcbinfo->ipi_hashbase[INP_PCBHASH(hashkey_faddr,
|
||||
inp->inp_lport, inp->inp_fport, pcbinfo->ipi_hashmask)];
|
||||
|
||||
LIST_REMOVE(inp, inp_hash);
|
||||
LIST_INSERT_HEAD(head, inp, inp_hash);
|
||||
|
@ -44,11 +44,12 @@
|
||||
struct inpcbpolicy;
|
||||
|
||||
/*
|
||||
* Common structure pcb for internet protocol implementation.
|
||||
* Here are stored pointers to local and foreign host table
|
||||
* entries, local and foreign socket numbers, and pointers
|
||||
* up (to a socket structure) and down (to a protocol-specific)
|
||||
* control block.
|
||||
* Struct inpcb is the ommon structure pcb for the Internet Protocol
|
||||
* implementation.
|
||||
*
|
||||
* Pointers to local and foreign host table entries, local and foreign socket
|
||||
* numbers, and pointers up (to a socket structure) and down (to a
|
||||
* protocol-specific control block) are stored here.
|
||||
*/
|
||||
LIST_HEAD(inpcbhead, inpcb);
|
||||
LIST_HEAD(inpcbporthead, inpcbport);
|
||||
@ -56,8 +57,8 @@ typedef u_quad_t inp_gen_t;
|
||||
|
||||
/*
|
||||
* PCB with AF_INET6 null bind'ed laddr can receive AF_INET input packet.
|
||||
* So, AF_INET6 null laddr is also used as AF_INET null laddr,
|
||||
* by utilize following structure. (At last, same as INRIA)
|
||||
* So, AF_INET6 null laddr is also used as AF_INET null laddr, by utilizing
|
||||
* the following structure.
|
||||
*/
|
||||
struct in_addr_4in6 {
|
||||
u_int32_t ia46_pad32[3];
|
||||
@ -65,8 +66,8 @@ struct in_addr_4in6 {
|
||||
};
|
||||
|
||||
/*
|
||||
* NOTE: ipv6 addrs should be 64-bit aligned, per RFC 2553.
|
||||
* in_conninfo has some extra padding to accomplish this.
|
||||
* NOTE: ipv6 addrs should be 64-bit aligned, per RFC 2553. in_conninfo has
|
||||
* some extra padding to accomplish this.
|
||||
*/
|
||||
struct in_endpoints {
|
||||
u_int16_t ie_fport; /* foreign port */
|
||||
@ -89,8 +90,8 @@ struct in_endpoints {
|
||||
};
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* the defines for inc_* are hacks and should be changed to direct references
|
||||
* XXX The defines for inc_* are hacks and should be changed to direct
|
||||
* references.
|
||||
*/
|
||||
struct in_conninfo {
|
||||
u_int8_t inc_flags;
|
||||
@ -137,7 +138,7 @@ struct inpcb {
|
||||
u_char inp_ip_p; /* protocol proto */
|
||||
u_char inp_ip_minttl; /* minimum TTL or drop */
|
||||
|
||||
/* Protocol dependent part; options. */
|
||||
/* Protocol-dependent part; options. */
|
||||
struct {
|
||||
u_char inp4_ip_tos; /* type of service proto */
|
||||
struct mbuf *inp4_options; /* IP options */
|
||||
@ -187,15 +188,15 @@ struct inpcb {
|
||||
#define in6p_ppcb inp_ppcb /* for KAME src sync over BSD*'s */
|
||||
};
|
||||
/*
|
||||
* The range of the generation count, as used in this implementation,
|
||||
* is 9e19. We would have to create 300 billion connections per
|
||||
* second for this number to roll over in a year. This seems sufficiently
|
||||
* unlikely that we simply don't concern ourselves with that possibility.
|
||||
* The range of the generation count, as used in this implementation, is 9e19.
|
||||
* We would have to create 300 billion connections per second for this number
|
||||
* to roll over in a year. This seems sufficiently unlikely that we simply
|
||||
* don't concern ourselves with that possibility.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Interface exported to userland by various protocols which use
|
||||
* inpcbs. Hack alert -- only define if struct xsocket is in scope.
|
||||
* Interface exported to userland by various protocols which use inpcbs. Hack
|
||||
* alert -- only define if struct xsocket is in scope.
|
||||
*/
|
||||
#ifdef _SYS_SOCKETVAR_H_
|
||||
struct xinpcb {
|
||||
@ -219,19 +220,48 @@ struct inpcbport {
|
||||
u_short phd_port;
|
||||
};
|
||||
|
||||
struct inpcbinfo { /* XXX documentation, prefixes */
|
||||
struct inpcbhead *hashbase;
|
||||
u_long hashmask;
|
||||
struct inpcbporthead *porthashbase;
|
||||
u_long porthashmask;
|
||||
struct inpcbhead *listhead;
|
||||
u_short lastport;
|
||||
u_short lastlow;
|
||||
u_short lasthi;
|
||||
struct uma_zone *ipi_zone; /* zone to allocate pcbs from */
|
||||
u_int ipi_count; /* number of pcbs in this list */
|
||||
u_quad_t ipi_gencnt; /* current generation count */
|
||||
struct mtx ipi_mtx;
|
||||
/*
|
||||
* Global data structure for each high-level protocol (UDP, TCP, ...) in both
|
||||
* IPv4 and IPv6. Holds inpcb lists and information for managing them.
|
||||
*/
|
||||
struct inpcbinfo {
|
||||
/*
|
||||
* Global list of inpcbs on the protocol.
|
||||
*/
|
||||
struct inpcbhead *ipi_listhead;
|
||||
u_int ipi_count;
|
||||
|
||||
/*
|
||||
* Global hash of inpcbs, hashed by local and foreign addresses and
|
||||
* port numbers.
|
||||
*/
|
||||
struct inpcbhead *ipi_hashbase;
|
||||
u_long ipi_hashmask;
|
||||
|
||||
/*
|
||||
* Global hash of inpcbs, hashed by only local port number.
|
||||
*/
|
||||
struct inpcbporthead *ipi_porthashbase;
|
||||
u_long ipi_porthashmask;
|
||||
|
||||
/*
|
||||
* Fields associated with port lookup and allocation.
|
||||
*/
|
||||
u_short ipi_lastport;
|
||||
u_short ipi_lastlow;
|
||||
u_short ipi_lasthi;
|
||||
|
||||
/*
|
||||
* UMA zone from which inpcbs are allocated for this protocol.
|
||||
*/
|
||||
struct uma_zone *ipi_zone;
|
||||
|
||||
/*
|
||||
* Generation count--incremented each time a connection is allocated
|
||||
* or freed.
|
||||
*/
|
||||
u_quad_t ipi_gencnt;
|
||||
struct mtx ipi_mtx;
|
||||
};
|
||||
|
||||
#define INP_LOCK_INIT(inp, d, t) \
|
||||
|
@ -147,14 +147,15 @@ div_init(void)
|
||||
{
|
||||
INP_INFO_LOCK_INIT(&divcbinfo, "div");
|
||||
LIST_INIT(&divcb);
|
||||
divcbinfo.listhead = &divcb;
|
||||
divcbinfo.ipi_listhead = &divcb;
|
||||
/*
|
||||
* XXX We don't use the hash list for divert IP, but it's easier
|
||||
* to allocate a one entry hash list than it is to check all
|
||||
* over the place for hashbase == NULL.
|
||||
*/
|
||||
divcbinfo.hashbase = hashinit(1, M_PCB, &divcbinfo.hashmask);
|
||||
divcbinfo.porthashbase = hashinit(1, M_PCB, &divcbinfo.porthashmask);
|
||||
divcbinfo.ipi_hashbase = hashinit(1, M_PCB, &divcbinfo.ipi_hashmask);
|
||||
divcbinfo.ipi_porthashbase = hashinit(1, M_PCB,
|
||||
&divcbinfo.ipi_porthashmask);
|
||||
divcbinfo.ipi_zone = uma_zcreate("divcb", sizeof(struct inpcb),
|
||||
NULL, NULL, div_inpcb_init, div_inpcb_fini, UMA_ALIGN_PTR,
|
||||
UMA_ZONE_NOFREE);
|
||||
@ -575,7 +576,7 @@ div_pcblist(SYSCTL_HANDLER_ARGS)
|
||||
return ENOMEM;
|
||||
|
||||
INP_INFO_RLOCK(&divcbinfo);
|
||||
for (inp = LIST_FIRST(divcbinfo.listhead), i = 0; inp && i < n;
|
||||
for (inp = LIST_FIRST(divcbinfo.ipi_listhead), i = 0; inp && i < n;
|
||||
inp = LIST_NEXT(inp, inp_list)) {
|
||||
INP_LOCK(inp);
|
||||
if (inp->inp_gencnt <= gencnt &&
|
||||
|
@ -133,14 +133,15 @@ rip_init()
|
||||
{
|
||||
INP_INFO_LOCK_INIT(&ripcbinfo, "rip");
|
||||
LIST_INIT(&ripcb);
|
||||
ripcbinfo.listhead = &ripcb;
|
||||
ripcbinfo.ipi_listhead = &ripcb;
|
||||
/*
|
||||
* XXX We don't use the hash list for raw IP, but it's easier
|
||||
* to allocate a one entry hash list than it is to check all
|
||||
* over the place for hashbase == NULL.
|
||||
*/
|
||||
ripcbinfo.hashbase = hashinit(1, M_PCB, &ripcbinfo.hashmask);
|
||||
ripcbinfo.porthashbase = hashinit(1, M_PCB, &ripcbinfo.porthashmask);
|
||||
ripcbinfo.ipi_hashbase = hashinit(1, M_PCB, &ripcbinfo.ipi_hashmask);
|
||||
ripcbinfo.ipi_porthashbase = hashinit(1, M_PCB,
|
||||
&ripcbinfo.ipi_porthashmask);
|
||||
ripcbinfo.ipi_zone = uma_zcreate("ripcb", sizeof(struct inpcb),
|
||||
NULL, NULL, rip_inpcb_init, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
|
||||
uma_zone_set_max(ripcbinfo.ipi_zone, maxsockets);
|
||||
@ -858,7 +859,7 @@ rip_pcblist(SYSCTL_HANDLER_ARGS)
|
||||
return ENOMEM;
|
||||
|
||||
INP_INFO_RLOCK(&ripcbinfo);
|
||||
for (inp = LIST_FIRST(ripcbinfo.listhead), i = 0; inp && i < n;
|
||||
for (inp = LIST_FIRST(ripcbinfo.ipi_listhead), i = 0; inp && i < n;
|
||||
inp = LIST_NEXT(inp, inp_list)) {
|
||||
INP_LOCK(inp);
|
||||
if (inp->inp_gencnt <= gencnt &&
|
||||
|
@ -315,16 +315,17 @@ tcp_init(void)
|
||||
|
||||
INP_INFO_LOCK_INIT(&tcbinfo, "tcp");
|
||||
LIST_INIT(&tcb);
|
||||
tcbinfo.listhead = &tcb;
|
||||
tcbinfo.ipi_listhead = &tcb;
|
||||
TUNABLE_INT_FETCH("net.inet.tcp.tcbhashsize", &hashsize);
|
||||
if (!powerof2(hashsize)) {
|
||||
printf("WARNING: TCB hash size not a power of 2\n");
|
||||
hashsize = 512; /* safe default */
|
||||
}
|
||||
tcp_tcbhashsize = hashsize;
|
||||
tcbinfo.hashbase = hashinit(hashsize, M_PCB, &tcbinfo.hashmask);
|
||||
tcbinfo.porthashbase = hashinit(hashsize, M_PCB,
|
||||
&tcbinfo.porthashmask);
|
||||
tcbinfo.ipi_hashbase = hashinit(hashsize, M_PCB,
|
||||
&tcbinfo.ipi_hashmask);
|
||||
tcbinfo.ipi_porthashbase = hashinit(hashsize, M_PCB,
|
||||
&tcbinfo.ipi_porthashmask);
|
||||
tcbinfo.ipi_zone = uma_zcreate("inpcb", sizeof(struct inpcb),
|
||||
NULL, NULL, tcp_inpcb_init, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
|
||||
uma_zone_set_max(tcbinfo.ipi_zone, maxsockets);
|
||||
@ -856,7 +857,7 @@ tcp_drain(void)
|
||||
* usefull.
|
||||
*/
|
||||
INP_INFO_RLOCK(&tcbinfo);
|
||||
LIST_FOREACH(inpb, tcbinfo.listhead, inp_list) {
|
||||
LIST_FOREACH(inpb, tcbinfo.ipi_listhead, inp_list) {
|
||||
if (inpb->inp_vflag & INP_TIMEWAIT)
|
||||
continue;
|
||||
INP_LOCK(inpb);
|
||||
@ -977,8 +978,8 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
|
||||
return (ENOMEM);
|
||||
|
||||
INP_INFO_RLOCK(&tcbinfo);
|
||||
for (inp = LIST_FIRST(tcbinfo.listhead), i = 0; inp != NULL && i < n;
|
||||
inp = LIST_NEXT(inp, inp_list)) {
|
||||
for (inp = LIST_FIRST(tcbinfo.ipi_listhead), i = 0; inp != NULL && i
|
||||
< n; inp = LIST_NEXT(inp, inp_list)) {
|
||||
INP_LOCK(inp);
|
||||
if (inp->inp_gencnt <= gencnt) {
|
||||
/*
|
||||
|
@ -315,16 +315,17 @@ tcp_init(void)
|
||||
|
||||
INP_INFO_LOCK_INIT(&tcbinfo, "tcp");
|
||||
LIST_INIT(&tcb);
|
||||
tcbinfo.listhead = &tcb;
|
||||
tcbinfo.ipi_listhead = &tcb;
|
||||
TUNABLE_INT_FETCH("net.inet.tcp.tcbhashsize", &hashsize);
|
||||
if (!powerof2(hashsize)) {
|
||||
printf("WARNING: TCB hash size not a power of 2\n");
|
||||
hashsize = 512; /* safe default */
|
||||
}
|
||||
tcp_tcbhashsize = hashsize;
|
||||
tcbinfo.hashbase = hashinit(hashsize, M_PCB, &tcbinfo.hashmask);
|
||||
tcbinfo.porthashbase = hashinit(hashsize, M_PCB,
|
||||
&tcbinfo.porthashmask);
|
||||
tcbinfo.ipi_hashbase = hashinit(hashsize, M_PCB,
|
||||
&tcbinfo.ipi_hashmask);
|
||||
tcbinfo.ipi_porthashbase = hashinit(hashsize, M_PCB,
|
||||
&tcbinfo.ipi_porthashmask);
|
||||
tcbinfo.ipi_zone = uma_zcreate("inpcb", sizeof(struct inpcb),
|
||||
NULL, NULL, tcp_inpcb_init, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
|
||||
uma_zone_set_max(tcbinfo.ipi_zone, maxsockets);
|
||||
@ -856,7 +857,7 @@ tcp_drain(void)
|
||||
* usefull.
|
||||
*/
|
||||
INP_INFO_RLOCK(&tcbinfo);
|
||||
LIST_FOREACH(inpb, tcbinfo.listhead, inp_list) {
|
||||
LIST_FOREACH(inpb, tcbinfo.ipi_listhead, inp_list) {
|
||||
if (inpb->inp_vflag & INP_TIMEWAIT)
|
||||
continue;
|
||||
INP_LOCK(inpb);
|
||||
@ -977,8 +978,8 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
|
||||
return (ENOMEM);
|
||||
|
||||
INP_INFO_RLOCK(&tcbinfo);
|
||||
for (inp = LIST_FIRST(tcbinfo.listhead), i = 0; inp != NULL && i < n;
|
||||
inp = LIST_NEXT(inp, inp_list)) {
|
||||
for (inp = LIST_FIRST(tcbinfo.ipi_listhead), i = 0; inp != NULL && i
|
||||
< n; inp = LIST_NEXT(inp, inp_list)) {
|
||||
INP_LOCK(inp);
|
||||
if (inp->inp_gencnt <= gencnt) {
|
||||
/*
|
||||
|
@ -156,10 +156,11 @@ udp_init()
|
||||
{
|
||||
INP_INFO_LOCK_INIT(&udbinfo, "udp");
|
||||
LIST_INIT(&udb);
|
||||
udbinfo.listhead = &udb;
|
||||
udbinfo.hashbase = hashinit(UDBHASHSIZE, M_PCB, &udbinfo.hashmask);
|
||||
udbinfo.porthashbase = hashinit(UDBHASHSIZE, M_PCB,
|
||||
&udbinfo.porthashmask);
|
||||
udbinfo.ipi_listhead = &udb;
|
||||
udbinfo.ipi_hashbase = hashinit(UDBHASHSIZE, M_PCB,
|
||||
&udbinfo.ipi_hashmask);
|
||||
udbinfo.ipi_porthashbase = hashinit(UDBHASHSIZE, M_PCB,
|
||||
&udbinfo.ipi_porthashmask);
|
||||
udbinfo.ipi_zone = uma_zcreate("udpcb", sizeof(struct inpcb), NULL,
|
||||
NULL, udp_inpcb_init, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
|
||||
uma_zone_set_max(udbinfo.ipi_zone, maxsockets);
|
||||
@ -633,7 +634,7 @@ udp_pcblist(SYSCTL_HANDLER_ARGS)
|
||||
return (ENOMEM);
|
||||
|
||||
INP_INFO_RLOCK(&udbinfo);
|
||||
for (inp = LIST_FIRST(udbinfo.listhead), i = 0; inp && i < n;
|
||||
for (inp = LIST_FIRST(udbinfo.ipi_listhead), i = 0; inp && i < n;
|
||||
inp = LIST_NEXT(inp, inp_list)) {
|
||||
INP_LOCK(inp);
|
||||
if (inp->inp_gencnt <= gencnt &&
|
||||
|
@ -650,7 +650,7 @@ in6_pcbnotify(pcbinfo, dst, fport_arg, src, lport_arg, cmd, cmdarg, notify)
|
||||
notify = in6_rtchange;
|
||||
}
|
||||
errno = inet6ctlerrmap[cmd];
|
||||
head = pcbinfo->listhead;
|
||||
head = pcbinfo->ipi_listhead;
|
||||
INP_INFO_WLOCK(pcbinfo);
|
||||
for (inp = LIST_FIRST(head); inp != NULL; inp = ninp) {
|
||||
INP_LOCK(inp);
|
||||
@ -734,8 +734,8 @@ in6_pcblookup_local(pcbinfo, laddr, lport_arg, wild_okay)
|
||||
* Look for an unconnected (wildcard foreign addr) PCB that
|
||||
* matches the local address and port we're looking for.
|
||||
*/
|
||||
head = &pcbinfo->hashbase[INP_PCBHASH(INADDR_ANY, lport, 0,
|
||||
pcbinfo->hashmask)];
|
||||
head = &pcbinfo->ipi_hashbase[INP_PCBHASH(INADDR_ANY, lport,
|
||||
0, pcbinfo->ipi_hashmask)];
|
||||
LIST_FOREACH(inp, head, inp_hash) {
|
||||
if ((inp->inp_vflag & INP_IPV6) == 0)
|
||||
continue;
|
||||
@ -762,8 +762,8 @@ in6_pcblookup_local(pcbinfo, laddr, lport_arg, wild_okay)
|
||||
* First see if this local port is in use by looking on the
|
||||
* port hash list.
|
||||
*/
|
||||
porthash = &pcbinfo->porthashbase[INP_PCBPORTHASH(lport,
|
||||
pcbinfo->porthashmask)];
|
||||
porthash = &pcbinfo->ipi_porthashbase[INP_PCBPORTHASH(lport,
|
||||
pcbinfo->ipi_porthashmask)];
|
||||
LIST_FOREACH(phd, porthash, phd_hash) {
|
||||
if (phd->phd_port == lport)
|
||||
break;
|
||||
@ -813,7 +813,7 @@ in6_pcbpurgeif0(pcbinfo, ifp)
|
||||
struct in6_multi_mship *imm, *nimm;
|
||||
|
||||
INP_INFO_RLOCK(pcbinfo);
|
||||
LIST_FOREACH(in6p, pcbinfo->listhead, inp_list) {
|
||||
LIST_FOREACH(in6p, pcbinfo->ipi_listhead, inp_list) {
|
||||
INP_LOCK(in6p);
|
||||
im6o = in6p->in6p_moptions;
|
||||
if ((in6p->inp_vflag & INP_IPV6) &&
|
||||
@ -903,9 +903,9 @@ in6_pcblookup_hash(pcbinfo, faddr, fport_arg, laddr, lport_arg, wildcard, ifp)
|
||||
/*
|
||||
* First look for an exact match.
|
||||
*/
|
||||
head = &pcbinfo->hashbase[INP_PCBHASH(faddr->s6_addr32[3] /* XXX */,
|
||||
lport, fport,
|
||||
pcbinfo->hashmask)];
|
||||
head = &pcbinfo->ipi_hashbase[
|
||||
INP_PCBHASH(faddr->s6_addr32[3] /* XXX */, lport, fport,
|
||||
pcbinfo->ipi_hashmask)];
|
||||
LIST_FOREACH(inp, head, inp_hash) {
|
||||
if ((inp->inp_vflag & INP_IPV6) == 0)
|
||||
continue;
|
||||
@ -922,8 +922,8 @@ in6_pcblookup_hash(pcbinfo, faddr, fport_arg, laddr, lport_arg, wildcard, ifp)
|
||||
if (wildcard) {
|
||||
struct inpcb *local_wild = NULL;
|
||||
|
||||
head = &pcbinfo->hashbase[INP_PCBHASH(INADDR_ANY, lport, 0,
|
||||
pcbinfo->hashmask)];
|
||||
head = &pcbinfo->ipi_hashbase[INP_PCBHASH(INADDR_ANY, lport,
|
||||
0, pcbinfo->ipi_hashmask)];
|
||||
LIST_FOREACH(inp, head, inp_hash) {
|
||||
if ((inp->inp_vflag & INP_IPV6) == 0)
|
||||
continue;
|
||||
|
@ -773,7 +773,7 @@ in6_pcbsetport(laddr, inp, cred)
|
||||
if (inp->inp_flags & INP_HIGHPORT) {
|
||||
first = ipport_hifirstauto; /* sysctl */
|
||||
last = ipport_hilastauto;
|
||||
lastport = &pcbinfo->lasthi;
|
||||
lastport = &pcbinfo->ipi_lasthi;
|
||||
} else if (inp->inp_flags & INP_LOWPORT) {
|
||||
error = priv_check_cred(cred, PRIV_NETINET_RESERVEDPORT,
|
||||
SUSER_ALLOWJAIL);
|
||||
@ -781,11 +781,11 @@ in6_pcbsetport(laddr, inp, cred)
|
||||
return error;
|
||||
first = ipport_lowfirstauto; /* 1023 */
|
||||
last = ipport_lowlastauto; /* 600 */
|
||||
lastport = &pcbinfo->lastlow;
|
||||
lastport = &pcbinfo->ipi_lastlow;
|
||||
} else {
|
||||
first = ipport_firstauto; /* sysctl */
|
||||
last = ipport_lastauto;
|
||||
lastport = &pcbinfo->lastport;
|
||||
lastport = &pcbinfo->ipi_lastport;
|
||||
}
|
||||
/*
|
||||
* Simple check to ensure all ports are not used up causing
|
||||
|
Loading…
Reference in New Issue
Block a user