Module Name: src Committed By: ozaki-r Date: Fri Nov 4 09:00:59 UTC 2022
Modified Files: src/sys/dist/pf/net: pf.c src/sys/net: if_wg.c src/sys/netcan: can.c src/sys/netinet: dccp_usrreq.c in_pcb.c in_pcb.h ip_output.c portalgo.c raw_ip.c sctp_usrreq.c tcp_input.c tcp_output.c tcp_subr.c tcp_syncache.c tcp_timer.c tcp_usrreq.c tcp_vtw.c udp_usrreq.c src/sys/netinet6: in6_pcb.c raw_ip6.c udp6_usrreq.c src/sys/netipsec: ipsec.c Log Message: inpcb: rename functions to inpcb_* Inspired by rmind-smpnet patches. To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/sys/dist/pf/net/pf.c cvs rdiff -u -r1.70 -r1.71 src/sys/net/if_wg.c cvs rdiff -u -r1.12 -r1.13 src/sys/netcan/can.c cvs rdiff -u -r1.24 -r1.25 src/sys/netinet/dccp_usrreq.c cvs rdiff -u -r1.194 -r1.195 src/sys/netinet/in_pcb.c cvs rdiff -u -r1.73 -r1.74 src/sys/netinet/in_pcb.h cvs rdiff -u -r1.322 -r1.323 src/sys/netinet/ip_output.c cvs rdiff -u -r1.13 -r1.14 src/sys/netinet/portalgo.c cvs rdiff -u -r1.183 -r1.184 src/sys/netinet/raw_ip.c cvs rdiff -u -r1.22 -r1.23 src/sys/netinet/sctp_usrreq.c cvs rdiff -u -r1.436 -r1.437 src/sys/netinet/tcp_input.c cvs rdiff -u -r1.216 -r1.217 src/sys/netinet/tcp_output.c cvs rdiff -u -r1.294 -r1.295 src/sys/netinet/tcp_subr.c cvs rdiff -u -r1.4 -r1.5 src/sys/netinet/tcp_syncache.c cvs rdiff -u -r1.98 -r1.99 src/sys/netinet/tcp_timer.c cvs rdiff -u -r1.236 -r1.237 src/sys/netinet/tcp_usrreq.c cvs rdiff -u -r1.23 -r1.24 src/sys/netinet/tcp_vtw.c cvs rdiff -u -r1.263 -r1.264 src/sys/netinet/udp_usrreq.c cvs rdiff -u -r1.173 -r1.174 src/sys/netinet6/in6_pcb.c cvs rdiff -u -r1.180 -r1.181 src/sys/netinet6/raw_ip6.c cvs rdiff -u -r1.152 -r1.153 src/sys/netinet6/udp6_usrreq.c cvs rdiff -u -r1.174 -r1.175 src/sys/netipsec/ipsec.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dist/pf/net/pf.c diff -u src/sys/dist/pf/net/pf.c:1.85 src/sys/dist/pf/net/pf.c:1.86 --- src/sys/dist/pf/net/pf.c:1.85 Fri Oct 28 05:20:08 2022 +++ src/sys/dist/pf/net/pf.c Fri Nov 4 09:00:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pf.c,v 1.85 2022/10/28 05:20:08 ozaki-r Exp $ */ +/* $NetBSD: pf.c,v 1.86 2022/11/04 09:00:58 ozaki-r Exp $ */ /* $OpenBSD: pf.c,v 1.552.2.1 2007/11/27 16:37:57 henning Exp $ */ /* @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pf.c,v 1.85 2022/10/28 05:20:08 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pf.c,v 1.86 2022/11/04 09:00:58 ozaki-r Exp $"); #include "pflog.h" @@ -2455,7 +2455,7 @@ pf_get_sport(sa_family_t af, u_int8_t pr /* * port search; start random, step; - * similar 2 portloop in in_pcbbind + * similar 2 portloop in inpcb_bind */ if (!(proto == IPPROTO_TCP || proto == IPPROTO_UDP || proto == IPPROTO_ICMP)) { @@ -2800,11 +2800,11 @@ pf_socket_lookup(int direction, struct p #ifdef __NetBSD__ #define in_pcbhashlookup(tbl, saddr, sport, daddr, dport) \ - in_pcblookup_connect(tbl, saddr, sport, daddr, dport, NULL) + inpcb_lookup(tbl, saddr, sport, daddr, dport, NULL) #define in6_pcbhashlookup(tbl, saddr, sport, daddr, dport) \ in6_pcblookup_connect(tbl, saddr, sport, daddr, dport, 0, NULL) #define in_pcblookup_listen(tbl, addr, port, zero) \ - in_pcblookup_bind(tbl, addr, port) + inpcb_lookup_bound(tbl, addr, port) #define in6_pcblookup_listen(tbl, addr, port, zero) \ in6_pcblookup_bind(tbl, addr, port, zero) #endif Index: src/sys/net/if_wg.c diff -u src/sys/net/if_wg.c:1.70 src/sys/net/if_wg.c:1.71 --- src/sys/net/if_wg.c:1.70 Fri Oct 28 05:20:08 2022 +++ src/sys/net/if_wg.c Fri Nov 4 09:00:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wg.c,v 1.70 2022/10/28 05:20:08 ozaki-r Exp $ */ +/* $NetBSD: if_wg.c,v 1.71 2022/11/04 09:00:58 ozaki-r Exp $ */ /* * Copyright (C) Ryota Ozaki <ozaki.ry...@gmail.com> @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.70 2022/10/28 05:20:08 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.71 2022/11/04 09:00:58 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_altq_enabled.h" @@ -3266,7 +3266,7 @@ wg_socreate(struct wg_softc *wg, int af, so->so_upcallarg = wg; so->so_upcall = wg_so_upcall; so->so_rcv.sb_flags |= SB_UPCALL; - in_pcb_register_overudp_cb(sotoinpcb(so), wg_overudp_cb, wg); + inpcb_register_overudp_cb(sotoinpcb(so), wg_overudp_cb, wg); sounlock(so); *sop = so; Index: src/sys/netcan/can.c diff -u src/sys/netcan/can.c:1.12 src/sys/netcan/can.c:1.13 --- src/sys/netcan/can.c:1.12 Sat Sep 3 02:07:32 2022 +++ src/sys/netcan/can.c Fri Nov 4 09:00:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: can.c,v 1.12 2022/09/03 02:07:32 thorpej Exp $ */ +/* $NetBSD: can.c,v 1.13 2022/11/04 09:00:58 ozaki-r Exp $ */ /*- * Copyright (c) 2003, 2017 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: can.c,v 1.12 2022/09/03 02:07:32 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: can.c,v 1.13 2022/11/04 09:00:58 ozaki-r Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -840,14 +840,14 @@ can_ctlinput(int cmd, struct sockaddr *s return NULL; errno = inetctlerrmap[cmd]; if (PRC_IS_REDIRECT(cmd)) - notify = in_rtchange, ip = 0; + notify = inpcb_rtchange, ip = 0; else if (cmd == PRC_HOSTDEAD) ip = 0; else if (errno == 0) return NULL; if (ip) { uh = (struct canhdr *)((caddr_t)ip + (ip->ip_hl << 2)); - in_pcbnotify(&udbtable, satosin(sa)->sin_addr, uh->uh_dport, + inpcb_notify(&udbtable, satosin(sa)->sin_addr, uh->uh_dport, ip->ip_src, uh->uh_sport, errno, notify); /* XXX mapped address case */ Index: src/sys/netinet/dccp_usrreq.c diff -u src/sys/netinet/dccp_usrreq.c:1.24 src/sys/netinet/dccp_usrreq.c:1.25 --- src/sys/netinet/dccp_usrreq.c:1.24 Fri Oct 28 05:26:29 2022 +++ src/sys/netinet/dccp_usrreq.c Fri Nov 4 09:00:58 2022 @@ -1,5 +1,5 @@ /* $KAME: dccp_usrreq.c,v 1.67 2005/11/03 16:05:04 nishida Exp $ */ -/* $NetBSD: dccp_usrreq.c,v 1.24 2022/10/28 05:26:29 ozaki-r Exp $ */ +/* $NetBSD: dccp_usrreq.c,v 1.25 2022/11/04 09:00:58 ozaki-r Exp $ */ /* * Copyright (c) 2003 Joacim Häggmark, Magnus Erixzon, Nils-Erik Mattsson @@ -67,7 +67,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: dccp_usrreq.c,v 1.24 2022/10/28 05:26:29 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dccp_usrreq.c,v 1.25 2022/11/04 09:00:58 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -177,7 +177,7 @@ dccp_init(void) pool_init(&dccpcb_pool, sizeof(struct dccpcb), 0, 0, 0, "dccpcbpl", NULL, IPL_SOFTNET); - in_pcbinit(&dccpbtable, DCCPBHASHSIZE, DCCPBHASHSIZE); + inpcb_init(&dccpbtable, DCCPBHASHSIZE, DCCPBHASHSIZE); } void @@ -347,11 +347,11 @@ dccp_input(struct mbuf *m, int off, int } else #endif { - inp = in_pcblookup_connect(&dccpbtable, ip->ip_src, + inp = inpcb_lookup(&dccpbtable, ip->ip_src, dh->dh_sport, ip->ip_dst, dh->dh_dport, 0); if (inp == NULL) { /* XXX stats increment? */ - inp = in_pcblookup_bind(&dccpbtable, ip->ip_dst, + inp = inpcb_lookup_bound(&dccpbtable, ip->ip_dst, dh->dh_dport); } } @@ -447,7 +447,7 @@ dccp_input(struct mbuf *m, int off, int in6p_faddr(inp) = ip6->ip6_src; inp->inp_lport = dh->dh_dport; inp->inp_fport = dh->dh_sport; - in_pcbstate(inp, INP_CONNECTED); + inpcb_set_state(inp, INP_CONNECTED); } else #endif { @@ -459,7 +459,7 @@ dccp_input(struct mbuf *m, int off, int } if (!isipv6) - in_pcbstate(inp, INP_BOUND); + inpcb_set_state(inp, INP_BOUND); dp = inp->inp_ppcb; @@ -944,7 +944,7 @@ dccp_ctlinput(int cmd, const struct sock if (PRC_IS_REDIRECT(cmd)) { ip = 0; - notify = in_rtchange; + notify = inpcb_rtchange; } else if (cmd == PRC_HOSTDEAD) ip = 0; else if ((unsigned)cmd >= PRC_NCMDS || inetctlerrmap[cmd] == 0) @@ -953,7 +953,7 @@ dccp_ctlinput(int cmd, const struct sock /*s = splsoftnet();*/ dh = (struct dccphdr *)((vaddr_t)ip + (ip->ip_hl << 2)); INP_INFO_RLOCK(&dccpbinfo); - in_pcbnotify(&dccpbtable, faddr, dh->dh_dport, + inpcb_notify(&dccpbtable, faddr, dh->dh_dport, ip->ip_src, dh->dh_sport, inetctlerrmap[cmd], notify); if (inp != NULL) { INP_LOCK(inp); @@ -965,7 +965,7 @@ dccp_ctlinput(int cmd, const struct sock INP_INFO_RUNLOCK(&dccpbinfo); /*splx(s);*/ } else - in_pcbnotifyall(&dccpbtable, faddr, inetctlerrmap[cmd], notify); + inpcb_notifyall(&dccpbtable, faddr, inetctlerrmap[cmd], notify); return NULL; } @@ -1593,7 +1593,7 @@ dccp_close(struct dccpcb *dp) pool_put(&dccpcb_pool, dp); inp->inp_ppcb = NULL; soisdisconnected(so); - in_pcbdetach(inp); + inpcb_destroy(inp); return ((struct dccpcb *)0); } @@ -1621,7 +1621,7 @@ dccp_attach(struct socket *so, int proto error = soreserve(so, dccp_sendspace, dccp_recvspace); if (error) goto out; - error = in_pcballoc(so, &dccpbtable); + error = inpcb_create(so, &dccpbtable); if (error) goto out; inp = sotoinpcb(so); @@ -1630,7 +1630,7 @@ dccp_attach(struct socket *so, int proto if (dp == 0) { int nofd = so->so_state & SS_NOFDREF; so->so_state &= ~SS_NOFDREF; - in_pcbdetach(inp); + inpcb_destroy(inp); so->so_state |= nofd; error = ENOBUFS; goto out; @@ -1676,7 +1676,7 @@ dccp_bind(struct socket *so, struct sock } INP_LOCK(inp); s = splsoftnet(); - error = in_pcbbind(inp, sin, l); + error = inpcb_bind(inp, sin, l); splx(s); INP_UNLOCK(inp); INP_INFO_WUNLOCK(&dccpbinfo); @@ -1784,10 +1784,10 @@ dccp_doconnect(struct socket *so, struct } else #endif /* INET6 */ { - error = in_pcbbind(inp, NULL, l); + error = inpcb_bind(inp, NULL, l); } if (error) { - DCCP_DEBUG((LOG_INFO, "in_pcbbind=%d\n",error)); + DCCP_DEBUG((LOG_INFO, "inpcb_bind=%d\n",error)); return error; } } @@ -1798,9 +1798,9 @@ dccp_doconnect(struct socket *so, struct DCCP_DEBUG((LOG_INFO, "in6_pcbconnect=%d\n",error)); } else #endif - error = in_pcbconnect(inp, (struct sockaddr_in *)nam, l); + error = inpcb_connect(inp, (struct sockaddr_in *)nam, l); if (error) { - DCCP_DEBUG((LOG_INFO, "in_pcbconnect=%d\n",error)); + DCCP_DEBUG((LOG_INFO, "inpcb_connect=%d\n",error)); return error; } @@ -2034,7 +2034,7 @@ dccp_listen(struct socket *so, struct lw INP_INFO_RUNLOCK(&dccpbinfo); dp = (struct dccpcb *)inp->inp_ppcb; if (inp->inp_lport == 0) - error = in_pcbbind(inp, NULL, td); + error = inpcb_bind(inp, NULL, td); if (error == 0) { dp->state = DCCPS_LISTEN; dp->who = DCCP_LISTENER; @@ -2070,14 +2070,14 @@ dccp_accept(struct socket *so, struct so } INP_LOCK(inp); INP_INFO_RUNLOCK(&dccpbinfo); - in_setpeeraddr(inp, (struct sockaddr_in *)nam); + inpcb_fetch_peeraddr(inp, (struct sockaddr_in *)nam); return error; } /* * Initializes a new DCCP control block - * (in_pcballoc in attach has already allocated memory for it) + * (inpcb_create in attach has already allocated memory for it) */ struct dccpcb * dccp_newdccpcb(int family, void *aux) @@ -2688,7 +2688,7 @@ dccp_peeraddr(struct socket *so, struct KASSERT(sotoinpcb(so) != NULL); KASSERT(nam != NULL); - in_setpeeraddr(sotoinpcb(so), (struct sockaddr_in *)nam); + inpcb_fetch_peeraddr(sotoinpcb(so), (struct sockaddr_in *)nam); return 0; } @@ -2700,7 +2700,7 @@ dccp_sockaddr(struct socket *so, struct KASSERT(sotoinpcb(so) != NULL); KASSERT(nam != NULL); - in_setsockaddr(sotoinpcb(so), (struct sockaddr_in *)nam); + inpcb_fetch_sockaddr(sotoinpcb(so), (struct sockaddr_in *)nam); return 0; } @@ -2738,9 +2738,9 @@ dccp_purgeif(struct socket *so, struct i s = splsoftnet(); mutex_enter(softnet_lock); - in_pcbpurgeif0(&dccpbtable, ifp); + inpcb_purgeif0(&dccpbtable, ifp); in_purgeif(ifp); - in_pcbpurgeif(&dccpbtable, ifp); + inpcb_purgeif(&dccpbtable, ifp); mutex_exit(softnet_lock); splx(s); Index: src/sys/netinet/in_pcb.c diff -u src/sys/netinet/in_pcb.c:1.194 src/sys/netinet/in_pcb.c:1.195 --- src/sys/netinet/in_pcb.c:1.194 Sat Oct 29 02:56:29 2022 +++ src/sys/netinet/in_pcb.c Fri Nov 4 09:00:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: in_pcb.c,v 1.194 2022/10/29 02:56:29 ozaki-r Exp $ */ +/* $NetBSD: in_pcb.c,v 1.195 2022/11/04 09:00:58 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -93,7 +93,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.194 2022/10/29 02:56:29 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.195 2022/11/04 09:00:58 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -175,7 +175,7 @@ inpcb_poolinit(void) } void -in_pcbinit(struct inpcbtable *table, int bindhashsize, int connecthashsize) +inpcb_init(struct inpcbtable *table, int bindhashsize, int connecthashsize) { static ONCE_DECL(control); @@ -193,7 +193,7 @@ in_pcbinit(struct inpcbtable *table, int } int -in_pcballoc(struct socket *so, void *v) +inpcb_create(struct socket *so, void *v) { struct inpcbtable *table = v; struct inpcb *inp; @@ -254,13 +254,13 @@ in_pcballoc(struct socket *so, void *v) TAILQ_INSERT_HEAD(&table->inpt_queue, inp, inp_queue); LIST_INSERT_HEAD(INPCBHASH_PORT(table, inp->inp_lport), inp, inp_lhash); - in_pcbstate(inp, INP_ATTACHED); + inpcb_set_state(inp, INP_ATTACHED); splx(s); return (0); } static int -in_pcbsetport(struct sockaddr_in *sin, struct inpcb *inp, kauth_cred_t cred) +inpcb_set_port(struct sockaddr_in *sin, struct inpcb *inp, kauth_cred_t cred) { struct inpcbtable *table = inp->inp_table; struct socket *so = inp->inp_socket; @@ -300,13 +300,13 @@ in_pcbsetport(struct sockaddr_in *sin, s *lastport = lport; lport = htons(lport); inp->inp_lport = lport; - in_pcbstate(inp, INP_BOUND); + inpcb_set_state(inp, INP_BOUND); return (0); } int -in_pcbbindableaddr(const struct inpcb *inp, struct sockaddr_in *sin, +inpcb_bindableaddr(const struct inpcb *inp, struct sockaddr_in *sin, kauth_cred_t cred) { int error = EADDRNOTAVAIL; @@ -318,7 +318,7 @@ in_pcbbindableaddr(const struct inpcb *i s = pserialize_read_enter(); if (IN_MULTICAST(sin->sin_addr.s_addr)) { - /* Always succeed; port reuse handled in in_pcbbind_port(). */ + /* Always succeed; port reuse handled in inpcb_bind_port(). */ } else if (!in_nullhost(sin->sin_addr)) { struct in_ifaddr *ia; @@ -345,18 +345,18 @@ in_pcbbindableaddr(const struct inpcb *i } static int -in_pcbbind_addr(struct inpcb *inp, struct sockaddr_in *sin, kauth_cred_t cred) +inpcb_bind_addr(struct inpcb *inp, struct sockaddr_in *sin, kauth_cred_t cred) { int error; - error = in_pcbbindableaddr(inp, sin, cred); + error = inpcb_bindableaddr(inp, sin, cred); if (error == 0) in4p_laddr(inp) = sin->sin_addr; return error; } static int -in_pcbbind_port(struct inpcb *inp, struct sockaddr_in *sin, kauth_cred_t cred) +inpcb_bind_port(struct inpcb *inp, struct sockaddr_in *sin, kauth_cred_t cred) { struct inpcbtable *table = inp->inp_table; struct socket *so = inp->inp_socket; @@ -376,7 +376,7 @@ in_pcbbind_port(struct inpcb *inp, struc } if (sin->sin_port == 0) { - error = in_pcbsetport(sin, inp, cred); + error = inpcb_set_port(sin, inp, cred); if (error) return (error); } else { @@ -417,7 +417,7 @@ in_pcbbind_port(struct inpcb *inp, struc /* XXX-kauth */ if (so->so_uidinfo->ui_uid && !IN_MULTICAST(sin->sin_addr.s_addr)) { - t = in_pcblookup_port(table, sin->sin_addr, sin->sin_port, 1, &vestige); + t = inpcb_lookup_local(table, sin->sin_addr, sin->sin_port, 1, &vestige); /* * XXX: investigate ramifications of loosening this * restriction so that as long as both ports have @@ -439,7 +439,7 @@ in_pcbbind_port(struct inpcb *inp, struc } } } - t = in_pcblookup_port(table, sin->sin_addr, sin->sin_port, wild, &vestige); + t = inpcb_lookup_local(table, sin->sin_addr, sin->sin_port, wild, &vestige); if (t && (reuseport & t->inp_socket->so_options) == 0) return (EADDRINUSE); if (!t @@ -448,7 +448,7 @@ in_pcbbind_port(struct inpcb *inp, struc return EADDRINUSE; inp->inp_lport = sin->sin_port; - in_pcbstate(inp, INP_BOUND); + inpcb_set_state(inp, INP_BOUND); } LIST_REMOVE(inp, inp_lhash); @@ -459,7 +459,7 @@ in_pcbbind_port(struct inpcb *inp, struc } int -in_pcbbind(void *v, struct sockaddr_in *sin, struct lwp *l) +inpcb_bind(void *v, struct sockaddr_in *sin, struct lwp *l) { struct inpcb *inp = v; struct sockaddr_in lsin; @@ -481,12 +481,12 @@ in_pcbbind(void *v, struct sockaddr_in * } /* Bind address. */ - error = in_pcbbind_addr(inp, sin, l->l_cred); + error = inpcb_bind_addr(inp, sin, l->l_cred); if (error) return (error); /* Bind port. */ - error = in_pcbbind_port(inp, sin, l->l_cred); + error = inpcb_bind_port(inp, sin, l->l_cred); if (error) { in4p_laddr(inp).s_addr = INADDR_ANY; @@ -503,7 +503,7 @@ in_pcbbind(void *v, struct sockaddr_in * * then pick one. */ int -in_pcbconnect(void *v, struct sockaddr_in *sin, struct lwp *l) +inpcb_connect(void *v, struct sockaddr_in *sin, struct lwp *l) { struct inpcb *inp = v; vestigial_inpcb_t vestige; @@ -593,14 +593,14 @@ in_pcbconnect(void *v, struct sockaddr_i curlwp_bindx(bound); } else laddr = in4p_laddr(inp); - if (in_pcblookup_connect(inp->inp_table, sin->sin_addr, sin->sin_port, + if (inpcb_lookup(inp->inp_table, sin->sin_addr, sin->sin_port, laddr, inp->inp_lport, &vestige) != NULL || vestige.valid) { return (EADDRINUSE); } if (in_nullhost(in4p_laddr(inp))) { if (inp->inp_lport == 0) { - error = in_pcbbind(inp, NULL, l); + error = inpcb_bind(inp, NULL, l); /* * This used to ignore the return value * completely, but we need to check for @@ -622,11 +622,11 @@ in_pcbconnect(void *v, struct sockaddr_i lsin.sin_addr = in4p_laddr(inp); lsin.sin_port = 0; - if ((error = in_pcbbind_port(inp, &lsin, l->l_cred)) != 0) + if ((error = inpcb_bind_port(inp, &lsin, l->l_cred)) != 0) return error; } - in_pcbstate(inp, INP_CONNECTED); + inpcb_set_state(inp, INP_CONNECTED); #if defined(IPSEC) if (ipsec_enabled && inp->inp_socket->so_type == SOCK_STREAM) ipsec_pcbconn(inp->inp_sp); @@ -635,7 +635,7 @@ in_pcbconnect(void *v, struct sockaddr_i } void -in_pcbdisconnect(void *v) +inpcb_disconnect(void *v) { struct inpcb *inp = v; @@ -644,17 +644,17 @@ in_pcbdisconnect(void *v) in4p_faddr(inp) = zeroin_addr; inp->inp_fport = 0; - in_pcbstate(inp, INP_BOUND); + inpcb_set_state(inp, INP_BOUND); #if defined(IPSEC) if (ipsec_enabled) ipsec_pcbdisconn(inp->inp_sp); #endif if (inp->inp_socket->so_state & SS_NOFDREF) - in_pcbdetach(inp); + inpcb_destroy(inp); } void -in_pcbdetach(void *v) +inpcb_destroy(void *v) { struct inpcb *inp = v; struct socket *so = inp->inp_socket; @@ -669,7 +669,7 @@ in_pcbdetach(void *v) so->so_pcb = NULL; s = splsoftnet(); - in_pcbstate(inp, INP_ATTACHED); + inpcb_set_state(inp, INP_ATTACHED); LIST_REMOVE(inp, inp_lhash); TAILQ_REMOVE(&inp->inp_table->inpt_queue, inp, inp_queue); splx(s); @@ -703,7 +703,7 @@ in_pcbdetach(void *v) } void -in_setsockaddr(struct inpcb *inp, struct sockaddr_in *sin) +inpcb_fetch_sockaddr(struct inpcb *inp, struct sockaddr_in *sin) { if (inp->inp_af != AF_INET) @@ -713,7 +713,7 @@ in_setsockaddr(struct inpcb *inp, struct } void -in_setpeeraddr(struct inpcb *inp, struct sockaddr_in *sin) +inpcb_fetch_peeraddr(struct inpcb *inp, struct sockaddr_in *sin) { if (inp->inp_af != AF_INET) @@ -734,7 +734,7 @@ in_setpeeraddr(struct inpcb *inp, struct * Must be called at splsoftnet. */ int -in_pcbnotify(struct inpcbtable *table, struct in_addr faddr, u_int fport_arg, +inpcb_notify(struct inpcbtable *table, struct in_addr faddr, u_int fport_arg, struct in_addr laddr, u_int lport_arg, int errno, void (*notify)(struct inpcb *, int)) { @@ -764,7 +764,7 @@ in_pcbnotify(struct inpcbtable *table, s } void -in_pcbnotifyall(struct inpcbtable *table, struct in_addr faddr, int errno, +inpcb_notifyall(struct inpcbtable *table, struct in_addr faddr, int errno, void (*notify)(struct inpcb *, int)) { struct inpcb *inp; @@ -813,7 +813,7 @@ in_purgeifmcast(struct ip_moptions *imo, } void -in_pcbpurgeif0(struct inpcbtable *table, struct ifnet *ifp) +inpcb_purgeif0(struct inpcbtable *table, struct ifnet *ifp) { struct inpcb *inp; @@ -837,7 +837,7 @@ in_pcbpurgeif0(struct inpcbtable *table, } void -in_pcbpurgeif(struct inpcbtable *table, struct ifnet *ifp) +inpcb_purgeif(struct inpcbtable *table, struct ifnet *ifp) { struct rtentry *rt; struct inpcb *inp; @@ -848,7 +848,7 @@ in_pcbpurgeif(struct inpcbtable *table, if ((rt = rtcache_validate(&inp->inp_route)) != NULL && rt->rt_ifp == ifp) { rtcache_unref(rt, &inp->inp_route); - in_rtchange(inp, 0); + inpcb_rtchange(inp, 0); } else rtcache_unref(rt, &inp->inp_route); } @@ -861,7 +861,7 @@ in_pcbpurgeif(struct inpcbtable *table, * (by a redirect), time to try a default gateway again. */ void -in_losing(struct inpcb *inp) +inpcb_losing(struct inpcb *inp) { struct rtentry *rt; struct rt_addrinfo info; @@ -902,7 +902,7 @@ in_losing(struct inpcb *inp) * allocated the next time output is attempted. */ void -in_rtchange(struct inpcb *inp, int errno) +inpcb_rtchange(struct inpcb *inp, int errno) { if (inp->inp_af != AF_INET) @@ -914,7 +914,7 @@ in_rtchange(struct inpcb *inp, int errno } struct inpcb * -in_pcblookup_port(struct inpcbtable *table, struct in_addr laddr, +inpcb_lookup_local(struct inpcbtable *table, struct in_addr laddr, u_int lport_arg, int lookup_wildcard, vestigial_inpcb_t *vp) { struct inpcbhead *head; @@ -1019,11 +1019,11 @@ in_pcblookup_port(struct inpcbtable *tab } #ifdef DIAGNOSTIC -int in_pcbnotifymiss = 0; +int inpcb_notifymiss = 0; #endif struct inpcb * -in_pcblookup_connect(struct inpcbtable *table, +inpcb_lookup(struct inpcbtable *table, struct in_addr faddr, u_int fport_arg, struct in_addr laddr, u_int lport_arg, vestigial_inpcb_t *vp) @@ -1053,8 +1053,8 @@ in_pcblookup_connect(struct inpcbtable * } #ifdef DIAGNOSTIC - if (in_pcbnotifymiss) { - printf("in_pcblookup_connect: faddr=%08x fport=%d laddr=%08x lport=%d\n", + if (inpcb_notifymiss) { + printf("inpcb_lookup: faddr=%08x fport=%d laddr=%08x lport=%d\n", ntohl(faddr.s_addr), ntohs(fport), ntohl(laddr.s_addr), ntohs(lport)); } @@ -1071,7 +1071,7 @@ out: } struct inpcb * -in_pcblookup_bind(struct inpcbtable *table, +inpcb_lookup_bound(struct inpcbtable *table, struct in_addr laddr, u_int lport_arg) { struct inpcbhead *head; @@ -1097,8 +1097,8 @@ in_pcblookup_bind(struct inpcbtable *tab goto out; } #ifdef DIAGNOSTIC - if (in_pcbnotifymiss) { - printf("in_pcblookup_bind: laddr=%08x lport=%d\n", + if (inpcb_notifymiss) { + printf("inpcb_lookup_bound: laddr=%08x lport=%d\n", ntohl(laddr.s_addr), ntohs(lport)); } #endif @@ -1114,7 +1114,7 @@ out: } void -in_pcbstate(struct inpcb *inp, int state) +inpcb_set_state(struct inpcb *inp, int state) { #ifdef INET6 @@ -1148,7 +1148,7 @@ in_pcbstate(struct inpcb *inp, int state } struct rtentry * -in_pcbrtentry(struct inpcb *inp) +inpcb_rtentry(struct inpcb *inp) { struct route *ro; union { @@ -1170,7 +1170,7 @@ in_pcbrtentry(struct inpcb *inp) } void -in_pcbrtentry_unref(struct rtentry *rt, struct inpcb *inp) +inpcb_rtentry_unref(struct rtentry *rt, struct inpcb *inp) { rtcache_unref(rt, &inp->inp_route); Index: src/sys/netinet/in_pcb.h diff -u src/sys/netinet/in_pcb.h:1.73 src/sys/netinet/in_pcb.h:1.74 --- src/sys/netinet/in_pcb.h:1.73 Fri Oct 28 05:25:36 2022 +++ src/sys/netinet/in_pcb.h Fri Nov 4 09:00:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: in_pcb.h,v 1.73 2022/10/28 05:25:36 ozaki-r Exp $ */ +/* $NetBSD: in_pcb.h,v 1.74 2022/11/04 09:00:58 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -250,39 +250,39 @@ struct sockaddr_in; struct socket; struct vestigial_inpcb; -void in_losing(struct inpcb *); -int in_pcballoc(struct socket *, void *); -int in_pcbbindableaddr(const struct inpcb *, struct sockaddr_in *, +void inpcb_losing(struct inpcb *); +int inpcb_create(struct socket *, void *); +int inpcb_bindableaddr(const struct inpcb *, struct sockaddr_in *, kauth_cred_t); -int in_pcbbind(void *, struct sockaddr_in *, struct lwp *); -int in_pcbconnect(void *, struct sockaddr_in *, struct lwp *); -void in_pcbdetach(void *); -void in_pcbdisconnect(void *); -void in_pcbinit(struct inpcbtable *, int, int); +int inpcb_bind(void *, struct sockaddr_in *, struct lwp *); +int inpcb_connect(void *, struct sockaddr_in *, struct lwp *); +void inpcb_destroy(void *); +void inpcb_disconnect(void *); +void inpcb_init(struct inpcbtable *, int, int); struct inpcb * - in_pcblookup_port(struct inpcbtable *, + inpcb_lookup_local(struct inpcbtable *, struct in_addr, u_int, int, struct vestigial_inpcb *); struct inpcb * - in_pcblookup_bind(struct inpcbtable *, + inpcb_lookup_bound(struct inpcbtable *, struct in_addr, u_int); struct inpcb * - in_pcblookup_connect(struct inpcbtable *, + inpcb_lookup(struct inpcbtable *, struct in_addr, u_int, struct in_addr, u_int, struct vestigial_inpcb *); -int in_pcbnotify(struct inpcbtable *, struct in_addr, u_int, +int inpcb_notify(struct inpcbtable *, struct in_addr, u_int, struct in_addr, u_int, int, void (*)(struct inpcb *, int)); -void in_pcbnotifyall(struct inpcbtable *, struct in_addr, int, +void inpcb_notifyall(struct inpcbtable *, struct in_addr, int, void (*)(struct inpcb *, int)); -void in_pcbpurgeif0(struct inpcbtable *, struct ifnet *); -void in_pcbpurgeif(struct inpcbtable *, struct ifnet *); +void inpcb_purgeif0(struct inpcbtable *, struct ifnet *); +void inpcb_purgeif(struct inpcbtable *, struct ifnet *); void in_purgeifmcast(struct ip_moptions *, struct ifnet *); -void in_pcbstate(struct inpcb *, int); -void in_rtchange(struct inpcb *, int); -void in_setpeeraddr(struct inpcb *, struct sockaddr_in *); -void in_setsockaddr(struct inpcb *, struct sockaddr_in *); +void inpcb_set_state(struct inpcb *, int); +void inpcb_rtchange(struct inpcb *, int); +void inpcb_fetch_peeraddr(struct inpcb *, struct sockaddr_in *); +void inpcb_fetch_sockaddr(struct inpcb *, struct sockaddr_in *); struct rtentry * - in_pcbrtentry(struct inpcb *); -void in_pcbrtentry_unref(struct rtentry *, struct inpcb *); + inpcb_rtentry(struct inpcb *); +void inpcb_rtentry_unref(struct rtentry *, struct inpcb *); void in6_pcbinit(struct inpcbtable *, int, int); int in6_pcbbind(void *, struct sockaddr_in6 *, struct lwp *); @@ -317,7 +317,7 @@ extern struct inpcb *in6_pcblookup_bind( const struct in6_addr *, u_int, int); static inline void -in_pcb_register_overudp_cb(struct inpcb *inp, pcb_overudp_cb_t cb, void *arg) +inpcb_register_overudp_cb(struct inpcb *inp, pcb_overudp_cb_t cb, void *arg) { inp->inp_overudp_cb = cb; Index: src/sys/netinet/ip_output.c diff -u src/sys/netinet/ip_output.c:1.322 src/sys/netinet/ip_output.c:1.323 --- src/sys/netinet/ip_output.c:1.322 Fri Oct 28 05:25:36 2022 +++ src/sys/netinet/ip_output.c Fri Nov 4 09:00:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_output.c,v 1.322 2022/10/28 05:25:36 ozaki-r Exp $ */ +/* $NetBSD: ip_output.c,v 1.323 2022/11/04 09:00:58 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.322 2022/10/28 05:25:36 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.323 2022/11/04 09:00:58 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1441,7 +1441,7 @@ ip_pktinfo_prepare(const struct inpcb *i if (!in_nullhost(pktinfo->ipi_addr)) { pktopts->ippo_laddr.sin_addr = pktinfo->ipi_addr; /* EADDRNOTAVAIL? */ - error = in_pcbbindableaddr(inp, &pktopts->ippo_laddr, cred); + error = inpcb_bindableaddr(inp, &pktopts->ippo_laddr, cred); if (error != 0) return error; addrset = true; Index: src/sys/netinet/portalgo.c diff -u src/sys/netinet/portalgo.c:1.13 src/sys/netinet/portalgo.c:1.14 --- src/sys/netinet/portalgo.c:1.13 Fri Oct 28 05:25:36 2022 +++ src/sys/netinet/portalgo.c Fri Nov 4 09:00:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: portalgo.c,v 1.13 2022/10/28 05:25:36 ozaki-r Exp $ */ +/* $NetBSD: portalgo.c,v 1.14 2022/11/04 09:00:58 ozaki-r Exp $ */ /* * Copyright 2011 Vlad Balan @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: portalgo.c,v 1.13 2022/10/28 05:25:36 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: portalgo.c,v 1.14 2022/11/04 09:00:58 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -261,10 +261,10 @@ check_suitable_port(uint16_t port, struc return false; sin.sin_addr = in4p_laddr(inp); - pcb = in_pcblookup_port(table, sin.sin_addr, htons(port), 1, + pcb = inpcb_lookup_local(table, sin.sin_addr, htons(port), 1, &vestigial); - DPRINTF("%s in_pcblookup_port returned %p and " + DPRINTF("%s inpcb_lookup_local returned %p and " "vestigial.valid %d\n", __func__, pcb, vestigial.valid); @@ -315,11 +315,11 @@ check_suitable_port(uint16_t port, struc #ifdef INET if (IN6_IS_ADDR_V4MAPPED(&sin6.sin6_addr)) { - t = in_pcblookup_port(table, + t = inpcb_lookup_local(table, *(struct in_addr *)&sin6.sin6_addr.s6_addr32[3], htons(port), wild, &vestigial); if (!t && vestigial.valid) { - DPRINTF("%s in_pcblookup_port returned " + DPRINTF("%s inpcb_lookup_local returned " "a result\n", __func__); return false; } Index: src/sys/netinet/raw_ip.c diff -u src/sys/netinet/raw_ip.c:1.183 src/sys/netinet/raw_ip.c:1.184 --- src/sys/netinet/raw_ip.c:1.183 Fri Oct 28 05:25:36 2022 +++ src/sys/netinet/raw_ip.c Fri Nov 4 09:00:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: raw_ip.c,v 1.183 2022/10/28 05:25:36 ozaki-r Exp $ */ +/* $NetBSD: raw_ip.c,v 1.184 2022/11/04 09:00:58 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -65,7 +65,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.183 2022/10/28 05:25:36 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.184 2022/11/04 09:00:58 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -132,7 +132,7 @@ rip_init(void) { sysctl_net_inet_raw_setup(NULL); - in_pcbinit(&rawcbtable, 1, 1); + inpcb_init(&rawcbtable, 1, 1); } static void @@ -262,7 +262,7 @@ void * rip_ctlinput(int cmd, const struct sockaddr *sa, void *v) { struct ip *ip = v; - void (*notify)(struct inpcb *, int) = in_rtchange; + void (*notify)(struct inpcb *, int) = inpcb_rtchange; int errno; if (sa->sa_family != AF_INET || @@ -272,7 +272,7 @@ rip_ctlinput(int cmd, const struct socka return NULL; errno = inetctlerrmap[cmd]; if (PRC_IS_REDIRECT(cmd)) - notify = in_rtchange, ip = 0; + notify = inpcb_rtchange, ip = 0; else if (cmd == PRC_HOSTDEAD) ip = 0; else if (errno == 0) @@ -283,7 +283,7 @@ rip_ctlinput(int cmd, const struct socka /* XXX mapped address case */ } else - in_pcbnotifyall(&rawcbtable, satocsin(sa)->sin_addr, errno, + inpcb_notifyall(&rawcbtable, satocsin(sa)->sin_addr, errno, notify); return NULL; } @@ -525,7 +525,7 @@ rip_attach(struct socket *so, int proto) } } - error = in_pcballoc(so, &rawcbtable); + error = inpcb_create(so, &rawcbtable); if (error) { return error; } @@ -551,7 +551,7 @@ rip_detach(struct socket *so) ip_mrouter_done(); } #endif - in_pcbdetach(inp); + inpcb_destroy(inp); } static int @@ -717,7 +717,7 @@ rip_peeraddr(struct socket *so, struct s KASSERT(nam != NULL); s = splsoftnet(); - in_setpeeraddr(sotoinpcb(so), (struct sockaddr_in *)nam); + inpcb_fetch_peeraddr(sotoinpcb(so), (struct sockaddr_in *)nam); splx(s); return 0; @@ -733,7 +733,7 @@ rip_sockaddr(struct socket *so, struct s KASSERT(nam != NULL); s = splsoftnet(); - in_setsockaddr(sotoinpcb(so), (struct sockaddr_in *)nam); + inpcb_fetch_sockaddr(sotoinpcb(so), (struct sockaddr_in *)nam); splx(s); return 0; @@ -819,7 +819,7 @@ rip_purgeif(struct socket *so, struct if s = splsoftnet(); mutex_enter(softnet_lock); - in_pcbpurgeif0(&rawcbtable, ifp); + inpcb_purgeif0(&rawcbtable, ifp); #ifdef NET_MPSAFE mutex_exit(softnet_lock); #endif @@ -827,7 +827,7 @@ rip_purgeif(struct socket *so, struct if #ifdef NET_MPSAFE mutex_enter(softnet_lock); #endif - in_pcbpurgeif(&rawcbtable, ifp); + inpcb_purgeif(&rawcbtable, ifp); mutex_exit(softnet_lock); splx(s); Index: src/sys/netinet/sctp_usrreq.c diff -u src/sys/netinet/sctp_usrreq.c:1.22 src/sys/netinet/sctp_usrreq.c:1.23 --- src/sys/netinet/sctp_usrreq.c:1.22 Sat Aug 6 18:26:42 2022 +++ src/sys/netinet/sctp_usrreq.c Fri Nov 4 09:00:58 2022 @@ -1,5 +1,5 @@ /* $KAME: sctp_usrreq.c,v 1.50 2005/06/16 20:45:29 jinmei Exp $ */ -/* $NetBSD: sctp_usrreq.c,v 1.22 2022/08/06 18:26:42 andvar Exp $ */ +/* $NetBSD: sctp_usrreq.c,v 1.23 2022/11/04 09:00:58 ozaki-r Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc. @@ -33,7 +33,7 @@ * SUCH DAMAGE. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sctp_usrreq.c,v 1.22 2022/08/06 18:26:42 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sctp_usrreq.c,v 1.23 2022/11/04 09:00:58 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -473,7 +473,7 @@ sctp_ctlinput(int cmd, const struct sock #if defined(__FreeBSD__) && __FreeBSD_version < 500000 /* XXX must be fixed for 5.x and higher, leave for 4.x */ if (PRC_IS_REDIRECT(cmd) && inp) { - in_rtchange((struct inpcb *)inp, + inpcb_rtchange((struct inpcb *)inp, inetctlerrmap[cmd]); } #endif Index: src/sys/netinet/tcp_input.c diff -u src/sys/netinet/tcp_input.c:1.436 src/sys/netinet/tcp_input.c:1.437 --- src/sys/netinet/tcp_input.c:1.436 Fri Oct 28 05:25:36 2022 +++ src/sys/netinet/tcp_input.c Fri Nov 4 09:00:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_input.c,v 1.436 2022/10/28 05:25:36 ozaki-r Exp $ */ +/* $NetBSD: tcp_input.c,v 1.437 2022/11/04 09:00:58 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -138,7 +138,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.436 2022/10/28 05:25:36 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.437 2022/11/04 09:00:58 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1367,11 +1367,11 @@ findpcb: inp = NULL; switch (af) { case AF_INET: - inp = in_pcblookup_connect(&tcbtable, ip->ip_src, th->th_sport, + inp = inpcb_lookup(&tcbtable, ip->ip_src, th->th_sport, ip->ip_dst, th->th_dport, &vestige); if (inp == NULL && !vestige.valid) { TCP_STATINC(TCP_STAT_PCBHASHMISS); - inp = in_pcblookup_bind(&tcbtable, ip->ip_dst, + inp = inpcb_lookup_bound(&tcbtable, ip->ip_dst, th->th_dport); } #ifdef INET6 Index: src/sys/netinet/tcp_output.c diff -u src/sys/netinet/tcp_output.c:1.216 src/sys/netinet/tcp_output.c:1.217 --- src/sys/netinet/tcp_output.c:1.216 Fri Oct 28 05:25:36 2022 +++ src/sys/netinet/tcp_output.c Fri Nov 4 09:00:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_output.c,v 1.216 2022/10/28 05:25:36 ozaki-r Exp $ */ +/* $NetBSD: tcp_output.c,v 1.217 2022/11/04 09:00:58 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -135,7 +135,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.216 2022/10/28 05:25:36 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.217 2022/11/04 09:00:58 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -251,7 +251,7 @@ tcp_segsize(struct tcpcb *tp, int *txseg goto out; } - rt = in_pcbrtentry(inp); + rt = inpcb_rtentry(inp); so = inp->inp_socket; if (rt == NULL) { goto out; @@ -298,7 +298,7 @@ tcp_segsize(struct tcpcb *tp, int *txseg } } #endif - in_pcbrtentry_unref(rt, inp); + inpcb_rtentry_unref(rt, inp); out: /* * Now we must make room for whatever extra TCP/IP options are in @@ -1066,11 +1066,11 @@ send: if (flags & TH_SYN) { struct rtentry *synrt; - synrt = in_pcbrtentry(tp->t_inpcb); + synrt = inpcb_rtentry(tp->t_inpcb); tp->snd_nxt = tp->iss; tp->t_ourmss = tcp_mss_to_advertise(synrt != NULL ? synrt->rt_ifp : NULL, af); - in_pcbrtentry_unref(synrt, tp->t_inpcb); + inpcb_rtentry_unref(synrt, tp->t_inpcb); if ((tp->t_flags & TF_NOOPT) == 0 && OPT_FITS(TCPOLEN_MAXSEG)) { *optp++ = TCPOPT_MAXSEG; *optp++ = TCPOLEN_MAXSEG; Index: src/sys/netinet/tcp_subr.c diff -u src/sys/netinet/tcp_subr.c:1.294 src/sys/netinet/tcp_subr.c:1.295 --- src/sys/netinet/tcp_subr.c:1.294 Mon Oct 31 00:56:33 2022 +++ src/sys/netinet/tcp_subr.c Fri Nov 4 09:00:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_subr.c,v 1.294 2022/10/31 00:56:33 ozaki-r Exp $ */ +/* $NetBSD: tcp_subr.c,v 1.295 2022/11/04 09:00:58 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.294 2022/10/31 00:56:33 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.295 2022/11/04 09:00:58 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -370,7 +370,7 @@ static int do_tcpinit(void) { - in_pcbinit(&tcbtable, tcbhashsize, tcbhashsize); + inpcb_init(&tcbtable, tcbhashsize, tcbhashsize); pool_init(&tcpcb_pool, sizeof(struct tcpcb), 0, 0, 0, "tcpcbpl", NULL, IPL_SOFTNET); @@ -1151,7 +1151,7 @@ tcp_close(struct tcpcb *tp) tp->t_flags |= TF_DEAD; inp->inp_ppcb = NULL; soisdisconnected(so); - in_pcbdetach(inp); + inpcb_destroy(inp); /* * pcb is no longer visble elsewhere, so we can safely release * the lock in callout_halt() if needed. @@ -1407,7 +1407,7 @@ tcp_ctlinput(int cmd, const struct socka */ return NULL; else if (PRC_IS_REDIRECT(cmd)) - notify = in_rtchange, ip = 0; + notify = inpcb_rtchange, ip = 0; else if (cmd == PRC_MSGSIZE && ip && ip->ip_v == 4) { /* * Check to see if we have a valid TCP connection @@ -1421,7 +1421,7 @@ tcp_ctlinput(int cmd, const struct socka in6_in_2_v4mapin6(&ip->ip_src, &src6); in6_in_2_v4mapin6(&ip->ip_dst, &dst6); #endif - if ((inp = in_pcblookup_connect(&tcbtable, ip->ip_dst, + if ((inp = inpcb_lookup(&tcbtable, ip->ip_dst, th->th_dport, ip->ip_src, th->th_sport, 0)) != NULL) ; #ifdef INET6 @@ -1486,7 +1486,7 @@ tcp_ctlinput(int cmd, const struct socka return NULL; if (ip && ip->ip_v == 4 && sa->sa_family == AF_INET) { th = (struct tcphdr *)((char *)ip + (ip->ip_hl << 2)); - nmatch = in_pcbnotify(&tcbtable, satocsin(sa)->sin_addr, + nmatch = inpcb_notify(&tcbtable, satocsin(sa)->sin_addr, th->th_dport, ip->ip_src, th->th_sport, errno, notify); if (nmatch == 0 && syn_cache_count && (inetctlerrmap[cmd] == EHOSTUNREACH || @@ -1503,7 +1503,7 @@ tcp_ctlinput(int cmd, const struct socka /* XXX mapped address case */ } else - in_pcbnotifyall(&tcbtable, satocsin(sa)->sin_addr, errno, + inpcb_notifyall(&tcbtable, satocsin(sa)->sin_addr, errno, notify); return NULL; } @@ -1534,7 +1534,7 @@ tcp_mtudisc_callback(struct in_addr fadd struct in6_addr in6; #endif - in_pcbnotifyall(&tcbtable, faddr, EMSGSIZE, tcp_mtudisc); + inpcb_notifyall(&tcbtable, faddr, EMSGSIZE, tcp_mtudisc); #ifdef INET6 in6_in_2_v4mapin6(&faddr, &in6); tcp6_mtudisc_callback(&in6); @@ -1555,15 +1555,15 @@ tcp_mtudisc(struct inpcb *inp, int errno if (tp == NULL) return; - rt = in_pcbrtentry(inp); + rt = inpcb_rtentry(inp); if (rt != NULL) { /* * If this was not a host route, remove and realloc. */ if ((rt->rt_flags & RTF_HOST) == 0) { - in_pcbrtentry_unref(rt, inp); - in_rtchange(inp, errno); - if ((rt = in_pcbrtentry(inp)) == NULL) + inpcb_rtentry_unref(rt, inp); + inpcb_rtchange(inp, errno); + if ((rt = inpcb_rtentry(inp)) == NULL) return; } @@ -1579,7 +1579,7 @@ tcp_mtudisc(struct inpcb *inp, int errno tp->snd_cwnd = TCP_INITIAL_WINDOW(tcp_init_win, rt->rt_rmx.rmx_mtu); - in_pcbrtentry_unref(rt, inp); + inpcb_rtentry_unref(rt, inp); } /* @@ -1754,7 +1754,7 @@ tcp_mss_from_peer(struct tcpcb *tp, int so = tp->t_inpcb->inp_socket; #if defined(RTV_SPIPE) || defined(RTV_SSTHRESH) - rt = in_pcbrtentry(tp->t_inpcb); + rt = inpcb_rtentry(tp->t_inpcb); #endif /* @@ -1815,7 +1815,7 @@ tcp_mss_from_peer(struct tcpcb *tp, int } #endif #if defined(RTV_SPIPE) || defined(RTV_SSTHRESH) - in_pcbrtentry_unref(rt, tp->t_inpcb); + inpcb_rtentry_unref(rt, tp->t_inpcb); #endif } @@ -1840,7 +1840,7 @@ tcp_established(struct tcpcb *tp) while (tp->t_inpcb->inp_af == AF_INET) { so = tp->t_inpcb->inp_socket; #if defined(RTV_RPIPE) - rt = in_pcbrtentry(tp->t_inpcb); + rt = inpcb_rtentry(tp->t_inpcb); #endif if (__predict_true(tcp_msl_enable)) { if (in4p_laddr(tp->t_inpcb).s_addr == INADDR_LOOPBACK) { @@ -1917,7 +1917,7 @@ tcp_established(struct tcpcb *tp) (void) sbreserve(&so->so_rcv, bufsize, so); } #ifdef RTV_RPIPE - in_pcbrtentry_unref(rt, tp->t_inpcb); + inpcb_rtentry_unref(rt, tp->t_inpcb); #endif } @@ -1935,7 +1935,7 @@ tcp_rmx_rtt(struct tcpcb *tp) KASSERT(tp->t_inpcb != NULL); - rt = in_pcbrtentry(tp->t_inpcb); + rt = inpcb_rtentry(tp->t_inpcb); if (rt == NULL) return; @@ -1963,7 +1963,7 @@ tcp_rmx_rtt(struct tcpcb *tp) ((tp->t_srtt >> 2) + tp->t_rttvar) >> (1 + 2), tp->t_rttmin, TCPTV_REXMTMAX); } - in_pcbrtentry_unref(rt, tp->t_inpcb); + inpcb_rtentry_unref(rt, tp->t_inpcb); #endif } Index: src/sys/netinet/tcp_syncache.c diff -u src/sys/netinet/tcp_syncache.c:1.4 src/sys/netinet/tcp_syncache.c:1.5 --- src/sys/netinet/tcp_syncache.c:1.4 Fri Oct 28 05:25:36 2022 +++ src/sys/netinet/tcp_syncache.c Fri Nov 4 09:00:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_syncache.c,v 1.4 2022/10/28 05:25:36 ozaki-r Exp $ */ +/* $NetBSD: tcp_syncache.c,v 1.5 2022/11/04 09:00:58 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -148,7 +148,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tcp_syncache.c,v 1.4 2022/10/28 05:25:36 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_syncache.c,v 1.5 2022/11/04 09:00:58 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -613,7 +613,7 @@ syn_cache_get(struct sockaddr *src, stru in4p_laddr(inp) = ((struct sockaddr_in *)dst)->sin_addr; inp->inp_lport = ((struct sockaddr_in *)dst)->sin_port; inp->inp_options = ip_srcroute(m); - in_pcbstate(inp, INP_BOUND); + inpcb_set_state(inp, INP_BOUND); if (inp->inp_options == NULL) { inp->inp_options = sc->sc_ipopts; sc->sc_ipopts = NULL; @@ -633,7 +633,7 @@ syn_cache_get(struct sockaddr *src, stru inp->inp_flags |= IN6P_IPV6_V6ONLY; else inp->inp_flags &= ~IN6P_IPV6_V6ONLY; - in_pcbstate(inp, INP_BOUND); + inpcb_set_state(inp, INP_BOUND); } #endif break; @@ -642,7 +642,7 @@ syn_cache_get(struct sockaddr *src, stru if (inp->inp_af == AF_INET6) { in6p_laddr(inp) = ((struct sockaddr_in6 *)dst)->sin6_addr; inp->inp_lport = ((struct sockaddr_in6 *)dst)->sin6_port; - in_pcbstate(inp, INP_BOUND); + inpcb_set_state(inp, INP_BOUND); } break; #endif @@ -671,7 +671,7 @@ syn_cache_get(struct sockaddr *src, stru if (inp->inp_af == AF_INET) { struct sockaddr_in sin; memcpy(&sin, src, src->sa_len); - if (in_pcbconnect(inp, &sin, &lwp0)) { + if (inpcb_connect(inp, &sin, &lwp0)) { goto resetandabort; } } Index: src/sys/netinet/tcp_timer.c diff -u src/sys/netinet/tcp_timer.c:1.98 src/sys/netinet/tcp_timer.c:1.99 --- src/sys/netinet/tcp_timer.c:1.98 Fri Oct 28 05:25:36 2022 +++ src/sys/netinet/tcp_timer.c Fri Nov 4 09:00:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_timer.c,v 1.98 2022/10/28 05:25:36 ozaki-r Exp $ */ +/* $NetBSD: tcp_timer.c,v 1.99 2022/11/04 09:00:58 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -93,7 +93,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tcp_timer.c,v 1.98 2022/10/28 05:25:36 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_timer.c,v 1.99 2022/11/04 09:00:58 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -337,7 +337,7 @@ tcp_timer_rexmt(void *arg) * Notify all connections to the same peer about * new mss and trigger retransmit. */ - in_pcbnotifyall(&tcbtable, icmpsrc.sin_addr, EMSGSIZE, + inpcb_notifyall(&tcbtable, icmpsrc.sin_addr, EMSGSIZE, tcp_mtudisc); KERNEL_UNLOCK_ONE(NULL); mutex_exit(softnet_lock); @@ -401,7 +401,7 @@ tcp_timer_rexmt(void *arg) * retransmit times until then. */ if (tp->t_rxtshift > TCP_MAXRXTSHIFT / 4) { - in_losing(tp->t_inpcb); + inpcb_losing(tp->t_inpcb); /* * This operation is not described in RFC2988. The * point is to keep srtt+4*rttvar constant, so we Index: src/sys/netinet/tcp_usrreq.c diff -u src/sys/netinet/tcp_usrreq.c:1.236 src/sys/netinet/tcp_usrreq.c:1.237 --- src/sys/netinet/tcp_usrreq.c:1.236 Sun Oct 30 08:45:46 2022 +++ src/sys/netinet/tcp_usrreq.c Fri Nov 4 09:00:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_usrreq.c,v 1.236 2022/10/30 08:45:46 ozaki-r Exp $ */ +/* $NetBSD: tcp_usrreq.c,v 1.237 2022/11/04 09:00:58 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -99,7 +99,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.236 2022/10/30 08:45:46 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.237 2022/11/04 09:00:58 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -473,7 +473,7 @@ tcp_attach(struct socket *so, int proto) so->so_rcv.sb_flags |= SB_AUTOSIZE; so->so_snd.sb_flags |= SB_AUTOSIZE; - error = in_pcballoc(so, &tcbtable); + error = inpcb_create(so, &tcbtable); if (error) goto out; inp = sotoinpcb(so); @@ -483,7 +483,7 @@ tcp_attach(struct socket *so, int proto) int nofd = so->so_state & SS_NOFDREF; /* XXX */ so->so_state &= ~SS_NOFDREF; /* don't free the socket yet */ - in_pcbdetach(inp); + inpcb_destroy(inp); so->so_state |= nofd; error = ENOBUFS; goto out; @@ -537,7 +537,7 @@ tcp_accept(struct socket *so, struct soc */ s = splsoftnet(); if (inp->inp_af == AF_INET) { - in_setpeeraddr(inp, (struct sockaddr_in *)nam); + inpcb_fetch_peeraddr(inp, (struct sockaddr_in *)nam); } #ifdef INET6 else if (inp->inp_af == AF_INET6) { @@ -576,7 +576,7 @@ tcp_bind(struct socket *so, struct socka s = splsoftnet(); switch (so->so_proto->pr_domain->dom_family) { case PF_INET: - error = in_pcbbind(inp, sin, l); + error = inpcb_bind(inp, sin, l); break; #ifdef INET6 case PF_INET6: @@ -618,7 +618,7 @@ tcp_listen(struct socket *so, struct lwp */ s = splsoftnet(); if (inp->inp_af == AF_INET && inp->inp_lport == 0) { - error = in_pcbbind(inp, NULL, l); + error = inpcb_bind(inp, NULL, l); if (error) goto release; } @@ -665,11 +665,11 @@ tcp_connect(struct socket *so, struct so if (inp->inp_af == AF_INET) { if (inp->inp_lport == 0) { - error = in_pcbbind(inp, NULL, l); + error = inpcb_bind(inp, NULL, l); if (error) goto release; } - error = in_pcbconnect(inp, (struct sockaddr_in *)nam, l); + error = inpcb_connect(inp, (struct sockaddr_in *)nam, l); } #ifdef INET6 if (inp->inp_af == AF_INET6) { @@ -693,7 +693,7 @@ tcp_connect(struct socket *so, struct so tp->t_template = tcp_template(tp); if (tp->t_template == 0) { if (inp->inp_af == AF_INET) - in_pcbdisconnect(inp); + inpcb_disconnect(inp); #ifdef INET6 else if (inp->inp_af == AF_INET6) in6_pcbdisconnect(inp); @@ -876,7 +876,7 @@ tcp_peeraddr(struct socket *so, struct s s = splsoftnet(); if (inp->inp_af == AF_INET) { - in_setpeeraddr(inp, (struct sockaddr_in *)nam); + inpcb_fetch_peeraddr(inp, (struct sockaddr_in *)nam); } #ifdef INET6 else if (inp->inp_af == AF_INET6) { @@ -906,7 +906,7 @@ tcp_sockaddr(struct socket *so, struct s s = splsoftnet(); if (inp->inp_af == AF_INET) { - in_setsockaddr(inp, (struct sockaddr_in *)nam); + inpcb_fetch_sockaddr(inp, (struct sockaddr_in *)nam); } #ifdef INET6 if (inp->inp_af == AF_INET6) { @@ -1100,7 +1100,7 @@ tcp_purgeif(struct socket *so, struct if mutex_enter(softnet_lock); switch (so->so_proto->pr_domain->dom_family) { case PF_INET: - in_pcbpurgeif0(&tcbtable, ifp); + inpcb_purgeif0(&tcbtable, ifp); #ifdef NET_MPSAFE mutex_exit(softnet_lock); #endif @@ -1108,7 +1108,7 @@ tcp_purgeif(struct socket *so, struct if #ifdef NET_MPSAFE mutex_enter(softnet_lock); #endif - in_pcbpurgeif(&tcbtable, ifp); + inpcb_purgeif(&tcbtable, ifp); break; #ifdef INET6 case PF_INET6: @@ -1419,7 +1419,7 @@ inet4_ident_core(struct in_addr raddr, u struct inpcb *inp; struct socket *sockp; - inp = in_pcblookup_connect(&tcbtable, raddr, rport, laddr, lport, 0); + inp = inpcb_lookup(&tcbtable, raddr, rport, laddr, lport, 0); if (inp == NULL || (sockp = inp->inp_socket) == NULL) return ESRCH; Index: src/sys/netinet/tcp_vtw.c diff -u src/sys/netinet/tcp_vtw.c:1.23 src/sys/netinet/tcp_vtw.c:1.24 --- src/sys/netinet/tcp_vtw.c:1.23 Fri Oct 28 05:25:36 2022 +++ src/sys/netinet/tcp_vtw.c Fri Nov 4 09:00:58 2022 @@ -121,7 +121,7 @@ #include <netinet/tcp_vtw.h> -__KERNEL_RCSID(0, "$NetBSD: tcp_vtw.c,v 1.23 2022/10/28 05:25:36 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_vtw.c,v 1.24 2022/11/04 09:00:58 ozaki-r Exp $"); #define db_trace(__a, __b) do { } while (/*CONSTCOND*/0) @@ -1567,7 +1567,7 @@ vtw_tick(void *arg) mutex_exit(softnet_lock); } -/* in_pcblookup_ports assist for handling vestigial entries. +/* inpcb_lookup_locals assist for handling vestigial entries. */ static void * tcp_init_ports_v4(struct in_addr addr, u_int port, int wild) @@ -1666,7 +1666,7 @@ tcp_lookup_v4(struct in_addr faddr, uint return vtw_export_v4(ctl, vtw, res); } -/* in_pcblookup_ports assist for handling vestigial entries. +/* inpcb_lookup_locals assist for handling vestigial entries. */ static void * tcp_init_ports_v6(const struct in6_addr *addr, u_int port, int wild) Index: src/sys/netinet/udp_usrreq.c diff -u src/sys/netinet/udp_usrreq.c:1.263 src/sys/netinet/udp_usrreq.c:1.264 --- src/sys/netinet/udp_usrreq.c:1.263 Fri Oct 28 05:25:36 2022 +++ src/sys/netinet/udp_usrreq.c Fri Nov 4 09:00:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: udp_usrreq.c,v 1.263 2022/10/28 05:25:36 ozaki-r Exp $ */ +/* $NetBSD: udp_usrreq.c,v 1.264 2022/11/04 09:00:58 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.263 2022/10/28 05:25:36 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.264 2022/11/04 09:00:58 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -186,7 +186,7 @@ static int do_udpinit(void) { - in_pcbinit(&udbtable, udbhashsize, udbhashsize); + inpcb_init(&udbtable, udbhashsize, udbhashsize); udpstat_percpu = percpu_alloc(sizeof(uint64_t) * UDP_NSTATS); MOWNER_ATTACH(&udp_tx_mowner); @@ -563,11 +563,11 @@ udp4_realinput(struct sockaddr_in *src, /* * Locate pcb for datagram. */ - inp = in_pcblookup_connect(&udbtable, *src4, *sport, *dst4, + inp = inpcb_lookup(&udbtable, *src4, *sport, *dst4, *dport, 0); if (inp == 0) { UDP_STATINC(UDP_STAT_PCBHASHMISS); - inp = in_pcblookup_bind(&udbtable, *dst4, *dport); + inp = inpcb_lookup_bound(&udbtable, *dst4, *dport); if (inp == 0) return rcvcnt; } @@ -664,7 +664,7 @@ udp_ctlinput(int cmd, const struct socka errno = inetctlerrmap[cmd]; if (PRC_IS_REDIRECT(cmd)) { - notify = in_rtchange; + notify = inpcb_rtchange; ip = NULL; } else if (cmd == PRC_HOSTDEAD) { ip = NULL; @@ -674,11 +674,11 @@ udp_ctlinput(int cmd, const struct socka if (ip) { uh = (struct udphdr *)((char *)ip + (ip->ip_hl << 2)); - in_pcbnotify(&udbtable, satocsin(sa)->sin_addr, uh->uh_dport, + inpcb_notify(&udbtable, satocsin(sa)->sin_addr, uh->uh_dport, ip->ip_src, uh->uh_sport, errno, notify); /* XXX mapped address case */ } else { - in_pcbnotifyall(&udbtable, satocsin(sa)->sin_addr, errno, + inpcb_notifyall(&udbtable, satocsin(sa)->sin_addr, errno, notify); } @@ -877,7 +877,7 @@ udp_attach(struct socket *so, int proto) } } - error = in_pcballoc(so, &udbtable); + error = inpcb_create(so, &udbtable); if (error) { return error; } @@ -896,7 +896,7 @@ udp_detach(struct socket *so) KASSERT(solocked(so)); inp = sotoinpcb(so); KASSERT(inp != NULL); - in_pcbdetach(inp); + inpcb_destroy(inp); } static int @@ -922,7 +922,7 @@ udp_bind(struct socket *so, struct socka KASSERT(nam != NULL); s = splsoftnet(); - error = in_pcbbind(inp, sin, l); + error = inpcb_bind(inp, sin, l); splx(s); return error; @@ -948,7 +948,7 @@ udp_connect(struct socket *so, struct so KASSERT(nam != NULL); s = splsoftnet(); - error = in_pcbconnect(inp, (struct sockaddr_in *)nam, l); + error = inpcb_connect(inp, (struct sockaddr_in *)nam, l); if (! error) soisconnected(so); splx(s); @@ -975,9 +975,9 @@ udp_disconnect(struct socket *so) s = splsoftnet(); /*soisdisconnected(so);*/ so->so_state &= ~SS_ISCONNECTED; /* XXX */ - in_pcbdisconnect(inp); + inpcb_disconnect(inp); in4p_laddr(inp) = zeroin_addr; /* XXX */ - in_pcbstate(inp, INP_BOUND); /* XXX */ + inpcb_set_state(inp, INP_BOUND); /* XXX */ splx(s); return 0; @@ -1032,7 +1032,7 @@ udp_peeraddr(struct socket *so, struct s KASSERT(nam != NULL); s = splsoftnet(); - in_setpeeraddr(sotoinpcb(so), (struct sockaddr_in *)nam); + inpcb_fetch_peeraddr(sotoinpcb(so), (struct sockaddr_in *)nam); splx(s); return 0; @@ -1048,7 +1048,7 @@ udp_sockaddr(struct socket *so, struct s KASSERT(nam != NULL); s = splsoftnet(); - in_setsockaddr(sotoinpcb(so), (struct sockaddr_in *)nam); + inpcb_fetch_sockaddr(sotoinpcb(so), (struct sockaddr_in *)nam); splx(s); return 0; @@ -1092,7 +1092,7 @@ udp_send(struct socket *so, struct mbuf error = EISCONN; goto die; } - error = in_pcbconnect(inp, (struct sockaddr_in *)nam, l); + error = inpcb_connect(inp, (struct sockaddr_in *)nam, l); if (error) goto die; } else { @@ -1105,9 +1105,9 @@ udp_send(struct socket *so, struct mbuf m = NULL; control = NULL; if (nam) { - in_pcbdisconnect(inp); + inpcb_disconnect(inp); in4p_laddr(inp) = laddr; /* XXX */ - in_pcbstate(inp, INP_BOUND); /* XXX */ + inpcb_set_state(inp, INP_BOUND); /* XXX */ } die: if (m != NULL) @@ -1137,7 +1137,7 @@ udp_purgeif(struct socket *so, struct if s = splsoftnet(); mutex_enter(softnet_lock); - in_pcbpurgeif0(&udbtable, ifp); + inpcb_purgeif0(&udbtable, ifp); #ifdef NET_MPSAFE mutex_exit(softnet_lock); #endif @@ -1145,7 +1145,7 @@ udp_purgeif(struct socket *so, struct if #ifdef NET_MPSAFE mutex_enter(softnet_lock); #endif - in_pcbpurgeif(&udbtable, ifp); + inpcb_purgeif(&udbtable, ifp); mutex_exit(softnet_lock); splx(s); Index: src/sys/netinet6/in6_pcb.c diff -u src/sys/netinet6/in6_pcb.c:1.173 src/sys/netinet6/in6_pcb.c:1.174 --- src/sys/netinet6/in6_pcb.c:1.173 Fri Oct 28 05:25:36 2022 +++ src/sys/netinet6/in6_pcb.c Fri Nov 4 09:00:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: in6_pcb.c,v 1.173 2022/10/28 05:25:36 ozaki-r Exp $ */ +/* $NetBSD: in6_pcb.c,v 1.174 2022/11/04 09:00:58 ozaki-r Exp $ */ /* $KAME: in6_pcb.c,v 1.84 2001/02/08 18:02:08 itojun Exp $ */ /* @@ -62,7 +62,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.173 2022/10/28 05:25:36 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.174 2022/11/04 09:00:58 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -133,7 +133,7 @@ void in6_pcbinit(struct inpcbtable *table, int bindhashsize, int connecthashsize) { - in_pcbinit(table, bindhashsize, connecthashsize); + inpcb_init(table, bindhashsize, connecthashsize); table->inpt_lastport = (u_int16_t)ip6_anonportmax; } @@ -276,7 +276,7 @@ in6_pcbbind_port(struct inpcb *inp, stru struct inpcb *t; struct vestigial_inpcb vestige; - t = in_pcblookup_port(table, + t = inpcb_lookup_local(table, *(struct in_addr *)&sin6->sin6_addr.s6_addr32[3], sin6->sin6_port, wild, &vestige); if (t && (reuseport & t->inp_socket->so_options) == 0) @@ -312,7 +312,7 @@ in6_pcbbind_port(struct inpcb *inp, stru return (e); } else { inp->inp_lport = sin6->sin6_port; - in_pcbstate(inp, INP_BOUND); + inpcb_set_state(inp, INP_BOUND); } LIST_REMOVE(inp, inp_lhash); @@ -535,7 +535,7 @@ in6_pcbconnect(void *v, struct sockaddr_ return error; } - in_pcbstate(inp, INP_CONNECTED); + inpcb_set_state(inp, INP_CONNECTED); in6p_flowinfo(inp) &= ~IPV6_FLOWLABEL_MASK; if (ip6_auto_flowlabel) in6p_flowinfo(inp) |= @@ -552,14 +552,14 @@ in6_pcbdisconnect(struct inpcb *inp) { memset((void *)&in6p_faddr(inp), 0, sizeof(in6p_faddr(inp))); inp->inp_fport = 0; - in_pcbstate(inp, INP_BOUND); + inpcb_set_state(inp, INP_BOUND); in6p_flowinfo(inp) &= ~IPV6_FLOWLABEL_MASK; #if defined(IPSEC) if (ipsec_enabled) ipsec_pcbdisconn(inp->inp_sp); #endif if (inp->inp_socket->so_state & SS_NOFDREF) - in_pcbdetach(inp); + inpcb_destroy(inp); } void Index: src/sys/netinet6/raw_ip6.c diff -u src/sys/netinet6/raw_ip6.c:1.180 src/sys/netinet6/raw_ip6.c:1.181 --- src/sys/netinet6/raw_ip6.c:1.180 Fri Oct 28 05:25:36 2022 +++ src/sys/netinet6/raw_ip6.c Fri Nov 4 09:00:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: raw_ip6.c,v 1.180 2022/10/28 05:25:36 ozaki-r Exp $ */ +/* $NetBSD: raw_ip6.c,v 1.181 2022/11/04 09:00:58 ozaki-r Exp $ */ /* $KAME: raw_ip6.c,v 1.82 2001/07/23 18:57:56 jinmei Exp $ */ /* @@ -62,7 +62,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.180 2022/10/28 05:25:36 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.181 2022/11/04 09:00:58 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_ipsec.h" @@ -598,7 +598,7 @@ rip6_attach(struct socket *so, int proto splx(s); return error; } - if ((error = in_pcballoc(so, &raw6cbtable)) != 0) { + if ((error = inpcb_create(so, &raw6cbtable)) != 0) { splx(s); return error; } @@ -629,7 +629,7 @@ rip6_detach(struct socket *so) kmem_free(in6p_icmp6filt(inp), sizeof(struct icmp6_filter)); in6p_icmp6filt(inp) = NULL; } - in_pcbdetach(inp); + inpcb_destroy(inp); } static int Index: src/sys/netinet6/udp6_usrreq.c diff -u src/sys/netinet6/udp6_usrreq.c:1.152 src/sys/netinet6/udp6_usrreq.c:1.153 --- src/sys/netinet6/udp6_usrreq.c:1.152 Fri Oct 28 05:25:36 2022 +++ src/sys/netinet6/udp6_usrreq.c Fri Nov 4 09:00:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: udp6_usrreq.c,v 1.152 2022/10/28 05:25:36 ozaki-r Exp $ */ +/* $NetBSD: udp6_usrreq.c,v 1.153 2022/11/04 09:00:58 ozaki-r Exp $ */ /* $KAME: udp6_usrreq.c,v 1.86 2001/05/27 17:33:00 itojun Exp $ */ /* $KAME: udp6_output.c,v 1.43 2001/10/15 09:19:52 itojun Exp $ */ @@ -63,7 +63,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: udp6_usrreq.c,v 1.152 2022/10/28 05:25:36 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: udp6_usrreq.c,v 1.153 2022/11/04 09:00:58 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -799,7 +799,7 @@ udp6_output(struct inpcb * const inp, st /* * Slightly different than v4 version in that we call * in6_selectsrc and in6_pcbsetport to fill in the local - * address and port rather than in_pcbconnect. in_pcbconnect + * address and port rather than inpcb_connect. inpcb_connect * sets inp_faddr which causes EISCONN below to be hit on * subsequent sendto. */ @@ -1077,7 +1077,7 @@ udp6_attach(struct socket *so, int proto * Always attach for IPv6, and only when necessary for IPv4. */ s = splsoftnet(); - error = in_pcballoc(so, &udbtable); + error = inpcb_create(so, &udbtable); splx(s); if (error) { return error; @@ -1100,7 +1100,7 @@ udp6_detach(struct socket *so) KASSERT(inp != NULL); s = splsoftnet(); - in_pcbdetach(inp); + inpcb_destroy(inp); splx(s); } @@ -1210,7 +1210,7 @@ udp6_abort(struct socket *so) s = splsoftnet(); soisdisconnected(so); - in_pcbdetach(sotoinpcb(so)); + inpcb_destroy(sotoinpcb(so)); splx(s); return 0; Index: src/sys/netipsec/ipsec.c diff -u src/sys/netipsec/ipsec.c:1.174 src/sys/netipsec/ipsec.c:1.175 --- src/sys/netipsec/ipsec.c:1.174 Fri Oct 28 05:18:39 2022 +++ src/sys/netipsec/ipsec.c Fri Nov 4 09:00:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ipsec.c,v 1.174 2022/10/28 05:18:39 ozaki-r Exp $ */ +/* $NetBSD: ipsec.c,v 1.175 2022/11/04 09:00:58 ozaki-r Exp $ */ /* $FreeBSD: ipsec.c,v 1.2.2.2 2003/07/01 01:38:13 sam Exp $ */ /* $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $ */ @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.174 2022/10/28 05:18:39 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.175 2022/11/04 09:00:58 ozaki-r Exp $"); /* * IPsec controller part. @@ -244,7 +244,7 @@ ipsec_checkpcbcache(struct mbuf *m, stru * to generate spidx again, nor check the address match again. * * For IPv4/v6 SOCK_STREAM sockets, this assumptions holds - * and there are calls to ipsec_pcbconn() from in_pcbconnect(). + * and there are calls to ipsec_pcbconn() from inpcb_connect(). */ }