From 0225e935fe36b21bc0b886b2dcdf42f23c8aaa5e Mon Sep 17 00:00:00 2001 From: dlg Date: Tue, 27 Feb 2018 06:46:00 +0000 Subject: [PATCH] use a macro for the default if_hdrlen, not a magic number suggested by mpi@ --- sys/net/if_gre.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c index 0f38d12583a..c61570c3f5e 100644 --- a/sys/net/if_gre.c +++ b/sys/net/if_gre.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_gre.c,v 1.116 2018/02/27 06:16:23 dlg Exp $ */ +/* $OpenBSD: if_gre.c,v 1.117 2018/02/27 06:46:00 dlg Exp $ */ /* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */ /* @@ -141,6 +141,8 @@ struct gre_h_wccp { #define GRE_WCCP 0x883e +#define GRE_HDRLEN (sizeof(struct ip) + sizeof(struct gre_header)) + /* * GRE tunnel metadata */ @@ -492,7 +494,7 @@ gre_clone_create(struct if_clone *ifc, int unit) ifp = &sc->sc_if; ifp->if_softc = sc; ifp->if_type = IFT_TUNNEL; - ifp->if_hdrlen = 24; /* IP + GRE */ + ifp->if_hdrlen = GRE_HDRLEN; ifp->if_mtu = GREMTU; ifp->if_flags = IFF_POINTOPOINT|IFF_MULTICAST; ifp->if_xflags = IFXF_CLONED; @@ -555,7 +557,7 @@ mgre_clone_create(struct if_clone *ifc, int unit) ifp->if_softc = sc; ifp->if_type = IFT_L3IPVLAN; - ifp->if_hdrlen = 24; /* IP + GRE */ + ifp->if_hdrlen = GRE_HDRLEN; ifp->if_mtu = GREMTU; ifp->if_flags = 0; /* it's not p2p, and can't mcast or bcast */ ifp->if_xflags = IFXF_CLONED; @@ -2735,7 +2737,7 @@ mgre_down(struct mgre_softc *sc) NET_ASSERT_LOCKED(); CLR(sc->sc_if.if_flags, IFF_RUNNING); - sc->sc_if.if_hdrlen = 24; /* symmetry */ + sc->sc_if.if_hdrlen = GRE_HDRLEN; /* symmetry */ RBT_REMOVE(mgre_tree, &mgre_tree, sc); -- 2.20.1