summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2015-09-13 10:42:32 +0000
committerdlg <dlg@openbsd.org>2015-09-13 10:42:32 +0000
commit33c2bc4373d6c0568da5de23ba0958438ce92474 (patch)
treefc6abeea50df6d61ef5d1e42ef1e18915dfa285c /sys
parentreplace hand rolled refcounts and sleep_setup/finish with refcnts and (diff)
downloadwireguard-openbsd-33c2bc4373d6c0568da5de23ba0958438ce92474.tar.xz
wireguard-openbsd-33c2bc4373d6c0568da5de23ba0958438ce92474.zip
queue revarps to softnet so we can defer processing to a context with
the kernel lock. "do it" claudio@ mpi@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if_ethersubr.c13
-rw-r--r--sys/netinet/if_ether.c8
-rw-r--r--sys/netinet/if_ether.h5
3 files changed, 15 insertions, 11 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index fc592a3207c..4fbbc548d2e 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ethersubr.c,v 1.224 2015/09/12 13:34:12 mpi Exp $ */
+/* $OpenBSD: if_ethersubr.c,v 1.225 2015/09/13 10:42:32 dlg Exp $ */
/* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */
/*
@@ -296,6 +296,7 @@ ether_input(struct ifnet *ifp, struct mbuf *m, void *cookie)
struct ether_header *eh_tmp;
#endif
+ ac = (struct arpcom *)ifp;
eh = mtod(m, struct ether_header *);
m_adj(m, ETHER_HDR_LEN);
@@ -305,7 +306,7 @@ ether_input(struct ifnet *ifp, struct mbuf *m, void *cookie)
* if it came from us.
*/
if ((ifp->if_flags & IFF_SIMPLEX) == 0) {
- if (memcmp(LLADDR(ifp->if_sadl), eh->ether_shost,
+ if (memcmp(ac->ac_enaddr, eh->ether_shost,
ETHER_ADDR_LEN) == 0) {
m_freem(m);
return (1);
@@ -320,10 +321,6 @@ ether_input(struct ifnet *ifp, struct mbuf *m, void *cookie)
ifp->if_imcasts++;
}
- etype = ntohs(eh->ether_type);
-
- ac = (struct arpcom *)ifp;
-
/*
* If packet has been filtered by the bpf listener, drop it now
* also HW vlan tagged packets that were not collected by vlan(4)
@@ -346,6 +343,8 @@ ether_input(struct ifnet *ifp, struct mbuf *m, void *cookie)
}
}
+ etype = ntohs(eh->ether_type);
+
decapsulate:
switch (etype) {
case ETHERTYPE_IP:
@@ -361,7 +360,7 @@ decapsulate:
case ETHERTYPE_REVARP:
if (ifp->if_flags & IFF_NOARP)
goto dropanyway;
- revarpinput(m); /* XXX queue? */
+ inq = &rarpintrq;
return (1);
#ifdef INET6
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index 5ef7b373cf9..d21b99ba151 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ether.c,v 1.166 2015/09/12 20:26:07 mpi Exp $ */
+/* $OpenBSD: if_ether.c,v 1.167 2015/09/13 10:42:32 dlg Exp $ */
/* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */
/*
@@ -95,11 +95,14 @@ void arptfree(struct llinfo_arp *);
void arptimer(void *);
struct rtentry *arplookup(u_int32_t, int, int, u_int);
void in_arpinput(struct mbuf *);
+void revarpinput(struct mbuf *);
+void in_revarpinput(struct mbuf *);
LIST_HEAD(, llinfo_arp) llinfo_arp;
struct pool arp_pool; /* pool for llinfo_arp structures */
/* XXX hate magic numbers */
struct niqueue arpintrq = NIQUEUE_INITIALIZER(50, NETISR_ARP);
+struct niqueue rarpintrq = NIQUEUE_INITIALIZER(50, NETISR_ARP);
int arp_inuse, arp_allocated;
int arp_maxtries = 5;
int arpinit_done;
@@ -498,6 +501,9 @@ arpintr(void)
}
m_freem(m);
}
+
+ while ((m = niq_dequeue(&rarpintrq)) != NULL)
+ revarpinput(m);
}
/*
diff --git a/sys/netinet/if_ether.h b/sys/netinet/if_ether.h
index f32d977e9ff..136e5d0fc5c 100644
--- a/sys/netinet/if_ether.h
+++ b/sys/netinet/if_ether.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ether.h,v 1.58 2015/09/10 07:43:18 mpi Exp $ */
+/* $OpenBSD: if_ether.h,v 1.59 2015/09/13 10:42:32 dlg Exp $ */
/* $NetBSD: if_ether.h,v 1.22 1996/05/11 13:00:00 mycroft Exp $ */
/*
@@ -189,6 +189,7 @@ extern u_int8_t etherbroadcastaddr[ETHER_ADDR_LEN];
extern u_int8_t ether_ipmulticast_min[ETHER_ADDR_LEN];
extern u_int8_t ether_ipmulticast_max[ETHER_ADDR_LEN];
extern struct niqueue arpintrq;
+extern struct niqueue rarpintrq;
void arpwhohas(struct arpcom *, struct in_addr *);
void arpintr(void);
@@ -273,8 +274,6 @@ extern struct ifnet *revarp_ifp;
void arprequest(struct ifnet *, u_int32_t *, u_int32_t *, u_int8_t *);
int arpproxy(struct in_addr, unsigned int);
-void revarpinput(struct mbuf *);
-void in_revarpinput(struct mbuf *);
void revarprequest(struct ifnet *);
int revarpwhoarewe(struct ifnet *, struct in_addr *, struct in_addr *);
int revarpwhoami(struct in_addr *, struct ifnet *);