svn commit: r357555 - stable/12/sys/net
Alexander Motin
mav at FreeBSD.org
Wed Feb 5 00:47:04 UTC 2020
Author: mav
Date: Wed Feb 5 00:47:03 2020
New Revision: 357555
URL: https://svnweb.freebsd.org/changeset/base/357555
Log:
MFC r356993: Update route MTUs for bridge, lagg and vlan interfaces.
Those interfaces may implicitly change their MTU on addition of parent
interface in addition to normal SIOCSIFMTU ioctl path, where the route
MTUs are updated normally.
Modified:
stable/12/sys/net/if_bridge.c
stable/12/sys/net/if_lagg.c
stable/12/sys/net/if_vlan.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/net/if_bridge.c
==============================================================================
--- stable/12/sys/net/if_bridge.c Wed Feb 5 00:20:26 2020 (r357554)
+++ stable/12/sys/net/if_bridge.c Wed Feb 5 00:47:03 2020 (r357555)
@@ -135,7 +135,15 @@ __FBSDID("$FreeBSD$");
#include <net/route.h>
+#ifdef INET6
/*
+ * XXX: declare here to avoid to include many inet6 related files..
+ * should be more generalized?
+ */
+extern void nd6_setmtu(struct ifnet *);
+#endif
+
+/*
* Size of the route hash table. Must be a power of two.
*/
#ifndef BRIDGE_RTHASH_SIZE
@@ -772,7 +780,7 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t da
} args;
struct ifdrv *ifd = (struct ifdrv *) data;
const struct bridge_control *bc;
- int error = 0;
+ int error = 0, oldmtu;
switch (cmd) {
@@ -818,11 +826,23 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t da
break;
}
+ oldmtu = ifp->if_mtu;
BRIDGE_LOCK(sc);
error = (*bc->bc_func)(sc, &args);
BRIDGE_UNLOCK(sc);
if (error)
break;
+
+ /*
+ * Bridge MTU may change during addition of the first port.
+ * If it did, do network layer specific procedure.
+ */
+ if (ifp->if_mtu != oldmtu) {
+#ifdef INET6
+ nd6_setmtu(ifp);
+#endif
+ rt_updatemtu(ifp);
+ }
if (bc->bc_flags & BC_F_COPYOUT)
error = copyout(&args, ifd->ifd_data, ifd->ifd_len);
Modified: stable/12/sys/net/if_lagg.c
==============================================================================
--- stable/12/sys/net/if_lagg.c Wed Feb 5 00:20:26 2020 (r357554)
+++ stable/12/sys/net/if_lagg.c Wed Feb 5 00:47:03 2020 (r357555)
@@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
#include <net/if_types.h>
#include <net/if_var.h>
#include <net/bpf.h>
+#include <net/route.h>
#include <net/vnet.h>
#if defined(INET) || defined(INET6)
@@ -73,6 +74,14 @@ __FBSDID("$FreeBSD$");
#include <net/if_lagg.h>
#include <net/ieee8023ad_lacp.h>
+#ifdef INET6
+/*
+ * XXX: declare here to avoid to include many inet6 related files..
+ * should be more generalized?
+ */
+extern void nd6_setmtu(struct ifnet *);
+#endif
+
#define LAGG_RLOCK() struct epoch_tracker lagg_et; epoch_enter_preempt(net_epoch_preempt, &lagg_et)
#define LAGG_RUNLOCK() epoch_exit_preempt(net_epoch_preempt, &lagg_et)
#define LAGG_RLOCK_ASSERT() MPASS(in_epoch(net_epoch_preempt))
@@ -1152,7 +1161,7 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data
struct ifnet *tpif;
struct thread *td = curthread;
char *buf, *outbuf;
- int count, buflen, len, error = 0;
+ int count, buflen, len, error = 0, oldmtu;
bzero(&rpbuf, sizeof(rpbuf));
@@ -1425,10 +1434,23 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data
tpif->if_xname);
}
#endif
+ oldmtu = ifp->if_mtu;
LAGG_XLOCK(sc);
error = lagg_port_create(sc, tpif);
LAGG_XUNLOCK(sc);
if_rele(tpif);
+
+ /*
+ * LAGG MTU may change during addition of the first port.
+ * If it did, do network layer specific procedure.
+ */
+ if (ifp->if_mtu != oldmtu) {
+#ifdef INET6
+ nd6_setmtu(ifp);
+#endif
+ rt_updatemtu(ifp);
+ }
+
VLAN_CAPABILITIES(ifp);
break;
case SIOCSLAGGDELPORT:
Modified: stable/12/sys/net/if_vlan.c
==============================================================================
--- stable/12/sys/net/if_vlan.c Wed Feb 5 00:20:26 2020 (r357554)
+++ stable/12/sys/net/if_vlan.c Wed Feb 5 00:47:03 2020 (r357555)
@@ -46,6 +46,7 @@
__FBSDID("$FreeBSD$");
#include "opt_inet.h"
+#include "opt_inet6.h"
#include "opt_vlan.h"
#include "opt_ratelimit.h"
@@ -74,6 +75,7 @@ __FBSDID("$FreeBSD$");
#include <net/if_dl.h>
#include <net/if_types.h>
#include <net/if_vlan_var.h>
+#include <net/route.h>
#include <net/vnet.h>
#ifdef INET
@@ -81,6 +83,14 @@ __FBSDID("$FreeBSD$");
#include <netinet/if_ether.h>
#endif
+#ifdef INET6
+/*
+ * XXX: declare here to avoid to include many inet6 related files..
+ * should be more generalized?
+ */
+extern void nd6_setmtu(struct ifnet *);
+#endif
+
#define VLAN_DEF_HWIDTH 4
#define VLAN_IFFLAGS (IFF_BROADCAST | IFF_MULTICAST)
@@ -1731,7 +1741,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data
struct ifvlan *ifv;
struct ifvlantrunk *trunk;
struct vlanreq vlr;
- int error = 0;
+ int error = 0, oldmtu;
ifr = (struct ifreq *)data;
ifa = (struct ifaddr *) data;
@@ -1825,8 +1835,20 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data
error = ENOENT;
break;
}
+ oldmtu = ifp->if_mtu;
error = vlan_config(ifv, p, vlr.vlr_tag);
if_rele(p);
+
+ /*
+ * VLAN MTU may change during addition of the vlandev.
+ * If it did, do network layer specific procedure.
+ */
+ if (ifp->if_mtu != oldmtu) {
+#ifdef INET6
+ nd6_setmtu(ifp);
+#endif
+ rt_updatemtu(ifp);
+ }
break;
case SIOCGETVLAN:
More information about the svn-src-all
mailing list