/[smeserver]/rpms/ppp/sme8/ppp-2.4.2-ifname.diff
ViewVC logotype

Contents of /rpms/ppp/sme8/ppp-2.4.2-ifname.diff

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Tue Jun 12 20:34:42 2007 UTC (17 years, 5 months ago) by slords
Branch: MAIN
CVS Tags: ppp-2_4_4-1_3_el5_sme, HEAD
Import on branch sme8 of package ppp-2.4.4-1.3.el5.sme.src.rpm

1 --- ./pppd/main.c.orig 2004-07-19 12:35:22.000000000 +0000
2 +++ ./pppd/main.c 2004-07-19 14:34:38.542120946 +0000
3 @@ -98,7 +98,7 @@
4 static const char rcsid[] = RCSID;
5
6 /* interface vars */
7 -char ifname[32]; /* Interface name */
8 +char ifname[MAXIFNAMELEN]; /* Interface name */
9 int ifunit; /* Interface unit number */
10
11 struct channel *the_channel;
12 @@ -261,13 +261,6 @@
13 NULL
14 };
15
16 -/*
17 - * If PPP_DRV_NAME is not defined, use the default "ppp" as the device name.
18 - */
19 -#if !defined(PPP_DRV_NAME)
20 -#define PPP_DRV_NAME "ppp"
21 -#endif /* !defined(PPP_DRV_NAME) */
22 -
23 int
24 main(argc, argv)
25 int argc;
26 @@ -777,8 +770,11 @@
27 set_ifunit(iskey)
28 int iskey;
29 {
30 - info("Using interface %s%d", PPP_DRV_NAME, ifunit);
31 + if (req_ifname[0] != '\0')
32 + slprintf(ifname, sizeof(ifname), req_ifname);
33 + else
34 slprintf(ifname, sizeof(ifname), "%s%d", PPP_DRV_NAME, ifunit);
35 + info("Using interface %s", ifname);
36 script_setenv("IFNAME", ifname, iskey);
37 if (iskey) {
38 create_pidfile(getpid()); /* write pid to file */
39 --- ./pppd/options.c.orig 2004-07-19 12:59:21.000000000 +0000
40 +++ ./pppd/options.c 2004-07-19 14:35:04.253865964 +0000
41 @@ -102,6 +102,7 @@
42 bool tune_kernel; /* may alter kernel settings */
43 int connect_delay = 1000; /* wait this many ms after connect script */
44 int req_unit = -1; /* requested interface unit */
45 +char req_ifname[MAXIFNAMELEN]; /* requested interface name */
46 bool multilink = 0; /* Enable multilink operation */
47 char *bundle_name = NULL; /* bundle name for multilink */
48 bool dump_options; /* print out option values */
49 @@ -259,6 +260,10 @@
50 "PPP interface unit number to use if possible",
51 OPT_PRIO | OPT_LLIMIT, 0, 0 },
52
53 + { "ifname", o_string, req_ifname,
54 + "Set PPP interface name",
55 + OPT_PRIO | OPT_PRIV | OPT_STATIC, NULL, MAXIFNAMELEN },
56 +
57 { "dump", o_bool, &dump_options,
58 "Print out option values after parsing all options", 1 },
59 { "dryrun", o_bool, &dryrun,
60 --- ./pppd/pppd.8.orig 2004-07-19 14:39:06.639320497 +0000
61 +++ ./pppd/pppd.8 2004-07-19 15:00:37.339448432 +0000
62 @@ -1020,7 +1020,12 @@
63 .TP
64 .B unit \fInum
65 Sets the ppp unit number (for a ppp0 or ppp1 etc interface name) for outbound
66 -connections.
67 +connections. If the unit is already in use a dynamically allocated will be
68 +used.
69 +.TP
70 +.B ifname \fIstring
71 +Set the ppp interface name for outbound connections. A failure to set the
72 +name will terminate the pppd.
73 .TP
74 .B updetach
75 With this option, pppd will detach from its controlling terminal once
76 --- ./pppd/pppd.h.orig 2004-07-19 12:59:16.000000000 +0000
77 +++ ./pppd/pppd.h 2004-07-19 15:02:08.792752747 +0000
78 @@ -80,6 +80,16 @@
79 #define MAXARGS 1 /* max # args to a command */
80 #define MAXNAMELEN 256 /* max length of hostname or name for auth */
81 #define MAXSECRETLEN 256 /* max length of password or secret */
82 +#define MAXIFNAMELEN 32 /* max length of interface name; or use IFNAMSIZ, can we
83 + always include net/if.h? */
84 +
85 +/*
86 + * If PPP_DRV_NAME is not defined, use the default "ppp" as the device name.
87 + * Where should PPP_DRV_NAME come from? Do we include it here?
88 + */
89 +#if !defined(PPP_DRV_NAME)
90 +#define PPP_DRV_NAME "ppp"
91 +#endif /* !defined(PPP_DRV_NAME) */
92
93 /*
94 * Option descriptor structure.
95 @@ -304,6 +314,7 @@
96 extern int connect_delay; /* Time to delay after connect script */
97 extern int max_data_rate; /* max bytes/sec through charshunt */
98 extern int req_unit; /* interface unit number to use */
99 +extern char req_ifname[MAXIFNAMELEN]; /* interface name to use */
100 extern bool multilink; /* enable multilink operation */
101 extern bool noendpoint; /* don't send or accept endpt. discrim. */
102 extern char *bundle_name; /* bundle name for multilink */
103 --- ./pppd/sys-linux.c.orig 2004-07-19 12:33:29.000000000 +0000
104 +++ ./pppd/sys-linux.c 2004-07-19 14:37:36.463754450 +0000
105 @@ -649,6 +649,21 @@
106 }
107 if (x < 0)
108 error("Couldn't create new ppp unit: %m");
109 +
110 + if (x == 0 && req_ifname[0] != '\0') {
111 + struct ifreq ifr;
112 + char t[MAXIFNAMELEN];
113 + memset(&ifr, 0, sizeof(struct ifreq));
114 + slprintf(t, sizeof(t), "%s%d", PPP_DRV_NAME, ifunit);
115 + strncpy(ifr.ifr_name, t, IF_NAMESIZE);
116 + strncpy(ifr.ifr_newname, req_ifname, IF_NAMESIZE);
117 + x = ioctl(sock_fd, SIOCSIFNAME, &ifr);
118 + if (x < 0)
119 + error("Couldn't rename interface %s to %s: %m", t, req_ifname);
120 + else
121 + info("Renamed interface %s to %s", t, req_ifname);
122 + }
123 +
124 return x;
125 }
126

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed