3 @@ -743,8 +743,11 @@ void
7 - info("Using interface %s%d", PPP_DRV_NAME, ifunit);
8 - slprintf(ifname, sizeof(ifname), "%s%d", PPP_DRV_NAME, ifunit);
9 + if (use_ifname[0] == 0)
10 + slprintf(ifname, sizeof(ifname), "%s%d", PPP_DRV_NAME, ifunit);
12 + slprintf(ifname, sizeof(ifname), "%s", use_ifname);
13 + info("Using interface %s", ifname);
14 script_setenv("IFNAME", ifname, iskey);
16 create_pidfile(getpid()); /* write pid to file */
19 @@ -111,6 +111,7 @@ int log_to_fd = 1; /* send log messages
20 bool log_default = 1; /* log_to_fd is default (stdout) */
21 int maxfail = 10; /* max # of unsuccessful connection attempts */
22 char linkname[MAXPATHLEN]; /* logical name for link */
23 +char use_ifname[IFNAMSIZ]; /* physical name for PPP link */
24 bool tune_kernel; /* may alter kernel settings */
25 int connect_delay = 1000; /* wait this many ms after connect script */
26 int req_unit = -1; /* requested interface unit */
27 @@ -264,6 +265,9 @@ option_t general_options[] = {
28 { "linkname", o_string, linkname,
29 "Set logical name for link",
30 OPT_PRIO | OPT_PRIV | OPT_STATIC, NULL, MAXPATHLEN },
31 + { "ifname", o_string, use_ifname,
32 + "Set physical name for PPP interface",
33 + OPT_PRIO | OPT_PRIV | OPT_STATIC, NULL, IFNAMSIZ },
35 { "maxfail", o_int, &maxfail,
36 "Maximum number of unsuccessful connection attempts to allow",
50 @@ -309,6 +313,7 @@ extern char *record_file; /* File to rec
51 extern bool sync_serial; /* Device is synchronous serial device */
52 extern int maxfail; /* Max # of unsuccessful connection attempts */
53 extern char linkname[MAXPATHLEN]; /* logical name for link */
54 +extern char use_ifname[IFNAMSIZ]; /* physical name for PPP interface */
55 extern bool tune_kernel; /* May alter kernel settings as necessary */
56 extern int connect_delay; /* Time to delay after connect script */
57 extern int max_data_rate; /* max bytes/sec through charshunt */
58 --- a/pppd/sys-linux.c
59 +++ b/pppd/sys-linux.c
60 @@ -168,6 +168,10 @@ struct in6_ifreq {
61 /* We can get an EIO error on an ioctl if the modem has hung up */
62 #define ok_error(num) ((num)==EIO)
64 +#if !defined(PPP_DRV_NAME)
65 +#define PPP_DRV_NAME "ppp"
66 +#endif /* !defined(PPP_DRV_NAME) */
68 static int tty_disc = N_TTY; /* The TTY discipline */
69 static int ppp_disc = N_PPP; /* The PPP discpline */
70 static int initfdflags = -1; /* Initial file descriptor flags for fd */
71 @@ -622,7 +626,8 @@ void generic_disestablish_ppp(int dev_fd
73 static int make_ppp_unit()
79 if (ppp_dev_fd >= 0) {
80 dbglog("in make_ppp_unit, already had /dev/ppp open?");
81 @@ -645,6 +650,30 @@ static int make_ppp_unit()
84 error("Couldn't create new ppp unit: %m");
86 + if (use_ifname[0] != 0) {
87 + s = socket(PF_INET, SOCK_DGRAM, 0);
89 + s = socket(PF_PACKET, SOCK_DGRAM, 0);
91 + s = socket(PF_INET6, SOCK_DGRAM, 0);
93 + s = socket(PF_UNIX, SOCK_DGRAM, 0);
95 + slprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s%d", PPP_DRV_NAME, ifunit);
96 + slprintf(ifr.ifr_newname, sizeof(ifr.ifr_newname), "%s", use_ifname);
97 + x = ioctl(s, SIOCSIFNAME, &ifr);
103 + error("Couldn't rename %s to %s", ifr.ifr_name, ifr.ifr_newname);
112 --- a/pppstats/pppstats.c
113 +++ b/pppstats/pppstats.c
114 @@ -506,10 +506,12 @@ main(argc, argv)
119 if (sscanf(interface, PPP_DRV_NAME "%d", &unit) != 1) {
120 fprintf(stderr, "%s: invalid interface '%s' specified\n",
121 progname, interface);