summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2018-02-15 01:03:18 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2018-02-15 01:03:18 +0000
commita848e5a411c3eb8cb3e1ba728860b2d902957ac9 (patch)
tree41ad10a8877d666e09ff36d4710e28246d73eaf3 /sys
parent7b08a7447d636a2aca1604e2f2da7c200f3b361c (diff)
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.
Diffstat (limited to 'sys')
-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);