From 9e718c1edad1d11d195c363385d5e91c27c7199c Mon Sep 17 00:00:00 2001 From: Henning Brauer Date: Thu, 6 Nov 2014 14:28:48 +0000 Subject: fix mac address selection with unnumbered carpdevs IP-traffic over a carp interface with the underlaying carpdev being unnumbered (in the numbered case usually the ifp is the carpdev to begin with) went out with the carpdev's mac address istead of the carp interface's one due to a carp hack in ether_output exchanging the carp ifp for its carpdev ones one. move the source mac selection to before that. fixes unnumbered carp use in environments with strict mac address regimes like some exchange points. issue found by your's truly the hard way. ok mpi dlg --- sys/net/if_ethersubr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sys/net') diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index c596ee8f053..e2ccedd606c 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ethersubr.c,v 1.176 2014/11/01 21:40:38 mpi Exp $ */ +/* $OpenBSD: if_ethersubr.c,v 1.177 2014/11/06 14:28:47 henning Exp $ */ /* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */ /* @@ -270,6 +270,8 @@ ether_output(struct ifnet *ifp0, struct mbuf *m0, struct sockaddr *dst, senderr(EBUSY); #endif + esrc = ac->ac_enaddr; + #if NCARP > 0 if (ifp->if_type == IFT_CARP) { ifp = ifp->if_carpdev; @@ -310,7 +312,6 @@ ether_output(struct ifnet *ifp0, struct mbuf *m0, struct sockaddr *dst, time_second < rt->rt_rmx.rmx_expire) senderr(rt == rt0 ? EHOSTDOWN : EHOSTUNREACH); } - esrc = ac->ac_enaddr; switch (dst->sa_family) { #ifdef INET -- cgit v1.2.3