| Don't automatically fix up MTU set by SIOCSIFMTU in if_gre(4) and if_me(4). |
| Backported from FreeBSD base r316699. |
| |
| diff -ru --exclude-from freebsd-src-diff-exclude-names --new-file /var/archive3/public/freebsd-releng-10.4-src/sys/net/if_gre.c freebsd-10.4/sys/net/if_gre.c |
| --- /var/archive3/public/freebsd-releng-10.4-src/sys/net/if_gre.c 2017-09-29 08:20:07.000000000 +0800 |
| +++ freebsd-10.4/sys/net/if_gre.c 2020-04-06 13:18:07.012575000 +0800 |
| @@ -86,9 +86,9 @@ |
| #include <net/if_gre.h> |
| |
| #include <machine/in_cksum.h> |
| - |
| #include <security/mac/mac_framework.h> |
| -#define GREMTU 1500 |
| + |
| +#define GREMTU 1476 |
| static const char grename[] = "gre"; |
| static MALLOC_DEFINE(M_GRE, grename, "Generic Routing Encapsulation"); |
| static VNET_DEFINE(struct mtx, gre_mtx); |
| @@ -173,7 +173,7 @@ |
| GRE2IFP(sc)->if_softc = sc; |
| if_initname(GRE2IFP(sc), grename, unit); |
| |
| - GRE2IFP(sc)->if_mtu = sc->gre_mtu = GREMTU; |
| + GRE2IFP(sc)->if_mtu = GREMTU; |
| GRE2IFP(sc)->if_flags = IFF_POINTOPOINT|IFF_MULTICAST; |
| GRE2IFP(sc)->if_output = gre_output; |
| GRE2IFP(sc)->if_ioctl = gre_ioctl; |
| @@ -231,7 +231,8 @@ |
| /* XXX: */ |
| if (ifr->ifr_mtu < 576) |
| return (EINVAL); |
| - break; |
| + ifp->if_mtu = ifr->ifr_mtu; |
| + return (0); |
| case SIOCSIFADDR: |
| ifp->if_flags |= IFF_UP; |
| case SIOCSIFFLAGS: |
| @@ -255,12 +256,6 @@ |
| } |
| error = 0; |
| switch (cmd) { |
| - case SIOCSIFMTU: |
| - GRE_WLOCK(sc); |
| - sc->gre_mtu = ifr->ifr_mtu; |
| - gre_updatehdr(sc); |
| - GRE_WUNLOCK(sc); |
| - goto end; |
| case SIOCSIFPHYADDR: |
| #ifdef INET6 |
| case SIOCSIFPHYADDR_IN6: |
| @@ -549,7 +544,6 @@ |
| } else |
| sc->gre_oseq = 0; |
| gh->gre_flags = htons(flags); |
| - GRE2IFP(sc)->if_mtu = sc->gre_mtu - sc->gre_hlen; |
| } |
| |
| static void |
| diff -ru --exclude-from freebsd-src-diff-exclude-names --new-file /var/archive3/public/freebsd-releng-10.4-src/sys/net/if_gre.h freebsd-10.4/sys/net/if_gre.h |
| --- /var/archive3/public/freebsd-releng-10.4-src/sys/net/if_gre.h 2017-09-29 08:20:07.000000000 +0800 |
| +++ freebsd-10.4/sys/net/if_gre.h 2020-04-06 13:17:16.811416000 +0800 |
| @@ -69,7 +69,6 @@ |
| uint32_t gre_oseq; |
| uint32_t gre_key; |
| uint32_t gre_options; |
| - uint32_t gre_mtu; |
| u_int gre_fibnum; |
| u_int gre_hlen; /* header size */ |
| union { |
| diff -ru --exclude-from freebsd-src-diff-exclude-names --new-file /var/archive3/public/freebsd-releng-10.4-src/sys/net/if_me.c freebsd-10.4/sys/net/if_me.c |
| --- /var/archive3/public/freebsd-releng-10.4-src/sys/net/if_me.c 2017-09-29 08:20:07.000000000 +0800 |
| +++ freebsd-10.4/sys/net/if_me.c 2020-04-06 13:17:16.812215000 +0800 |
| @@ -66,7 +66,7 @@ |
| #include <machine/in_cksum.h> |
| #include <security/mac/mac_framework.h> |
| |
| -#define MEMTU 1500 |
| +#define MEMTU (1500 - sizeof(struct mobhdr)) |
| static const char mename[] = "me"; |
| static MALLOC_DEFINE(M_IFME, mename, "Minimal Encapsulation for IP"); |
| static VNET_DEFINE(struct mtx, me_mtx); |
| @@ -187,7 +187,7 @@ |
| ME2IFP(sc)->if_softc = sc; |
| if_initname(ME2IFP(sc), mename, unit); |
| |
| - ME2IFP(sc)->if_mtu = MEMTU - sizeof(struct mobhdr); |
| + ME2IFP(sc)->if_mtu = MEMTU;; |
| ME2IFP(sc)->if_flags = IFF_POINTOPOINT|IFF_MULTICAST; |
| ME2IFP(sc)->if_output = me_output; |
| ME2IFP(sc)->if_ioctl = me_ioctl; |
| @@ -237,7 +237,7 @@ |
| case SIOCSIFMTU: |
| if (ifr->ifr_mtu < 576) |
| return (EINVAL); |
| - ifp->if_mtu = ifr->ifr_mtu - sizeof(struct mobhdr); |
| + ifp->if_mtu = ifr->ifr_mtu; |
| return (0); |
| case SIOCSIFADDR: |
| ifp->if_flags |= IFF_UP; |