]> git.ozlabs.org Git - ppp.git/commitdiff
Fix netif_set_mtu for Solaris
authorWHR <msl0000023508@gmail.com>
Tue, 10 Jul 2018 01:10:24 +0000 (09:10 +0800)
committerWHR <msl0000023508@gmail.com>
Mon, 27 May 2019 05:37:10 +0000 (13:37 +0800)
The MTU setting for PPP interface is originally applied in function
ppp_send_config, this funcion sets a static variable 'link_mtu' from the
function argument 'mtu', then apply it to interface later using ioctl(2).
However during commit cffe80d, this ioctl(2) calling code was moved into a
separate function netif_set_mtu, with variable name 'link_mtu' unchanged.

This new function netif_set_mtu is intended to apply the MTU for interface,
from the passed argument 'mtu'; and it is called before ppp_send_config,
so 'link_mtu' won't get updated to the correct value when ioctl(2) is called;
the MTU value should be taken from argument 'mtu' instead of 'link_mtu'.

Signed-off-by: WHR <msl0000023508@gmail.com>
pppd/sys-solaris.c

index 93d90332e0d4f2116b17800970e082cf193640dd..df9d9acc7d4bf57d627c674444cb61eda80e7b3d 100644 (file)
@@ -1513,7 +1513,7 @@ netif_set_mtu(unit, mtu)
 
     memset(&ifr, 0, sizeof(ifr));
     strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
-    ifr.ifr_metric = link_mtu;
+    ifr.ifr_metric = mtu;
     if (ioctl(ipfd, SIOCSIFMTU, &ifr) < 0) {
        error("Couldn't set IP MTU (%s): %m", ifr.ifr_name);
     }
@@ -1525,7 +1525,7 @@ netif_set_mtu(unit, mtu)
 
     memset(&lifr, 0, sizeof(lifr));
     strlcpy(lifr.lifr_name, ifname, sizeof(lifr.lifr_name));
-    lifr.lifr_mtu = link_mtu;
+    lifr.lifr_mtu = mtu;
     if (ioctl(fd, SIOCSLIFMTU, &lifr) < 0) {
        close(fd);
        error("Couldn't set IPv6 MTU (%s): %m", ifr.ifr_name);