diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 050fb8875edf..0b9181caf004 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -157,10 +157,11 @@ SYSCTL_INT(_net_inet_ip_portrange, OID_AUTO, reservedlow, * Allocate a PCB and associate it with the socket. */ int -in_pcballoc(so, pcbinfo, td) +in_pcballoc(so, pcbinfo, td, type) struct socket *so; struct inpcbinfo *pcbinfo; struct thread *td; + const char *type; { register struct inpcb *inp; int error; @@ -198,7 +199,7 @@ in_pcballoc(so, pcbinfo, td) LIST_INSERT_HEAD(pcbinfo->listhead, inp, inp_list); pcbinfo->ipi_count++; so->so_pcb = (caddr_t)inp; - INP_LOCK_INIT(inp, "inp"); + INP_LOCK_INIT(inp, "inp", type); #ifdef INET6 if (ip6_auto_flowlabel) inp->inp_flags |= IN6P_AUTOFLOWLABEL; diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index 5e93328978fe..cb9b20dbe081 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -242,8 +242,8 @@ struct inpcbinfo { /* XXX documentation, prefixes */ * this code is shared by both IPv4 and IPv6 and IPv6 is * not properly locked. */ -#define INP_LOCK_INIT(inp, d) \ - mtx_init(&(inp)->inp_mtx, (d), NULL, MTX_DEF | MTX_RECURSE | MTX_DUPOK) +#define INP_LOCK_INIT(inp, d, t) \ + mtx_init(&(inp)->inp_mtx, (d), (t), MTX_DEF | MTX_RECURSE | MTX_DUPOK) #define INP_LOCK_DESTROY(inp) mtx_destroy(&(inp)->inp_mtx) #define INP_LOCK(inp) mtx_lock(&(inp)->inp_mtx) #define INP_UNLOCK(inp) mtx_unlock(&(inp)->inp_mtx) @@ -337,7 +337,8 @@ extern int ipport_hifirstauto; extern int ipport_hilastauto; void in_pcbpurgeif0(struct inpcbinfo *, struct ifnet *); -int in_pcballoc(struct socket *, struct inpcbinfo *, struct thread *); +int in_pcballoc(struct socket *, struct inpcbinfo *, struct thread *, + const char *); int in_pcbbind(struct inpcb *, struct sockaddr *, struct thread *); int in_pcbbind_setup(struct inpcb *, struct sockaddr *, in_addr_t *, u_short *, struct thread *); diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index bd777dd0224f..fe560a0871bf 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -393,7 +393,7 @@ div_attach(struct socket *so, int proto, struct thread *td) INP_INFO_WUNLOCK(&divcbinfo); return error; } - error = in_pcballoc(so, &divcbinfo, td); + error = in_pcballoc(so, &divcbinfo, td, "divinp"); if (error) { INP_INFO_WUNLOCK(&divcbinfo); return error; diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 0a76a7f68f59..67df380587f5 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -541,7 +541,7 @@ rip_attach(struct socket *so, int proto, struct thread *td) INP_INFO_WUNLOCK(&ripcbinfo); return error; } - error = in_pcballoc(so, &ripcbinfo, td); + error = in_pcballoc(so, &ripcbinfo, td, "rawinp"); if (error) { INP_INFO_WUNLOCK(&ripcbinfo); return error; diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 17566c8b3822..985d3b5de139 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1175,7 +1175,7 @@ tcp_attach(so, td) if (error) return (error); } - error = in_pcballoc(so, &tcbinfo, td); + error = in_pcballoc(so, &tcbinfo, td, "tcpinp"); if (error) return (error); inp = sotoinpcb(so); diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 62e61316715f..2b582b233b7c 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -943,7 +943,7 @@ udp_attach(struct socket *so, int proto, struct thread *td) return error; } s = splnet(); - error = in_pcballoc(so, &udbinfo, td); + error = in_pcballoc(so, &udbinfo, td, "udpinp"); splx(s); if (error) { INP_INFO_WUNLOCK(&udbinfo); diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index 1bd27c5e0ec8..36e3fbce7936 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -580,7 +580,7 @@ rip6_attach(struct socket *so, int proto, struct thread *td) if (error) return error; s = splnet(); - error = in_pcballoc(so, &ripcbinfo, td); + error = in_pcballoc(so, &ripcbinfo, td, "raw6inp"); splx(s); if (error) return error; diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 407d98bccd97..e0612b3f59ce 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -560,7 +560,7 @@ udp6_attach(struct socket *so, int proto, struct thread *td) return error; } s = splnet(); - error = in_pcballoc(so, &udbinfo, td); + error = in_pcballoc(so, &udbinfo, td, "udp6inp"); splx(s); if (error) return error;