-/* $OpenBSD: if_ethersubr.c,v 1.166 2014/04/20 14:51:50 henning Exp $ */
+/* $OpenBSD: if_ethersubr.c,v 1.167 2014/04/20 14:54:39 henning Exp $ */
/* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */
/*
if (!hdrcmplt)
esrc = ac->ac_enaddr;
+#if NCARP > 0
+ if (ifp0 != ifp && ifp0->if_type == IFT_CARP)
+ esrc = carp_get_srclladdr(ifp0, esrc);
+#endif
/*
* Add local net header. If no space in first mbuf,
memcpy(eh->ether_dhost, edst, sizeof(eh->ether_dhost));
memcpy(eh->ether_shost, esrc, sizeof(eh->ether_shost));
-#if NCARP > 0
- if (ifp0 != ifp && ifp0->if_type == IFT_CARP)
- carp_rewrite_lladdr(ifp0, eh->ether_shost);
-#endif
-
#if NBRIDGE > 0
/*
* Interfaces that are bridgeports need special handling for output.
-/* $OpenBSD: ip_carp.c,v 1.226 2014/04/14 09:06:42 mpi Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.227 2014/04/20 14:54:39 henning Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
return (NULL);
}
-void
-carp_rewrite_lladdr(struct ifnet *ifp, u_int8_t *s_enaddr)
+u_char *
+carp_get_srclladdr(struct ifnet *ifp, u_char *esrc)
{
struct carp_softc *sc = ifp->if_softc;
if (sc->sc_balancing != CARP_BAL_IPSTEALTH &&
sc->sc_balancing != CARP_BAL_IP && sc->cur_vhe) {
if (sc->cur_vhe->vhe_leader)
- bcopy((caddr_t)sc->sc_ac.ac_enaddr,
- (caddr_t)s_enaddr, ETHER_ADDR_LEN);
+ return (sc->sc_ac.ac_enaddr);
else
- bcopy((caddr_t)sc->cur_vhe->vhe_enaddr,
- (caddr_t)s_enaddr, ETHER_ADDR_LEN);
+ return (sc->cur_vhe->vhe_enaddr);
}
+ return (esrc);
}
int
-/* $OpenBSD: ip_carp.h,v 1.30 2014/01/22 09:35:20 mpi Exp $ */
+/* $OpenBSD: ip_carp.h,v 1.31 2014/04/20 14:54:39 henning Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
struct rtentry *);
int carp_sysctl(int *, u_int, void *, size_t *, void *, size_t);
int carp_lsdrop(struct mbuf *, sa_family_t, u_int32_t *, u_int32_t *);
-void carp_rewrite_lladdr(struct ifnet *, u_int8_t *);
+u_char *carp_get_srclladdr(struct ifnet *, u_char *);
int carp_our_mcastaddr(struct ifnet *, u_int8_t *);
#endif /* _KERNEL */
#endif /* _NETINET_IP_CARP_H_ */