diff options
author | 2015-11-18 13:53:59 +0000 | |
---|---|---|
committer | 2015-11-18 13:53:59 +0000 | |
commit | 691223e92b4fac0eff8a06dd178ea77fa4f0e67a (patch) | |
tree | b928c64678d5c716f2ed4ee26cdd14b26c1729a4 /sys/netinet/ip_carp.c | |
parent | remove pledge_aftersyscall() prototype as the function was been removed. (diff) | |
download | wireguard-openbsd-691223e92b4fac0eff8a06dd178ea77fa4f0e67a.tar.xz wireguard-openbsd-691223e92b4fac0eff8a06dd178ea77fa4f0e67a.zip |
Make use of srp_enter()/srp_leave() in carp_iamatch() in preparation
for unlocking the ARP input path.
ok dlg@
Diffstat (limited to 'sys/netinet/ip_carp.c')
-rw-r--r-- | sys/netinet/ip_carp.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index 90ac78d5911..f8e7e66d7f6 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_carp.c,v 1.281 2015/11/12 05:46:45 dlg Exp $ */ +/* $OpenBSD: ip_carp.c,v 1.282 2015/11/18 13:53:59 mpi Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff. All rights reserved. @@ -1318,23 +1318,25 @@ carp_update_lsmask(struct carp_softc *sc) } int -carp_iamatch(struct ifnet *ifp, uint8_t **ether_shost) +carp_iamatch(struct ifnet *ifp, uint8_t *enaddr) { struct carp_softc *sc = ifp->if_softc; - struct carp_vhost_entry *vhe = SRPL_FIRST_LOCKED(&sc->carp_vhosts); - - KERNEL_ASSERT_LOCKED(); /* touching carp_vhosts */ + struct carp_vhost_entry *vhe; + struct srpl_iter i; + int match = 0; + vhe = SRPL_ENTER(&sc->carp_vhosts, &i); /* head */ if (vhe->state == MASTER) { if (sc->sc_balancing == CARP_BAL_IPSTEALTH || sc->sc_balancing == CARP_BAL_IP) { struct arpcom *ac = (struct arpcom *)sc->sc_carpdev; - *ether_shost = ac->ac_enaddr; + memcpy(enaddr, ac->ac_enaddr, ETHER_ADDR_LEN); } - return (1); + match = 1; } + SRPL_LEAVE(&i, vhe); - return (0); + return (match); } #ifdef INET6 |