ALT Linux repos
S: | 2.5.0-alt1 |
5.0: | 2.4.4-alt11 |
4.1: | 2.4.4-alt10.M41.1 |
4.0: | 2.4.4-alt10 |
+updates: | 2.4.4-alt10 |
3.0: | 2.4.2-alt6 |
+updates: | 2.4.2-alt6.M30.1 |
Group :: System/Servers
RPM: ppp
Main Changelog Spec Patches Sources Download Gear Bugs and FR Repocop
Patch: ppp-2.4.4-alt-minunit.patch
Download
Download
diff -Naur ppp-2.4.4-upto52/pppd/options.c ppp-2.4.4/pppd/options.c
--- ppp-2.4.4-upto52/pppd/options.c 2007-12-08 21:52:54 +0300
+++ ppp-2.4.4/pppd/options.c 2007-12-08 21:56:20 +0300
@@ -119,6 +119,7 @@
bool tune_kernel; /* may alter kernel settings */
int connect_delay = 1000; /* wait this many ms after connect script */
int req_unit = -1; /* requested interface unit */
+int req_minunit = -1; /* requested minimal interface unit */
char req_ifname[MAXIFNAMELEN]; /* requested interface name */
bool multilink = 0; /* Enable multilink operation */
char *bundle_name = NULL; /* bundle name for multilink */
@@ -287,6 +288,9 @@
{ "unit", o_int, &req_unit,
"PPP interface unit number to use if possible",
OPT_PRIO | OPT_LLIMIT, 0, 0 },
+ { "minunit", o_int, &req_minunit,
+ "PPP interface minimal unit number",
+ OPT_PRIO | OPT_LLIMIT, 0, 0 },
{ "ifname", o_string, req_ifname,
"Set PPP interface name",
diff -Naur ppp-2.4.4-upto52/pppd/pppd.8 ppp-2.4.4/pppd/pppd.8
--- ppp-2.4.4-upto52/pppd/pppd.8 2007-12-08 21:52:54 +0300
+++ ppp-2.4.4/pppd/pppd.8 2007-12-08 21:53:34 +0300
@@ -1051,6 +1051,12 @@
Set the ppp interface name for outbound connections. A failure to set the
name will terminate the pppd.
.TP
+.B minunit \fInum
+Such as unit, but always select bigger interface
+.TP
+.B minunit \fInum
+PPP interface minimal unit number. Such as unit, but always select bigger interface
+.TP
.B updetach
With this option, pppd will detach from its controlling terminal once
it has successfully established the ppp connection (to the point where
diff -Naur ppp-2.4.4-upto52/pppd/pppd.h ppp-2.4.4/pppd/pppd.h
--- ppp-2.4.4-upto52/pppd/pppd.h 2007-12-08 21:52:54 +0300
+++ ppp-2.4.4/pppd/pppd.h 2007-12-08 21:55:46 +0300
@@ -87,6 +87,7 @@
#define MAXARGS 1 /* max # args to a command */
#define MAXNAMELEN 256 /* max length of hostname or name for auth */
#define MAXSECRETLEN 256 /* max length of password or secret */
+#define MAXUNIT 255 /* max ppp interface */
#define MAXIFNAMELEN 32 /* max length of interface name; or use IFNAMSIZ, can we
always include net/if.h? */
@@ -329,6 +330,7 @@
extern int connect_delay; /* Time to delay after connect script */
extern int max_data_rate; /* max bytes/sec through charshunt */
extern int req_unit; /* interface unit number to use */
+extern int req_minunit; /* interface minimal unit number to use */
extern char req_ifname[MAXIFNAMELEN]; /* interface name to use */
extern bool multilink; /* enable multilink operation */
extern bool noendpoint; /* don't send or accept endpt. discrim. */
diff -Naur ppp-2.4.4-upto52/pppd/sys-linux.c ppp-2.4.4/pppd/sys-linux.c
--- ppp-2.4.4-upto52/pppd/sys-linux.c 2007-12-08 21:52:54 +0300
+++ ppp-2.4.4/pppd/sys-linux.c 2007-12-08 21:53:34 +0300
@@ -630,13 +630,26 @@
|| fcntl(ppp_dev_fd, F_SETFL, flags | O_NONBLOCK) == -1)
warn("Couldn't set /dev/ppp to nonblock: %m");
- ifunit = req_unit;
- x = ioctl(ppp_dev_fd, PPPIOCNEWUNIT, &ifunit);
- if (x < 0 && req_unit >= 0 && errno == EEXIST) {
+ if (req_minunit > -1) {
+ for(ifunit = req_minunit;req_minunit < MAXUNIT; ifunit = ++req_minunit) {
+ x = ioctl(ppp_dev_fd, PPPIOCNEWUNIT, &ifunit);
+ if (x < 0 && errno == EEXIST) {
+ warn("Couldn't allocate PPP unit %d as it is already in use try to attempt next", req_minunit);
+ }
+ if (x >= 0)
+ break;
+ }
+ }
+ if ((x < 0) || (req_minunit == -1)) {
+ ifunit = req_unit;
+ x = ioctl(ppp_dev_fd, PPPIOCNEWUNIT, &ifunit);
+ if (x < 0 && req_unit >= 0 && errno == EEXIST) {
warn("Couldn't allocate PPP unit %d as it is already in use", req_unit);
ifunit = -1;
x = ioctl(ppp_dev_fd, PPPIOCNEWUNIT, &ifunit);
+ }
}
+
if (x < 0)
error("Couldn't create new ppp unit: %m");