On Mon,  1 Sep 2025 12:37:14 +0000 Brett A C Sheffield wrote:
> +static int setup(void)
> +{
> +     struct ifreq ifr = {
> +             .ifr_name = "lo"
> +     };
> +     int fd = -1;
> +     int ctl;
> +
> +     /* we need to set MTU, so do this in a namespace to play nicely */
> +     if (unshare(CLONE_NEWNET) == -1)
> +             error(KSFT_FAIL, errno, "unshare");
> +
> +     ctl = socket(AF_LOCAL, SOCK_STREAM, 0);
> +     if (ctl == -1)
> +             error(KSFT_FAIL, errno, "socket");
> +
> +     /* ensure MTU is smaller than what we plan to send */
> +     ifr.ifr_mtu = MTU;
> +     if (ioctl(ctl, SIOCSIFMTU, &ifr) == -1)
> +             error(KSFT_FAIL, errno, "ioctl: set MTU");
> +
> +     disable_dad("lo");
> +     interface_up(ctl, &ifr);
> +
> +     close(ctl);
> +     return fd;

fd is unused here
-- 
pw-bot: cr

Reply via email to