Skip to content

Commit fd131b4

Browse files
committed
net: remove dom_ifmtu
It is a remnant of a network stack design that was supposed to support multiple network protocols. Today it is clear that we are left with IPv4 and IPv6 only. Only IPv6 may have an MTU different to the interface MTU.
1 parent c7f05ef commit fd131b4

File tree

7 files changed

+21
-38
lines changed

7 files changed

+21
-38
lines changed

sys/net/if.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4467,19 +4467,6 @@ if_getmtu(const if_t ifp)
44674467
return (ifp->if_mtu);
44684468
}
44694469

4470-
int
4471-
if_getmtu_family(const if_t ifp, int family)
4472-
{
4473-
struct domain *dp;
4474-
4475-
SLIST_FOREACH(dp, &domains, dom_next) {
4476-
if (dp->dom_family == family && dp->dom_ifmtu != NULL)
4477-
return (dp->dom_ifmtu(ifp));
4478-
}
4479-
4480-
return (ifp->if_mtu);
4481-
}
4482-
44834470
void
44844471
if_setppromisc(if_t ifp, bool ppromisc)
44854472
{

sys/net/if_var.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,6 @@ const uint8_t *if_getbroadcastaddr(const if_t ifp);
620620
void if_setbroadcastaddr(if_t ifp, const uint8_t *);
621621
int if_setmtu(if_t ifp, int mtu);
622622
int if_getmtu(const if_t ifp);
623-
int if_getmtu_family(const if_t ifp, int family);
624623
void if_notifymtu(if_t ifp);
625624
void if_setppromisc(const if_t ifp, bool ppromisc);
626625
int if_setflagbits(if_t ifp, int set, int clear);

sys/net/route.c

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -508,26 +508,29 @@ rt_getifa_fib(struct rt_addrinfo *info, u_int fibnum)
508508
return (error);
509509
}
510510

511+
/*
512+
* Try to update rt_mtu for all routes using this interface. Unfortunately the
513+
* only way to do this is to traverse all routing tables in all fibs.
514+
*/
511515
void
512516
rt_updatemtu(struct ifnet *ifp)
513517
{
514518
struct rib_head *rnh;
515-
int mtu;
516-
int i, j;
519+
#ifdef INET6
520+
uint32_t in6mtu;
517521

518-
/*
519-
* Try to update rt_mtu for all routes using this interface
520-
* Unfortunately the only way to do this is to traverse all
521-
* routing tables in all fibs/domains.
522-
*/
523-
for (i = 1; i <= AF_MAX; i++) {
524-
mtu = if_getmtu_family(ifp, i);
525-
for (j = 0; j < rt_numfibs; j++) {
526-
rnh = rt_tables_get_rnh(j, i);
527-
if (rnh == NULL)
528-
continue;
529-
nhops_update_ifmtu(rnh, ifp, mtu);
530-
}
522+
in6mtu = in6_ifmtu(ifp);
523+
#endif
524+
525+
for (u_int j = 0; j < rt_numfibs; j++) {
526+
#ifdef INET
527+
rnh = rt_tables_get_rnh(j, AF_INET);
528+
nhops_update_ifmtu(rnh, ifp, ifp->if_mtu);
529+
#endif
530+
#ifdef INET6
531+
rnh = rt_tables_get_rnh(j, AF_INET6);
532+
nhops_update_ifmtu(rnh, ifp, in6mtu);
533+
#endif
531534
}
532535
}
533536

sys/netinet6/in6.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2612,12 +2612,9 @@ in6_domifattach(struct ifnet *ifp)
26122612
return ext;
26132613
}
26142614

2615-
int
2616-
in6_domifmtu(struct ifnet *ifp)
2615+
uint32_t
2616+
in6_ifmtu(struct ifnet *ifp)
26172617
{
2618-
if (ifp->if_afdata[AF_INET6] == NULL)
2619-
return ifp->if_mtu;
2620-
26212618
return (IN6_LINKMTU(ifp));
26222619
}
26232620

sys/netinet6/in6_proto.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ struct domain inet6domain = {
113113
#endif
114114
.dom_ifattach = in6_domifattach,
115115
.dom_ifdetach = in6_domifdetach,
116-
.dom_ifmtu = in6_domifmtu,
117116
.dom_nprotosw = 14,
118117
.dom_protosw = {
119118
&tcp6_protosw,

sys/netinet6/in6_var.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ int in6if_do_dad(struct ifnet *);
869869
void in6_savemkludge(struct in6_ifaddr *);
870870
void *in6_domifattach(struct ifnet *);
871871
void in6_domifdetach(struct ifnet *, void *);
872-
int in6_domifmtu(struct ifnet *);
872+
uint32_t in6_ifmtu(struct ifnet *);
873873
struct rib_head *in6_inithead(uint32_t fibnum);
874874
void in6_detachhead(struct rib_head *rh);
875875
int in6_if2idlen(struct ifnet *);

sys/sys/domain.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ struct domain {
5858
(struct rib_head *);
5959
void *(*dom_ifattach)(struct ifnet *);
6060
void (*dom_ifdetach)(struct ifnet *, void *);
61-
int (*dom_ifmtu)(struct ifnet *);
62-
/* af-dependent data on ifnet */
6361
struct protosw *dom_protosw[];
6462
};
6563

0 commit comments

Comments
 (0)