source:
npl/internetserver/poptop_ppp/patches/ppp-2.4.2-ifname.diff
@
c5c522c
Last change on this file since c5c522c was c5c522c, checked in by , 8 years ago | |
---|---|
|
|
File size: 4.3 KB |
-
./pppd/main.c
old new 98 98 static const char rcsid[] = RCSID; 99 99 100 100 /* interface vars */ 101 char ifname[ 32];/* Interface name */101 char ifname[MAXIFNAMELEN]; /* Interface name */ 102 102 int ifunit; /* Interface unit number */ 103 103 104 104 struct channel *the_channel; … … 261 261 NULL 262 262 }; 263 263 264 /*265 * If PPP_DRV_NAME is not defined, use the default "ppp" as the device name.266 */267 #if !defined(PPP_DRV_NAME)268 #define PPP_DRV_NAME "ppp"269 #endif /* !defined(PPP_DRV_NAME) */270 271 264 int 272 265 main(argc, argv) 273 266 int argc; … … 777 770 set_ifunit(iskey) 778 771 int iskey; 779 772 { 780 info("Using interface %s%d", PPP_DRV_NAME, ifunit); 773 if (req_ifname[0] != '\0') 774 slprintf(ifname, sizeof(ifname), req_ifname); 775 else 781 776 slprintf(ifname, sizeof(ifname), "%s%d", PPP_DRV_NAME, ifunit); 777 info("Using interface %s", ifname); 782 778 script_setenv("IFNAME", ifname, iskey); 783 779 if (iskey) { 784 780 create_pidfile(getpid()); /* write pid to file */ -
./pppd/options.c
old new 102 102 bool tune_kernel; /* may alter kernel settings */ 103 103 int connect_delay = 1000; /* wait this many ms after connect script */ 104 104 int req_unit = -1; /* requested interface unit */ 105 char req_ifname[MAXIFNAMELEN]; /* requested interface name */ 105 106 bool multilink = 0; /* Enable multilink operation */ 106 107 char *bundle_name = NULL; /* bundle name for multilink */ 107 108 bool dump_options; /* print out option values */ … … 259 260 "PPP interface unit number to use if possible", 260 261 OPT_PRIO | OPT_LLIMIT, 0, 0 }, 261 262 263 { "ifname", o_string, req_ifname, 264 "Set PPP interface name", 265 OPT_PRIO | OPT_PRIV | OPT_STATIC, NULL, MAXIFNAMELEN }, 266 262 267 { "dump", o_bool, &dump_options, 263 268 "Print out option values after parsing all options", 1 }, 264 269 { "dryrun", o_bool, &dryrun, -
./pppd/pppd.8
old new 1020 1020 .TP 1021 1021 .B unit \fInum 1022 1022 Sets the ppp unit number (for a ppp0 or ppp1 etc interface name) for outbound 1023 connections. 1023 connections. If the unit is already in use a dynamically allocated will be 1024 used. 1025 .TP 1026 .B ifname \fIstring 1027 Set the ppp interface name for outbound connections. A failure to set the 1028 name will terminate the pppd. 1024 1029 .TP 1025 1030 .B updetach 1026 1031 With this option, pppd will detach from its controlling terminal once -
./pppd/pppd.h
old new 80 80 #define MAXARGS 1 /* max # args to a command */ 81 81 #define MAXNAMELEN 256 /* max length of hostname or name for auth */ 82 82 #define MAXSECRETLEN 256 /* max length of password or secret */ 83 #define MAXIFNAMELEN 32 /* max length of interface name; or use IFNAMSIZ, can we 84 always include net/if.h? */ 85 86 /* 87 * If PPP_DRV_NAME is not defined, use the default "ppp" as the device name. 88 * Where should PPP_DRV_NAME come from? Do we include it here? 89 */ 90 #if !defined(PPP_DRV_NAME) 91 #define PPP_DRV_NAME "ppp" 92 #endif /* !defined(PPP_DRV_NAME) */ 83 93 84 94 /* 85 95 * Option descriptor structure. … … 304 314 extern int connect_delay; /* Time to delay after connect script */ 305 315 extern int max_data_rate; /* max bytes/sec through charshunt */ 306 316 extern int req_unit; /* interface unit number to use */ 317 extern char req_ifname[MAXIFNAMELEN]; /* interface name to use */ 307 318 extern bool multilink; /* enable multilink operation */ 308 319 extern bool noendpoint; /* don't send or accept endpt. discrim. */ 309 320 extern char *bundle_name; /* bundle name for multilink */ -
./pppd/sys-linux.c
old new 649 649 } 650 650 if (x < 0) 651 651 error("Couldn't create new ppp unit: %m"); 652 653 if (x == 0 && req_ifname[0] != '\0') { 654 struct ifreq ifr; 655 char t[MAXIFNAMELEN]; 656 memset(&ifr, 0, sizeof(struct ifreq)); 657 slprintf(t, sizeof(t), "%s%d", PPP_DRV_NAME, ifunit); 658 strncpy(ifr.ifr_name, t, IF_NAMESIZE); 659 strncpy(ifr.ifr_newname, req_ifname, IF_NAMESIZE); 660 x = ioctl(sock_fd, SIOCSIFNAME, &ifr); 661 if (x < 0) 662 error("Couldn't rename interface %s to %s: %m", t, req_ifname); 663 else 664 info("Renamed interface %s to %s", t, req_ifname); 665 } 666 652 667 return x; 653 668 } 654 669
Note: See TracBrowser
for help on using the repository browser.