]> git.ozlabs.org Git - ppp.git/commitdiff
Merge branch 'sys-to-errno-h' of https://github.com/snickl/lpppd
authorPaul Mackerras <paulus@ozlabs.org>
Sat, 18 Mar 2017 11:18:36 +0000 (22:18 +1100)
committerPaul Mackerras <paulus@ozlabs.org>
Sat, 18 Mar 2017 11:18:36 +0000 (22:18 +1100)
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
1  2 
pppd/sys-linux.c

diff --combined pppd/sys-linux.c
index b832031f7e269648ad6e33207c8855b2da4a8b34,20b42ac3e80c8f60ba6417ae2b265355c2515057..46e1ed419f4b494fb3d6f4781fdc0120ca808fab
  #include <sys/types.h>
  #include <sys/socket.h>
  #include <sys/time.h>
- #include <sys/errno.h>
  #include <sys/file.h>
  #include <sys/stat.h>
  #include <sys/utsname.h>
  #include <sys/sysmacros.h>
  
+ #include <errno.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <syslog.h>
@@@ -643,21 -643,6 +643,21 @@@ static int make_ppp_unit(
        }
        if (x < 0)
                error("Couldn't create new ppp unit: %m");
 +
 +      if (x == 0 && req_ifname[0] != '\0') {
 +              struct ifreq ifr;
 +              char t[MAXIFNAMELEN];
 +              memset(&ifr, 0, sizeof(struct ifreq));
 +              slprintf(t, sizeof(t), "%s%d", PPP_DRV_NAME, ifunit);
 +              strncpy(ifr.ifr_name, t, IF_NAMESIZE);
 +              strncpy(ifr.ifr_newname, req_ifname, IF_NAMESIZE);
 +              x = ioctl(sock_fd, SIOCSIFNAME, &ifr);
 +              if (x < 0)
 +                  error("Couldn't rename interface %s to %s: %m", t, req_ifname);
 +              else
 +                  info("Renamed interface %s to %s", t, req_ifname);
 +      }
 +
        return x;
  }