diff options
Diffstat (limited to 'src/fastd.c')
-rw-r--r-- | src/fastd.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/fastd.c b/src/fastd.c index 3b8531f..af9ba6e 100644 --- a/src/fastd.c +++ b/src/fastd.c @@ -308,9 +308,14 @@ static void init_tuntap(fastd_context *ctx) { if (ctl_sock < 0) exit_errno(ctx, "socket"); - ifr.ifr_mtu = ctx->conf->mtu; - if (ioctl(ctl_sock, SIOCSIFMTU, &ifr) < 0) - exit_errno(ctx, "SIOCSIFMTU ioctl failed"); + if (ioctl(ctl_sock, SIOCGIFMTU, &ifr) < 0) + exit_errno(ctx, "SIOCGIFMTU ioctl failed"); + + if (ifr.ifr_mtu != ctx->conf->mtu) { + ifr.ifr_mtu = ctx->conf->mtu; + if (ioctl(ctl_sock, SIOCSIFMTU, &ifr) < 0) + exit_errno(ctx, "SIOCSIFMTU ioctl failed"); + } if (close(ctl_sock)) pr_error_errno(ctx, "close"); |