git: d9e7dd4a19b8 - main - carp: define CARP_AUTHLEN for carp_authlen field
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 17 Apr 2026 18:33:11 UTC
The branch main has been updated by glebius:
URL: https://cgit.FreeBSD.org/src/commit/?id=d9e7dd4a19b81a78a801973f8f5231f46a6d20b8
commit d9e7dd4a19b81a78a801973f8f5231f46a6d20b8
Author: Christos Longros <chris.longros@gmail.com>
AuthorDate: 2026-04-17 18:32:01 +0000
Commit: Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2026-04-17 18:32:01 +0000
carp: define CARP_AUTHLEN for carp_authlen field
Replace the bare 7 with a named constant.
---
sys/netinet/ip_carp.c | 2 +-
sys/netinet/ip_carp.h | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
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
@@ -80,6 +80,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