1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-27 11:55:06 +00:00

Allow set MTU more than 1500 bytes.

Submitted by:	Alexandr Fedorov <aleksandr.fedorov_itglobal_dot_com>
Approved by:	jhb, rgrimes
Sponsored by:	ITGlobal.com
Differential Revision:	https://reviews.freebsd.org/D19422
This commit is contained in:
Kirill Ponomarev 2019-07-24 16:10:20 +00:00
parent e020a35f5b
commit b7592822d5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=350293

View File

@ -84,6 +84,15 @@ struct vxlan_socket_mc_info {
int vxlsomc_users;
};
/*
* The maximum MTU of encapsulated ethernet frame within IPv4/UDP packet.
*/
#define VXLAN_MAX_MTU (IP_MAXPACKET - \
60 /* Maximum IPv4 header len */ - \
sizeof(struct udphdr) - \
sizeof(struct vxlan_header) - \
ETHER_HDR_LEN - ETHER_CRC_LEN - ETHER_VLAN_ENCAP_LEN)
#define VXLAN_SO_MC_MAX_GROUPS 32
#define VXLAN_SO_VNI_HASH_SHIFT 6
@ -2247,10 +2256,11 @@ vxlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
ifr = (struct ifreq *) data;
ifd = (struct ifdrv *) data;
error = 0;
switch (cmd) {
case SIOCADDMULTI:
case SIOCDELMULTI:
error = 0;
break;
case SIOCGDRVSPEC:
@ -2267,6 +2277,13 @@ vxlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
error = ifmedia_ioctl(ifp, ifr, &sc->vxl_media, cmd);
break;
case SIOCSIFMTU:
if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > VXLAN_MAX_MTU)
error = EINVAL;
else
ifp->if_mtu = ifr->ifr_mtu;
break;
default:
error = ether_ioctl(ifp, cmd, data);
break;
@ -2747,8 +2764,8 @@ vxlan_clone_create(struct if_clone *ifc, int unit, caddr_t params)
ifp->if_ioctl = vxlan_ioctl;
ifp->if_transmit = vxlan_transmit;
ifp->if_qflush = vxlan_qflush;
ifp->if_capabilities |= IFCAP_LINKSTATE;
ifp->if_capenable |= IFCAP_LINKSTATE;
ifp->if_capabilities |= IFCAP_LINKSTATE | IFCAP_JUMBO_MTU;
ifp->if_capenable |= IFCAP_LINKSTATE | IFCAP_JUMBO_MTU;
ifmedia_init(&sc->vxl_media, 0, vxlan_media_change, vxlan_media_status);
ifmedia_add(&sc->vxl_media, IFM_ETHER | IFM_AUTO, 0, NULL);