summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2013-06-02 15:03:33 +0000
committerYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2013-06-02 15:03:33 +0000
commit1ae7441e6e580324a07f2b6a3b744b87c91fa328 (patch)
treeedc3c470a82a5e149ae5f0aad6d550cab30fd7f0
parent356f3fe53c47a54ef4822e4afd7f8732ee780000 (diff)
Exclude the mac address for the HMAC calculation if lladdr is the real
one so that we can use the real MAC address for carp(4) like an example following. ifconfig carp0 carpdev REALIF lladdr <real interface's lladdr> ok reyk mcbride
-rw-r--r--sys/netinet/ip_carp.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 084914f107d..56a6e467793 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.204 2013/03/28 23:10:05 tedu Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.205 2013/06/02 15:03:32 yasuoka Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -165,6 +165,7 @@ struct carp_softc {
u_int32_t sc_lsmask; /* load sharing mask */
int sc_lscount; /* # load sharing interfaces (max 32) */
int sc_delayed_arp; /* delayed ARP request countdown */
+ int sc_realmac; /* using real mac */
struct in_addr sc_peer;
@@ -304,8 +305,8 @@ carp_hmac_prepare_ctx(struct carp_vhost_entry *vhe, u_int8_t ctx)
}
/* the rest of the precomputation */
- if (vhe->vhe_leader && bcmp(sc->sc_ac.ac_enaddr, vhe->vhe_enaddr,
- ETHER_ADDR_LEN) != 0)
+ if (!sc->sc_realmac && vhe->vhe_leader &&
+ bcmp(sc->sc_ac.ac_enaddr, vhe->vhe_enaddr, ETHER_ADDR_LEN) != 0)
SHA1Update(&vhe->vhe_sha1[ctx], sc->sc_ac.ac_enaddr,
ETHER_ADDR_LEN);
@@ -1702,6 +1703,12 @@ carp_setrun(struct carp_vhost_entry *vhe, sa_family_t af)
return;
}
+ if (bcmp(((struct arpcom *)sc->sc_carpdev)->ac_enaddr,
+ sc->sc_ac.ac_enaddr, ETHER_ADDR_LEN) == 0)
+ sc->sc_realmac = 1;
+ else
+ sc->sc_realmac = 0;
+
if (sc->sc_if.if_flags & IFF_UP && vhe->vhid > 0 &&
(sc->sc_naddrs || sc->sc_naddrs6) && !sc->sc_suppress) {
sc->sc_if.if_flags |= IFF_RUNNING;