summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2018-02-15 01:03:17 +0000
committerdlg <dlg@openbsd.org>2018-02-15 01:03:17 +0000
commitee507291db3e6c60c4f470b69890acbf2bae00e4 (patch)
tree11e4e50b78f7eac107a66acb09241880c5d3b40f
parentIn asn1.h rev. 1.44 2018/02/14 16:46:04, jsing@ (diff)
downloadwireguard-openbsd-ee507291db3e6c60c4f470b69890acbf2bae00e4.tar.xz
wireguard-openbsd-ee507291db3e6c60c4f470b69890acbf2bae00e4.zip
take egre(4) packets out early in gre input
this lets us look up the gre(4) interface before looking at the protocols it might be carrying.
-rw-r--r--sys/net/if_gre.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c
index 88e6149ab40..7a73b732d34 100644
--- a/sys/net/if_gre.c
+++ b/sys/net/if_gre.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gre.c,v 1.100 2018/02/12 03:15:32 dlg Exp $ */
+/* $OpenBSD: if_gre.c,v 1.101 2018/02/15 01:03:17 dlg Exp $ */
/* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
/*
@@ -554,6 +554,15 @@ gre_input_key(struct mbuf **mp, int *offp, int type, int af,
key->t_rtableid = m->m_pkthdr.ph_rtableid;
+ if (gh->gre_proto == htons(ETHERTYPE_TRANSETHER)) {
+ if (egre_input(key, m, hlen) == -1)
+ goto decline;
+ }
+
+ sc = gre_find(key);
+ if (sc == NULL)
+ goto decline;
+
switch (gh->gre_proto) {
case htons(GRE_WCCP):
/* WCCP/GRE:
@@ -616,17 +625,10 @@ gre_input_key(struct mbuf **mp, int *offp, int type, int af,
input = gre_keepalive_recv;
break;
- case htons(ETHERTYPE_TRANSETHER):
- if (egre_input(key, m, hlen) == -1)
- goto decline;
default:
goto decline;
}
- sc = gre_find(key);
- if (sc == NULL)
- goto decline;
-
ifp = &sc->sc_if;
m_adj(m, hlen);