aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristos Longros <chris.longros@gmail.com>2026-04-17 18:32:01 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2026-04-17 18:32:01 +0000
commitd9e7dd4a19b81a78a801973f8f5231f46a6d20b8 (patch)
treeeb6487514c341d3717d91f07b081f21fd10445c5
parent9a4a9f623bbaf991b3ba580593d47f2ee9f7b03b (diff)
carp: define CARP_AUTHLEN for carp_authlen field
Replace the bare 7 with a named constant.
-rw-r--r--sys/netinet/ip_carp.c2
-rw-r--r--sys/netinet/ip_carp.h6
2 files changed, 7 insertions, 1 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 32823c6c4a87..9a97c1a19525 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1216,7 +1216,7 @@ carp_send_ad_locked(struct carp_softc *sc)
ch.carp_vhid = sc->sc_vhid;
ch.carp_advbase = sc->sc_advbase;
ch.carp_advskew = advskew;
- ch.carp_authlen = 7; /* XXX DEFINE */
+ ch.carp_authlen = CARP_AUTHLEN;
ch.carp_pad1 = 0; /* must be zero */
ch.carp_cksum = 0;
diff --git a/sys/netinet/ip_carp.h b/sys/netinet/ip_carp.h
index 8d82286feb7d..97040403b41e 100644
--- a/sys/netinet/ip_carp.h
+++ b/sys/netinet/ip_carp.h
@@ -81,6 +81,12 @@ struct carp_header {
CTASSERT(sizeof(struct carp_header) == 36);
/*
+ * CARP authentication length in 32-bit chunks:
+ * counter[2] (8 bytes) + SHA1 HMAC (20 bytes) = 28 bytes = 7 chunks.
+ */
+#define CARP_AUTHLEN 7
+
+/*
* The VRRPv3 header layout is as follows:
* See RFC9568, 5.1. VRRP Packet Format
*