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] 82cd038d51 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
This commit is contained in:
Zhenlei Huang
2025-05-21 18:09:01 +08:00
parent 59ee9260e6
commit e64fe5ad3a
5 changed files with 2 additions and 45 deletions
-25
View File
@@ -2112,31 +2112,6 @@ in6if_do_dad(struct ifnet *ifp)
return (1); 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 * 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 * to the given interface. The length should be defined in "IPv6 over
-6
View File
@@ -70,8 +70,6 @@
#include <netinet6/mld6_var.h> #include <netinet6/mld6_var.h>
#include <netinet6/scope6_var.h> #include <netinet6/scope6_var.h>
VNET_DEFINE(unsigned long, in6_maxmtu) = 0;
#ifdef IP6_AUTO_LINKLOCAL #ifdef IP6_AUTO_LINKLOCAL
VNET_DEFINE(int, ip6_auto_linklocal) = IP6_AUTO_LINKLOCAL; VNET_DEFINE(int, ip6_auto_linklocal) = IP6_AUTO_LINKLOCAL;
#else #else
@@ -731,10 +729,6 @@ in6_ifattach(struct ifnet *ifp, struct ifnet *altifp)
else else
ifa_free(&ia->ia_ifa); ifa_free(&ia->ia_ifa);
} }
/* update dynamically. */
if (V_in6_maxmtu < ifp->if_mtu)
V_in6_maxmtu = ifp->if_mtu;
} }
/* /*
-4
View File
@@ -549,9 +549,6 @@ do { \
((ifp)->if_afdata[AF_INET6]))->in6_ifstat[ \ ((ifp)->if_afdata[AF_INET6]))->in6_ifstat[ \
offsetof(struct in6_ifstat, tag) / sizeof(uint64_t)], 1);\ offsetof(struct in6_ifstat, tag) / sizeof(uint64_t)], 1);\
} while (/*CONSTCOND*/ 0) } while (/*CONSTCOND*/ 0)
VNET_DECLARE(unsigned long, in6_maxmtu);
#define V_in6_maxmtu VNET(in6_maxmtu)
#endif /* _KERNEL */ #endif /* _KERNEL */
/* /*
@@ -875,7 +872,6 @@ void in6_domifdetach(struct ifnet *, void *);
int in6_domifmtu(struct ifnet *); int in6_domifmtu(struct ifnet *);
struct rib_head *in6_inithead(uint32_t fibnum); struct rib_head *in6_inithead(uint32_t fibnum);
void in6_detachhead(struct rib_head *rh); void in6_detachhead(struct rib_head *rh);
void in6_setmaxmtu(void);
int in6_if2idlen(struct ifnet *); int in6_if2idlen(struct ifnet *);
struct in6_ifaddr *in6ifa_ifpforlinklocal(struct ifnet *, int); struct in6_ifaddr *in6ifa_ifpforlinklocal(struct ifnet *, int);
struct in6_ifaddr *in6ifa_ifpwithaddr(struct ifnet *, const struct in6_addr *); struct in6_ifaddr *in6ifa_ifpwithaddr(struct ifnet *, const struct in6_addr *);
-4
View File
@@ -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", "new link MTU on %s (%lu) is too small for IPv6\n",
if_name(ifp), (unsigned long)ndi->maxmtu); if_name(ifp), (unsigned long)ndi->maxmtu);
} }
if (ndi->maxmtu > V_in6_maxmtu)
in6_setmaxmtu(); /* check all interfaces just in case */
} }
void void
+2 -6
View File
@@ -553,12 +553,8 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len)
maxmtu = (ndi->maxmtu && ndi->maxmtu < ifp->if_mtu) maxmtu = (ndi->maxmtu && ndi->maxmtu < ifp->if_mtu)
? ndi->maxmtu : ifp->if_mtu; ? ndi->maxmtu : ifp->if_mtu;
if (mtu <= maxmtu) { if (mtu <= maxmtu) {
int change = (ndi->linkmtu != mtu); if (ndi->linkmtu != mtu) {
ndi->linkmtu = mtu;
ndi->linkmtu = mtu;
if (change) {
/* in6_maxmtu may change */
in6_setmaxmtu();
rt_updatemtu(ifp); rt_updatemtu(ifp);
} }
} else { } else {