From 9be09a6e43a52bf0532c4cfa9ab8cdc057e32d22 Mon Sep 17 00:00:00 2001 From: Hiroki Sato Date: Thu, 24 Jul 2014 10:42:47 +0000 Subject: [PATCH] Fix EtherIP. TOS field must be initialized when the inner protocol is PF_LINK, and multicast/broadcast flag should always be dropped because the outer protocol uses unicast even when the inner address is not for unicast. It had been broken since r236951 when gif_output() started to use IFQ_HANDOFF(). --- sys/netinet/in_gif.c | 2 ++ sys/netinet6/in6_gif.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/sys/netinet/in_gif.c b/sys/netinet/in_gif.c index 6559454320c8..37a6efb411f2 100644 --- a/sys/netinet/in_gif.c +++ b/sys/netinet/in_gif.c @@ -170,6 +170,7 @@ in_gif_output(struct ifnet *ifp, int family, struct mbuf *m) return ENOBUFS; bcopy(&eiphdr, mtod(m, struct etherip_header *), sizeof(struct etherip_header)); + tos = 0; break; default: @@ -257,6 +258,7 @@ in_gif_output(struct ifnet *ifp, int family, struct mbuf *m) #endif } + m->m_flags &= ~(M_BCAST|M_MCAST); error = ip_output(m, NULL, &sc->gif_ro, 0, NULL, NULL); if (!(GIF2IFP(sc)->if_flags & IFF_LINK0) && diff --git a/sys/netinet6/in6_gif.c b/sys/netinet6/in6_gif.c index 53188f143a41..28fa823dced7 100644 --- a/sys/netinet6/in6_gif.c +++ b/sys/netinet6/in6_gif.c @@ -176,6 +176,7 @@ in6_gif_output(struct ifnet *ifp, return ENOBUFS; bcopy(&eiphdr, mtod(m, struct etherip_header *), sizeof(struct etherip_header)); + itos = 0; break; default: @@ -266,6 +267,7 @@ in6_gif_output(struct ifnet *ifp, #endif } + m->m_flags &= ~(M_BCAST|M_MCAST); #ifdef IPV6_MINMTU /* * force fragmentation to minimum MTU, to avoid path MTU discovery.