git: e64fe5ad3a23 - main - netinet6: Remove a set but not used global variable in6_maxmtu
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 21 May 2025 10:12:38 UTC
The branch main has been updated by zlei:
URL: https://cgit.FreeBSD.org/src/commit/?id=e64fe5ad3a23a9f471ebf11e04e490588913c7af
commit e64fe5ad3a23a9f471ebf11e04e490588913c7af
Author: Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2025-05-21 10:09:01 +0000
Commit: Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2025-05-21 10:09:01 +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
---
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 62d00196e56b..ce0655408a28 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -2112,31 +2112,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 11e9cba81332..1b5a38ba412a 100644
--- a/sys/netinet6/in6_ifattach.c
+++ b/sys/netinet6/in6_ifattach.c
@@ -70,8 +70,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
@@ -731,10 +729,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 969625a58934..918a3abe426e 100644
--- a/sys/netinet6/in6_var.h
+++ b/sys/netinet6/in6_var.h
@@ -549,9 +549,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 */
/*
@@ -875,7 +872,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 {