From f42347c39a414cefb301ec1fe76872813fe029fb Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Thu, 7 Nov 2019 20:40:44 +0000 Subject: [PATCH] Remove unnecessary recursive epoch enter via INP_INFO_RLOCK macro in raw input functions for IPv4 and IPv6. They shall always run in the network epoch. --- sys/netinet/raw_ip.c | 5 ++--- sys/netinet6/raw_ip6.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 4217a4cd5e50..1dd7a9de3f56 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -284,9 +284,10 @@ rip_input(struct mbuf **mp, int *offp, int proto) struct ip *ip = mtod(m, struct ip *); struct inpcb *inp, *last; struct sockaddr_in ripsrc; - struct epoch_tracker et; int hash; + NET_EPOCH_ASSERT(); + *mp = NULL; bzero(&ripsrc, sizeof(ripsrc)); @@ -299,7 +300,6 @@ rip_input(struct mbuf **mp, int *offp, int proto) hash = INP_PCBHASH_RAW(proto, ip->ip_src.s_addr, ip->ip_dst.s_addr, V_ripcbinfo.ipi_hashmask); - INP_INFO_RLOCK_ET(&V_ripcbinfo, et); CK_LIST_FOREACH(inp, &V_ripcbinfo.ipi_hashbase[hash], inp_hash) { if (inp->inp_ip_p != proto) continue; @@ -422,7 +422,6 @@ rip_input(struct mbuf **mp, int *offp, int proto) skip_2: INP_RUNLOCK(inp); } - INP_INFO_RUNLOCK_ET(&V_ripcbinfo, et); if (last != NULL) { if (rip_append(last, ip, m, &ripsrc) != 0) IPSTAT_INC(ips_delivered); diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index a0d06230e852..1b952cc25360 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -165,7 +165,8 @@ rip6_input(struct mbuf **mp, int *offp, int proto) struct inpcb *last = NULL; struct mbuf *opts = NULL; struct sockaddr_in6 fromsa; - struct epoch_tracker et; + + NET_EPOCH_ASSERT(); RIP6STAT_INC(rip6s_ipackets); @@ -173,7 +174,6 @@ rip6_input(struct mbuf **mp, int *offp, int proto) ifp = m->m_pkthdr.rcvif; - INP_INFO_RLOCK_ET(&V_ripcbinfo, et); CK_LIST_FOREACH(inp, &V_ripcb, inp_list) { /* XXX inp locking */ if ((inp->inp_vflag & INP_IPV6) == 0) @@ -303,7 +303,6 @@ rip6_input(struct mbuf **mp, int *offp, int proto) skip_2: INP_RUNLOCK(inp); } - INP_INFO_RUNLOCK_ET(&V_ripcbinfo, et); #if defined(IPSEC) || defined(IPSEC_SUPPORT) /* * Check AH/ESP integrity.