X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fsys-linux.c;h=46e1ed419f4b494fb3d6f4781fdc0120ca808fab;hp=20b42ac3e80c8f60ba6417ae2b265355c2515057;hb=d98ab3805c818bfb58e20ee18e6488a851c1a90d;hpb=56a4760236ee0a606075404c5704801feffa646c diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c index 20b42ac..46e1ed4 100644 --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c @@ -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; }