diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-05-31 07:48:20 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-05-31 07:48:20 +0000 |
commit | b6e3aa3b1992b8869c6c3c5d66d5010a7ce83869 (patch) | |
tree | 20adddcd7100c69edafaf746a6a6567fb379e429 /sys/net/if_ethersubr.c | |
parent | 265a0b18662e733af86ed715c5a74ab12fbdeedb (diff) |
Ensure that a valid route entry is passed to ether_output() if L2
resolution is required.
This will allow us to enforce that no route entry is inserted in
the routing table after ether_output().
This is now possible because if_output() is no longer called with
a NULL route argument.
Tested by Hrvoje Popovski, ok visa@, bluhm@
Diffstat (limited to 'sys/net/if_ethersubr.c')
-rw-r--r-- | sys/net/if_ethersubr.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 542fa2b5dcc..ba1ffbd9d7c 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ethersubr.c,v 1.236 2016/05/18 20:15:14 mpi Exp $ */ +/* $OpenBSD: if_ethersubr.c,v 1.237 2016/05/31 07:48:19 mpi Exp $ */ /* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */ /* @@ -193,8 +193,12 @@ ether_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, struct mbuf *mcopy = NULL; struct ether_header *eh; struct arpcom *ac = (struct arpcom *)ifp; + sa_family_t af = dst->sa_family; int error = 0; + KASSERT(rt != NULL || ISSET(m->m_flags, M_MCAST|M_BCAST) || + af == AF_UNSPEC || af == pseudo_AF_HDRCMPLT); + #ifdef DIAGNOSTIC if (ifp->if_rdomain != rtable_l2(m->m_pkthdr.ph_rtableid)) { printf("%s: trying to send packet on wrong domain. " @@ -208,7 +212,7 @@ ether_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) senderr(ENETDOWN); - switch (dst->sa_family) { + switch (af) { case AF_INET: error = arpresolve(ifp, rt, m, dst, edst); if (error) |