Hi there

Do you thinking that is good idea to have ability for automatically adjust MTU 
of vxlan in clone phase?

When I doing clone/create of vxlan interface automatically doing adjust of 
vxlan MTU according multicast vxlandev interface.

If this is valuable for project can take it.

-- 
Michael Pounov
ELWIX - Embedded LightWeight unIX -
--- if_vxlan.c	2019-11-19 13:57:56.046105000 +0200
+++ if_vxlan.c	2019-11-19 14:02:21.057692000 +0200
@@ -2725,8 +2725,9 @@
 vxlan_clone_create(struct if_clone *ifc, int unit, caddr_t params)
 {
 	struct vxlan_softc *sc;
-	struct ifnet *ifp;
+	struct ifnet *ifp, *ifpp;
 	struct ifvxlanparam vxlp;
+	const short r4hdrs = 100;	/* Reasonable standard offset for MTU from vxlandev iface */
 	int error;
 
 	sc = malloc(sizeof(struct vxlan_softc), M_VXLAN, M_WAITOK | M_ZERO);
@@ -2776,6 +2777,22 @@
 
 	ifp->if_baudrate = 0;
 	ifp->if_hdrlen = 0;
+
+	if (vxlp.vxlp_with & VXLAN_PARAM_WITH_MULTICAST_IF) {
+		ifpp = ifunit_ref(sc->vxl_mc_ifname);
+		if (ifpp == NULL) {
+			if_printf(sc->vxl_ifp, "multicast interface %s does "
+			    "not exist\n", sc->vxl_mc_ifname);
+			goto fail;
+		}
+		if (ifpp->if_mtu <= r4hdrs) {
+			if_printf(sc->vxl_ifp, "multicast interface %s does "
+			    "not have sufficient MTU\n", sc->vxl_mc_ifname);
+			goto fail;
+		}
+
+		ifp->if_mtu = ifpp->if_mtu - r4hdrs;
+	}
 
 	return (0);
 
_______________________________________________
freebsd-net@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"

Reply via email to