summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2018-02-19 00:34:33 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2018-02-19 00:34:33 +0000
commitfeb3f59a09c501571bc84d0856d06f590aa14415 (patch)
tree1d85e8a444ac670fc4ef05692b3d4d07bb9a397b /sys/net
parent252aba2b9333b03f7b5c13c32af2d82020797ffb (diff)
enable configuration of tunnel fragmentation.
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_gif.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c
index 0e24712a96f..3d8e5e6a7e5 100644
--- a/sys/net/if_gif.c
+++ b/sys/net/if_gif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gif.c,v 1.110 2018/02/12 03:30:24 dlg Exp $ */
+/* $OpenBSD: if_gif.c,v 1.111 2018/02/19 00:34:32 dlg Exp $ */
/* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */
/*
@@ -104,6 +104,7 @@ static inline int gif_cmp(const struct gif_tunnel *,
struct gif_softc {
struct gif_tunnel sc_tunnel; /* must be first */
struct ifnet sc_if;
+ uint16_t sc_df;
int sc_ttl;
};
@@ -150,6 +151,7 @@ gif_clone_create(struct if_clone *ifc, int unit)
sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO);
ifp = &sc->sc_if;
+ sc->sc_df = htons(0);
sc->sc_ttl = ip_defttl;
snprintf(ifp->if_xname, sizeof(ifp->if_xname),
@@ -304,7 +306,7 @@ gif_send(struct gif_softc *sc, struct mbuf *m,
return (-1);
ip = mtod(m, struct ip *);
- ip->ip_off = 0; /* DF ? */
+ ip->ip_off = sc->sc_df;
ip->ip_tos = otos;
ip->ip_len = htons(m->m_pkthdr.len);
ip->ip_ttl = ttl;
@@ -341,6 +343,9 @@ gif_send(struct gif_softc *sc, struct mbuf *m,
ip6->ip6_src = sc->sc_tunnel.t_src6;
ip6->ip6_dst = sc->sc_tunnel.t_dst6;
+ if (sc->sc_df)
+ SET(m->m_pkthdr.csum_flags, M_IPV6_DF_OUT);
+
ip6_send(m);
break;
}
@@ -507,6 +512,14 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
ifr->ifr_ttl = sc->sc_ttl;
break;
+ case SIOCSLIFPHYDF:
+ /* commit */
+ sc->sc_df = ifr->ifr_df ? htons(IP_DF) : htons(0);
+ break;
+ case SIOCGLIFPHYDF:
+ ifr->ifr_df = sc->sc_df ? 1 : 0;
+ break;
+
default:
error = ENOTTY;
break;