Date: Tue, 19 Nov 2019 14:15:53 +0200 From: Michael Pounov <misho@elwix.org> To: freebsd-net@freebsd.org, bryanv@FreeBSD.org Subject: vxlan interface mtu when clonning Message-ID: <20191119141553.ca59c2aba580953f71e598ff@elwix.org>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
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 -
[-- Attachment #2 --]
--- 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20191119141553.ca59c2aba580953f71e598ff>
