[PATCH v6] pcap: support MTU set for linux interafces
Stephen Hemminger
stephen at networkplumber.org
Wed Jun 8 18:23:04 CEST 2022
On Wed, 8 Jun 2022 19:04:19 +0300
Ido Goshen <ido at cgstowernetworks.com> wrote:
> +int
> +osdep_iface_mtu_set(const char *if_name, uint16_t mtu)
> +{
> + struct ifreq ifr;
> + int if_fd = socket(AF_INET, SOCK_DGRAM, 0);
> +
> + if (if_fd == -1)
> + return -1;
> +
> + rte_strscpy(ifr.ifr_name, if_name, sizeof(ifr.ifr_name));
> + ifr.ifr_mtu = mtu;
> + if (ioctl(if_fd, SIOCSIFMTU, &ifr)) {
> + PMD_LOG(ERR, "%s mtu set to %d failed\n", if_name, mtu);
> + close(if_fd);
> + return -1;
> + }
> +
> + close(if_fd);
> + return 0;
> +}
This should work on FreeBSD as well.
FreeBSD has the same ioctl()
More information about the dev
mailing list