Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Nov 2024 16:34:20 GMT
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: bf11fdaf0d09 - main - sctp: don't consider the interface name when removing an address
Message-ID:  <202411021634.4A2GYKGt097934@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=bf11fdaf0d095fecca61fa8b457d06e27fae5946

commit bf11fdaf0d095fecca61fa8b457d06e27fae5946
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2024-11-02 15:33:02 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2024-11-02 15:33:02 +0000

    sctp: don't consider the interface name when removing an address
    
    Checking the interface name can not be done consistently, so
    don't do it.
    
    MFC after:      3 days
---
 sys/netinet/sctp_bsd_addr.c |  3 +--
 sys/netinet/sctp_pcb.c      | 27 +++------------------------
 sys/netinet/sctp_pcb.h      |  2 +-
 3 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/sys/netinet/sctp_bsd_addr.c b/sys/netinet/sctp_bsd_addr.c
index a91b0dde5967..3c6952ab6f3c 100644
--- a/sys/netinet/sctp_bsd_addr.c
+++ b/sys/netinet/sctp_bsd_addr.c
@@ -338,8 +338,7 @@ sctp_addr_change(struct ifaddr *ifa, int cmd)
 		    (void *)ifa, ifa->ifa_addr, ifa_flags, 1);
 	} else {
 		sctp_del_addr_from_vrf(SCTP_DEFAULT_VRFID, ifa->ifa_addr,
-		    ifa->ifa_ifp->if_index,
-		    ifa->ifa_ifp->if_xname);
+		    ifa->ifa_ifp->if_index);
 
 		/*
 		 * We don't bump refcount here so when it completes the
diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c
index c37fe2eed88a..6d8757912f3e 100644
--- a/sys/netinet/sctp_pcb.c
+++ b/sys/netinet/sctp_pcb.c
@@ -662,8 +662,7 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint32_t ifn_index,
 			 */
 			SCTPDBG(SCTP_DEBUG_PCB4, "Lost an address change?\n");
 			/* Opps, must decrement the count */
-			sctp_del_addr_from_vrf(vrf_id, addr, ifn_index,
-			    if_name);
+			sctp_del_addr_from_vrf(vrf_id, addr, ifn_index);
 			return (NULL);
 		}
 		SCTP_INCR_LADDR_COUNT();
@@ -688,7 +687,7 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint32_t ifn_index,
 
 void
 sctp_del_addr_from_vrf(uint32_t vrf_id, struct sockaddr *addr,
-    uint32_t ifn_index, const char *if_name)
+    uint32_t ifn_index)
 {
 	struct sctp_vrf *vrf;
 	struct sctp_ifa *sctp_ifap;
@@ -709,27 +708,7 @@ sctp_del_addr_from_vrf(uint32_t vrf_id, struct sockaddr *addr,
 	if (sctp_ifap != NULL) {
 		/* Validate the delete */
 		if (sctp_ifap->ifn_p) {
-			bool valid = false;
-
-			/*-
-			 * The name has priority over the ifn_index
-			 * if its given.
-			 */
-			if (if_name) {
-				if (strncmp(if_name, sctp_ifap->ifn_p->ifn_name, SCTP_IFNAMSIZ) == 0) {
-					/* They match its a correct delete */
-					valid = true;
-				}
-			}
-			if (!valid) {
-				/* last ditch check ifn_index */
-				if (ifn_index == sctp_ifap->ifn_p->ifn_index) {
-					valid = true;
-				}
-			}
-			if (!valid) {
-				SCTPDBG(SCTP_DEBUG_PCB4, "ifn:%d ifname:%s does not match addresses\n",
-				    ifn_index, ((if_name == NULL) ? "NULL" : if_name));
+			if (ifn_index != sctp_ifap->ifn_p->ifn_index) {
 				SCTPDBG(SCTP_DEBUG_PCB4, "ifn:%d ifname:%s - ignoring delete\n",
 				    sctp_ifap->ifn_p->ifn_index, sctp_ifap->ifn_p->ifn_name);
 				SCTP_IPI_ADDR_WUNLOCK();
diff --git a/sys/netinet/sctp_pcb.h b/sys/netinet/sctp_pcb.h
index 86c244c71544..1249c2233c63 100644
--- a/sys/netinet/sctp_pcb.h
+++ b/sys/netinet/sctp_pcb.h
@@ -510,7 +510,7 @@ void sctp_free_ifa(struct sctp_ifa *sctp_ifap);
 
 void
 sctp_del_addr_from_vrf(uint32_t vrfid, struct sockaddr *addr,
-    uint32_t ifn_index, const char *if_name);
+    uint32_t ifn_index);
 
 struct sctp_nets *sctp_findnet(struct sctp_tcb *, struct sockaddr *);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202411021634.4A2GYKGt097934>