summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if.h4
-rw-r--r--sys/net/if_gre.c16
2 files changed, 13 insertions, 7 deletions
diff --git a/sys/net/if.h b/sys/net/if.h
index 4f2e9f7bd7a..0d28a126605 100644
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.h,v 1.195 2018/09/12 09:20:34 krw Exp $ */
+/* $OpenBSD: if.h,v 1.196 2018/11/11 05:55:10 dlg Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
@@ -129,6 +129,8 @@ struct if_data {
#define IFQ_MINPRIO 0
#define IFQ_MAXPRIO IFQ_NQUEUES - 1
#define IFQ_DEFPRIO 3
+#define IFQ_PRIO2TOS(_p) ((_p) << 5)
+#define IFQ_TOS2PRIO(_t) ((_t) >> 5)
/*
* Values for if_link_state.
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c
index 30e63eab8e7..0fa59041cbf 100644
--- a/sys/net/if_gre.c
+++ b/sys/net/if_gre.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gre.c,v 1.131 2018/10/25 01:05:19 dlg Exp $ */
+/* $OpenBSD: if_gre.c,v 1.132 2018/11/11 05:55:10 dlg Exp $ */
/* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
/*
@@ -589,6 +589,8 @@ gre_clone_create(struct if_clone *ifc, int unit)
bpfattach(&ifp->if_bpf, ifp, DLT_LOOP, sizeof(uint32_t));
#endif
+ ifp->if_llprio = IFQ_TOS2PRIO(IPTOS_PREC_INTERNETCONTROL);
+
NET_LOCK();
TAILQ_INSERT_TAIL(&gre_list, sc, sc_entry);
NET_UNLOCK();
@@ -2817,6 +2819,7 @@ gre_keepalive_send(void *arg)
int linkhdr, len;
uint16_t proto;
uint8_t ttl;
+ uint8_t tos;
/*
* re-schedule immediately, so we deal with incomplete configuation
@@ -2869,6 +2872,7 @@ gre_keepalive_send(void *arg)
SipHash24_Final(gk->gk_digest, &ctx);
ttl = sc->sc_tunnel.t_ttl == -1 ? ip_defttl : sc->sc_tunnel.t_ttl;
+ tos = IFQ_PRIO2TOS(sc->sc_if.if_llprio);
t.t_af = sc->sc_tunnel.t_af;
t.t_df = sc->sc_tunnel.t_df;
@@ -2877,7 +2881,7 @@ gre_keepalive_send(void *arg)
t.t_key = sc->sc_tunnel.t_key;
t.t_key_mask = sc->sc_tunnel.t_key_mask;
- m = gre_encap(&t, m, htons(0), ttl, IPTOS_PREC_INTERNETCONTROL);
+ m = gre_encap(&t, m, htons(0), ttl, tos);
if (m == NULL)
return;
@@ -2906,8 +2910,7 @@ gre_keepalive_send(void *arg)
/*
* put it in the tunnel
*/
- m = gre_encap(&sc->sc_tunnel, m, proto, ttl,
- IPTOS_PREC_INTERNETCONTROL);
+ m = gre_encap(&sc->sc_tunnel, m, proto, ttl, tos);
if (m == NULL)
return;
@@ -3751,10 +3754,11 @@ static void
eoip_keepalive_send(void *arg)
{
struct eoip_softc *sc = arg;
+ struct ifnet *ifp = &sc->sc_ac.ac_if;
struct mbuf *m;
int linkhdr;
- if (!ISSET(sc->sc_ac.ac_if.if_flags, IFF_RUNNING))
+ if (!ISSET(ifp->if_flags, IFF_RUNNING))
return;
/* this is really conservative */
@@ -3780,7 +3784,7 @@ eoip_keepalive_send(void *arg)
m->m_pkthdr.len = m->m_len = linkhdr;
m_adj(m, linkhdr);
- m = eoip_encap(sc, m, IPTOS_PREC_INTERNETCONTROL);
+ m = eoip_encap(sc, m, IFQ_PRIO2TOS(ifp->if_llprio));
if (m == NULL)
return;