summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2021-04-23 21:55:37 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2021-04-23 21:55:37 +0000
commit1d8e982c5763929b1f13daa2a7f628f37ebce27d (patch)
tree949046e3e072b644c26b1f2c8dd92f17f12cefbe /sys
parent0db49b5c8eab9fc74f10307d18a6df919e4590fc (diff)
Setting variable arpinit_done is not MP save if we want to execute
arp_rtrequest() in parallel. Move initialization to arpinit() function. OK kettenis@ mvs@
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/if_ether.c28
-rw-r--r--sys/netinet/if_ether.h3
-rw-r--r--sys/netinet/ip_input.c3
3 files changed, 18 insertions, 16 deletions
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index 710f7d58492..79ea9e139df 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ether.c,v 1.244 2021/04/23 21:47:32 bluhm Exp $ */
+/* $OpenBSD: if_ether.c,v 1.245 2021/04/23 21:55:36 bluhm Exp $ */
/* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */
/*
@@ -96,7 +96,6 @@ struct niqueue arpinq = NIQUEUE_INITIALIZER(50, NETISR_ARP);
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
@@ -113,7 +112,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();
@@ -128,21 +127,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))
diff --git a/sys/netinet/if_ether.h b/sys/netinet/if_ether.h
index a3e5dc77eb3..56e6384f39b 100644
--- a/sys/netinet/if_ether.h
+++ b/sys/netinet/if_ether.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ether.h,v 1.81 2021/03/10 10:21:48 jsg Exp $ */
+/* $OpenBSD: if_ether.h,v 1.82 2021/04/23 21:55:36 bluhm Exp $ */
/* $NetBSD: if_ether.h,v 1.22 1996/05/11 13:00:00 mycroft Exp $ */
/*
@@ -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 *);
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 69d5646088b..7578303d544 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_input.c,v 1.357 2021/04/23 21:47:32 bluhm Exp $ */
+/* $OpenBSD: ip_input.c,v 1.358 2021/04/23 21:55:36 bluhm Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/*
@@ -223,6 +223,7 @@ ip_init(void)
mq_init(&ipsend_mq, 64, IPL_SOFTNET);
mq_init(&ipsendraw_mq, 64, IPL_SOFTNET);
+ arpinit();
#ifdef IPSEC
ipsec_init();
#endif