Hi,
Setting variable arpinit_done is not MP save if we want ot execute
arp_rtrequest() in parallel. Move initialization to arpinit()
function.
ok?
bluhm
Index: netinet/if_ether.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/if_ether.c,v
retrieving revision 1.243
diff -u -p -r1.243 if_ether.c
--- netinet/if_ether.c 24 Jun 2020 22:03:43 -0000 1.243
+++ netinet/if_ether.c 23 Apr 2021 21:14:18 -0000
@@ -95,7 +95,6 @@ struct niqueue arpinq = NIQUEUE_INITIALI
LIST_HEAD(, llinfo_arp) arp_list;
struct pool arp_pool; /* pool for llinfo_arp structures */
int arp_maxtries = 5;
-int arpinit_done;
int la_hold_total;
#ifdef NFSCLIENT
@@ -112,7 +111,7 @@ unsigned int revarp_ifidx;
void
arptimer(void *arg)
{
- struct timeout *to = (struct timeout *)arg;
+ struct timeout *to = arg;
struct llinfo_arp *la, *nla;
NET_LOCK();
@@ -127,21 +126,22 @@ arptimer(void *arg)
}
void
-arp_rtrequest(struct ifnet *ifp, int req, struct rtentry *rt)
+arpinit(void)
{
- struct sockaddr *gate = rt->rt_gateway;
- struct llinfo_arp *la = (struct llinfo_arp *)rt->rt_llinfo;
+ static struct timeout arptimer_to;
- if (!arpinit_done) {
- static struct timeout arptimer_to;
+ pool_init(&arp_pool, sizeof(struct llinfo_arp), 0,
+ IPL_SOFTNET, 0, "arp", NULL);
- arpinit_done = 1;
- pool_init(&arp_pool, sizeof(struct llinfo_arp), 0,
- IPL_SOFTNET, 0, "arp", NULL);
+ timeout_set_proc(&arptimer_to, arptimer, &arptimer_to);
+ timeout_add_sec(&arptimer_to, arpt_prune);
+}
- timeout_set_proc(&arptimer_to, arptimer, &arptimer_to);
- timeout_add_sec(&arptimer_to, arpt_prune);
- }
+void
+arp_rtrequest(struct ifnet *ifp, int req, struct rtentry *rt)
+{
+ struct sockaddr *gate = rt->rt_gateway;
+ struct llinfo_arp *la = (struct llinfo_arp *)rt->rt_llinfo;
if (ISSET(rt->rt_flags,
RTF_GATEWAY|RTF_BROADCAST|RTF_MULTICAST|RTF_MPLS))
Index: netinet/if_ether.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/if_ether.h,v
retrieving revision 1.81
diff -u -p -r1.81 if_ether.h
--- netinet/if_ether.h 10 Mar 2021 10:21:48 -0000 1.81
+++ netinet/if_ether.h 23 Apr 2021 20:44:34 -0000
@@ -257,6 +257,7 @@ void revarprequest(struct ifnet *);
int revarpwhoarewe(struct ifnet *, struct in_addr *, struct in_addr *);
int revarpwhoami(struct in_addr *, struct ifnet *);
+void arpinit(void);
void arpinput(struct ifnet *, struct mbuf *);
void arprequest(struct ifnet *, u_int32_t *, u_int32_t *, u_int8_t *);
void arpwhohas(struct arpcom *, struct in_addr *);
Index: netinet/ip_input.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/ip_input.c,v
retrieving revision 1.356
diff -u -p -r1.356 ip_input.c
--- netinet/ip_input.c 30 Mar 2021 08:37:10 -0000 1.356
+++ netinet/ip_input.c 23 Apr 2021 20:44:21 -0000
@@ -224,6 +224,7 @@ ip_init(void)
mq_init(&ipsend_mq, 64, IPL_SOFTNET);
mq_init(&ipsendraw_mq, 64, IPL_SOFTNET);
+ arpinit();
#ifdef IPSEC
ipsec_init();
#endif