From: dlg Date: Thu, 15 Feb 2018 01:03:17 +0000 (+0000) Subject: take egre(4) packets out early in gre input X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ee507291db3e6c60c4f470b69890acbf2bae00e4;p=openbsd 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. --- 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);