diff options
| author | ozaki-r <ozaki-r@NetBSD.org> | 2022-11-04 09:00:58 +0000 |
|---|---|---|
| committer | ozaki-r <ozaki-r@NetBSD.org> | 2022-11-04 09:00:58 +0000 |
| commit | aea30c9acb30dd3f6423f7e6eb14bde99c08d566 (patch) | |
| tree | 07ee743ad919d004ebbfca873e8cf792ae2d68d6 /sys/netinet | |
| parent | 425c8e34537ba9e9b78906b995e532d0ffe9a397 (diff) | |
inpcb: rename functions to inpcb_*
Inspired by rmind-smpnet patches.
Diffstat (limited to 'sys/netinet')
| -rw-r--r-- | sys/netinet/dccp_usrreq.c | 50 | ||||
| -rw-r--r-- | sys/netinet/in_pcb.c | 98 | ||||
| -rw-r--r-- | sys/netinet/in_pcb.h | 46 | ||||
| -rw-r--r-- | sys/netinet/ip_output.c | 6 | ||||
| -rw-r--r-- | sys/netinet/portalgo.c | 12 | ||||
| -rw-r--r-- | sys/netinet/raw_ip.c | 24 | ||||
| -rw-r--r-- | sys/netinet/sctp_usrreq.c | 6 | ||||
| -rw-r--r-- | sys/netinet/tcp_input.c | 8 | ||||
| -rw-r--r-- | sys/netinet/tcp_output.c | 12 | ||||
| -rw-r--r-- | sys/netinet/tcp_subr.c | 40 | ||||
| -rw-r--r-- | sys/netinet/tcp_syncache.c | 12 | ||||
| -rw-r--r-- | sys/netinet/tcp_timer.c | 8 | ||||
| -rw-r--r-- | sys/netinet/tcp_usrreq.c | 30 | ||||
| -rw-r--r-- | sys/netinet/tcp_vtw.c | 6 | ||||
| -rw-r--r-- | sys/netinet/udp_usrreq.c | 42 |
15 files changed, 200 insertions, 200 deletions
diff --git a/sys/netinet/dccp_usrreq.c b/sys/netinet/dccp_usrreq.c index a1ba0583b32..3ed562dc984 100644 --- a/sys/netinet/dccp_usrreq.c +++ b/sys/netinet/dccp_usrreq.c @@ -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 proto) } 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 proto) 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 proto) } 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 sockaddr *sa, void *vip) 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 sockaddr *sa, void *vip) /*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 sockaddr *sa, void *vip) 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 sockaddr *nam, struct lwp *l) } 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 sockaddr *nam, } 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 sockaddr *nam, 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 lwp *td) 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 sockaddr *nam) } 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 sockaddr *nam) 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 sockaddr *nam) 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 ifnet *ifp) 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); diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index e6bf0806f47..106ff2ffd9e 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -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 bindhashsize, int connecthashsize) } 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, struct inpcb *inp, kauth_cred_t cred) *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 *inp, struct sockaddr_in *sin, 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 *inp, struct sockaddr_in *sin, } 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, struct sockaddr_in *sin, kauth_cred_t cred) } 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, struct sockaddr_in *sin, kauth_cred_t cred) /* 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, struct sockaddr_in *sin, kauth_cred_t cred) } } } - 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, struct sockaddr_in *sin, kauth_cred_t cred) 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, struct sockaddr_in *sin, kauth_cred_t cred) } 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 *sin, struct lwp *l) } /* 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 *sin, struct lwp *l) * 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_in *sin, struct lwp *l) 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_in *sin, struct lwp *l) 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_in *sin, struct lwp *l) } 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 sockaddr_in *sin) } 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 sockaddr_in *sin) * 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, struct in_addr faddr, u_int fport_arg, } 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, struct ifnet *ifp) } 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, struct ifnet *ifp) } 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, struct ifnet *ifp) 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, struct ifnet *ifp) * (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 *table, struct in_addr laddr, } #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 *table, } #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 *table, 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); diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index 3baa268fc38..02db3e659b2 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -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(struct inpcbtable *, 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; diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index f50e7698c44..0f879699296 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -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 *inp, const struct in_pktinfo *pktinfo, 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; diff --git a/sys/netinet/portalgo.c b/sys/netinet/portalgo.c index 7b5899d80bb..18f34df69f6 100644 --- a/sys/netinet/portalgo.c +++ b/sys/netinet/portalgo.c @@ -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, struct inpcb *inp, kauth_cred_t cred) 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, struct inpcb *inp, kauth_cred_t cred) #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; } diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 4030d657c98..1d597796b93 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -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 sockaddr *sa, void *v) 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 sockaddr *sa, void *v) /* 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 sockaddr *nam) 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 sockaddr *nam) 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 ifnet *ifp) 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 ifnet *ifp) #ifdef NET_MPSAFE mutex_enter(softnet_lock); #endif - in_pcbpurgeif(&rawcbtable, ifp); + inpcb_purgeif(&rawcbtable, ifp); mutex_exit(softnet_lock); splx(s); diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 79544555b16..39c5eef1e23 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -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 sockaddr *sa, void *vip) #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 diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 688ed4fdf6e..de67561067f 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -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 diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index be0e736bbd6..5d24f79e0fb 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -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 *txsegsizep, int *rxsegsizep, 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 *txsegsizep, int *rxsegsizep, } } #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; diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index cec2ab867b2..b579566a718 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -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 sockaddr *sa, void *v) */ 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 sockaddr *sa, void *v) 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 sockaddr *sa, void *v) 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 sockaddr *sa, void *v) /* 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 faddr) 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 offer) 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 offer) } #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 } diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index 06bc92ee09c..a7138496256 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -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, struct sockaddr *dst, 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, struct sockaddr *dst, 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, struct sockaddr *dst, 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, struct sockaddr *dst, 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; } } diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c index 9cd4320d341..1b53830acff 100644 --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -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 diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 1a9b4b3d113..e1c1211e0bc 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -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 sockaddr *nam) */ 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 sockaddr *nam, struct lwp *l) 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 *l) */ 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 sockaddr *nam, struct lwp *l) 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 sockaddr *nam, struct lwp *l) 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 sockaddr *nam) 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 sockaddr *nam) 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 ifnet *ifp) 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 ifnet *ifp) #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_int rport, 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; diff --git a/sys/netinet/tcp_vtw.c b/sys/netinet/tcp_vtw.c index c3093b8005e..321b65bea71 100644 --- a/sys/netinet/tcp_vtw.c +++ b/sys/netinet/tcp_vtw.c @@ -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, uint16_t fport, 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) diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index f781978db33..4023387e013 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -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, struct sockaddr_in *dst, /* * 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 sockaddr *sa, void *v) 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 sockaddr *sa, void *v) 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 sockaddr *nam, struct lwp *l) 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 sockaddr *nam, struct lwp *l) 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 sockaddr *nam) 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 sockaddr *nam) 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 *m, struct sockaddr *nam, 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, struct sockaddr *nam, 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 ifnet *ifp) 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 ifnet *ifp) #ifdef NET_MPSAFE mutex_enter(softnet_lock); #endif - in_pcbpurgeif(&udbtable, ifp); + inpcb_purgeif(&udbtable, ifp); mutex_exit(softnet_lock); splx(s); |
