git: f5195b1a63df - stable/14 - netinet6: Remove a set but not used global variable in6_maxmtu
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 07 Jul 2025 10:06:52 UTC
The branch stable/14 has been updated by zlei:
URL: https://cgit.FreeBSD.org/src/commit/?id=f5195b1a63df2c84d05b29a908e96c107f86a029
commit f5195b1a63df2c84d05b29a908e96c107f86a029
Author: Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2025-05-21 10:09:01 +0000
Commit: Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2025-07-07 10:00:29 +0000
netinet6: Remove a set but not used global variable in6_maxmtu
and its setter in6_setmaxmtu().
This variable was introduced by the KAME projec [1]. It holds the max
IPv6 MTU through all the interfaces, but is never used anywhere.
[1] 82cd038d51e2 KAME netinet6 basic part(no IPsec,no V6 Multicast
Forwarding, no UDP/TCP for IPv6 yet)
Reviewed by: glebius
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D49357
(cherry picked from commit e64fe5ad3a23a9f471ebf11e04e490588913c7af)
---
sys/netinet6/in6.c | 25 -------------------------
sys/netinet6/in6_ifattach.c | 6 ------
sys/netinet6/in6_var.h | 4 ----
sys/netinet6/nd6.c | 4 ----
sys/netinet6/nd6_rtr.c | 8 ++------
5 files changed, 2 insertions(+), 45 deletions(-)
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index 60497ae29852..0e2c19efe9d5 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -2114,31 +2114,6 @@ in6if_do_dad(struct ifnet *ifp)
return (1);
}
-/*
- * Calculate max IPv6 MTU through all the interfaces and store it
- * to in6_maxmtu.
- */
-void
-in6_setmaxmtu(void)
-{
- struct epoch_tracker et;
- unsigned long maxmtu = 0;
- struct ifnet *ifp;
-
- NET_EPOCH_ENTER(et);
- CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) {
- /* this function can be called during ifnet initialization */
- if (!ifp->if_afdata[AF_INET6])
- continue;
- if ((ifp->if_flags & IFF_LOOPBACK) == 0 &&
- IN6_LINKMTU(ifp) > maxmtu)
- maxmtu = IN6_LINKMTU(ifp);
- }
- NET_EPOCH_EXIT(et);
- if (maxmtu) /* update only when maxmtu is positive */
- V_in6_maxmtu = maxmtu;
-}
-
/*
* Provide the length of interface identifiers to be used for the link attached
* to the given interface. The length should be defined in "IPv6 over
diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c
index fe421c02513f..01d7925de43d 100644
--- a/sys/netinet6/in6_ifattach.c
+++ b/sys/netinet6/in6_ifattach.c
@@ -71,8 +71,6 @@
#include <netinet6/mld6_var.h>
#include <netinet6/scope6_var.h>
-VNET_DEFINE(unsigned long, in6_maxmtu) = 0;
-
#ifdef IP6_AUTO_LINKLOCAL
VNET_DEFINE(int, ip6_auto_linklocal) = IP6_AUTO_LINKLOCAL;
#else
@@ -732,10 +730,6 @@ in6_ifattach(struct ifnet *ifp, struct ifnet *altifp)
else
ifa_free(&ia->ia_ifa);
}
-
- /* update dynamically. */
- if (V_in6_maxmtu < ifp->if_mtu)
- V_in6_maxmtu = ifp->if_mtu;
}
/*
diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h
index 3d037bc644d8..e99e796a3140 100644
--- a/sys/netinet6/in6_var.h
+++ b/sys/netinet6/in6_var.h
@@ -551,9 +551,6 @@ do { \
((ifp)->if_afdata[AF_INET6]))->in6_ifstat[ \
offsetof(struct in6_ifstat, tag) / sizeof(uint64_t)], 1);\
} while (/*CONSTCOND*/ 0)
-
-VNET_DECLARE(unsigned long, in6_maxmtu);
-#define V_in6_maxmtu VNET(in6_maxmtu)
#endif /* _KERNEL */
/*
@@ -877,7 +874,6 @@ void in6_domifdetach(struct ifnet *, void *);
int in6_domifmtu(struct ifnet *);
struct rib_head *in6_inithead(uint32_t fibnum);
void in6_detachhead(struct rib_head *rh);
-void in6_setmaxmtu(void);
int in6_if2idlen(struct ifnet *);
struct in6_ifaddr *in6ifa_ifpforlinklocal(struct ifnet *, int);
struct in6_ifaddr *in6ifa_ifpwithaddr(struct ifnet *, const struct in6_addr *);
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index 887da1ebe21a..6ec5a8b54cf4 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -379,10 +379,6 @@ nd6_setmtu0(struct ifnet *ifp, struct nd_ifinfo *ndi)
"new link MTU on %s (%lu) is too small for IPv6\n",
if_name(ifp), (unsigned long)ndi->maxmtu);
}
-
- if (ndi->maxmtu > V_in6_maxmtu)
- in6_setmaxmtu(); /* check all interfaces just in case */
-
}
void
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c
index 845f9094f4c4..c145af7d3ffc 100644
--- a/sys/netinet6/nd6_rtr.c
+++ b/sys/netinet6/nd6_rtr.c
@@ -553,12 +553,8 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len)
maxmtu = (ndi->maxmtu && ndi->maxmtu < ifp->if_mtu)
? ndi->maxmtu : ifp->if_mtu;
if (mtu <= maxmtu) {
- int change = (ndi->linkmtu != mtu);
-
- ndi->linkmtu = mtu;
- if (change) {
- /* in6_maxmtu may change */
- in6_setmaxmtu();
+ if (ndi->linkmtu != mtu) {
+ ndi->linkmtu = mtu;
rt_updatemtu(ifp);
}
} else {