git: cda57d955b25 - main - carp: assert that we are calling correct input function. We are.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 08 May 2024 11:19:56 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=cda57d955b250b538233117aad6443a907d6c109
commit cda57d955b250b538233117aad6443a907d6c109
Author: Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2024-04-29 22:54:57 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-05-08 11:19:04 +0000
carp: assert that we are calling correct input function. We are.
Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D45037
---
sys/netinet/ip_carp.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 332e76b492fa..de439df97c59 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -835,6 +835,7 @@ carp_input_c(struct mbuf *m, struct carp_header *ch, sa_family_t af, int ttl)
bool multicast = false;
NET_EPOCH_ASSERT();
+ MPASS(ch->carp_version == CARP_VERSION_CARP);
ifa = carp_find_ifa(m, af, ch->carp_vhid);
if (ifa == NULL) {
@@ -846,8 +847,7 @@ carp_input_c(struct mbuf *m, struct carp_header *ch, sa_family_t af, int ttl)
CARP_LOCK(sc);
/* verify the CARP version. */
- if (ch->carp_version != CARP_VERSION_CARP ||
- sc->sc_version != CARP_VERSION_CARP) {
+ if (sc->sc_version != CARP_VERSION_CARP) {
CARP_UNLOCK(sc);
CARPSTATS_INC(carps_badver);
@@ -956,6 +956,7 @@ vrrp_input_c(struct mbuf *m, int off, sa_family_t af, int ttl,
struct carp_softc *sc;
NET_EPOCH_ASSERT();
+ MPASS(vh->vrrp_version == CARP_VERSION_VRRPv3);
ifa = carp_find_ifa(m, af, vh->vrrp_vrtid);
if (ifa == NULL) {
@@ -969,7 +970,7 @@ vrrp_input_c(struct mbuf *m, int off, sa_family_t af, int ttl,
ifa_free(ifa);
/* verify the CARP version. */
- if (vh->vrrp_version != CARP_VERSION_VRRPv3 || sc->sc_version != CARP_VERSION_VRRPv3) {
+ if (sc->sc_version != CARP_VERSION_VRRPv3) {
CARP_UNLOCK(sc);
CARPSTATS_INC(carps_badver);