Поскольку при применении https://bugzilla.altlinux.org/show_bug. … mp;id=9800 на ppp-2.4.5 есть режекты, выкладываю содержимое причёсанного ppp-2.4.5-alt-minunit.patch
diff -ruN ppp-2.4.5.orig/pppd/options.c ppp-2.4.5/pppd/options.c
--- ppp-2.4.5.orig/pppd/options.c 2009-11-17 01:26:07.000000000 +0300
+++ ppp-2.4.5/pppd/options.c 2012-02-08 14:44:59.983680313 +0400
@@ -113,6 +113,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 */
bool multilink = 0; /* Enable multilink operation */
char *bundle_name = NULL; /* bundle name for multilink */
bool dump_options; /* print out option values */
@@ -272,8 +273,13 @@
"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 },
+
{ "dump", o_bool, &dump_options,
"Print out option values after parsing all options", 1 },
+
{ "dryrun", o_bool, &dryrun,
"Stop after parsing, printing, and checking options", 1 },
diff -ruN ppp-2.4.5.orig/pppd/pppd.8 ppp-2.4.5/pppd/pppd.8
--- ppp-2.4.5.orig/pppd/pppd.8 2009-11-17 01:26:07.000000000 +0300
+++ ppp-2.4.5/pppd/pppd.8 2012-02-08 14:42:47.547678792 +0400
@@ -1050,6 +1050,12 @@
Sets the ppp unit number (for a ppp0 or ppp1 etc interface name) for outbound
connections.
.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 -ruN ppp-2.4.5.orig/pppd/pppd.h ppp-2.4.5/pppd/pppd.h
--- ppp-2.4.5.orig/pppd/pppd.h 2009-11-17 01:26:07.000000000 +0300
+++ ppp-2.4.5/pppd/pppd.h 2012-02-08 14:47:36.982680668 +0400
@@ -80,6 +80,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 */
/*
* Option descriptor structure.
@@ -313,6 +314,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 bool multilink; /* enable multilink operation */
extern bool noendpoint; /* don't send or accept endpt. discrim. */
extern char *bundle_name; /* bundle name for multilink */
diff -ruN ppp-2.4.5.orig/pppd/sys-linux.c ppp-2.4.5/pppd/sys-linux.c
--- ppp-2.4.5.orig/pppd/sys-linux.c 2009-11-17 01:26:07.000000000 +0300
+++ ppp-2.4.5/pppd/sys-linux.c 2012-02-08 14:42:47.550678967 +0400
@@ -627,13 +627,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");
return x;
Забрать содержимое /source/n/ppp/
Положить рядом патч в ppp-2.4.5-alt-minunit.patch
Поправить SlackBuild, в части BUILD-а и добавив строчку с применением патча после zcat $CWD/ppp.slack.diff.gz | ...
BUILD=${BUILD:-1mu}
zcat $CWD/ppp.slack.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit
cat $CWD/ppp-2.4.5-alt-minunit.patch | patch -p1 --verbose --backup --suffix=.orig || exit
Собрать новый пакет и поставить вместо существующего:
Консоль:
# ./ppp.SlackBuild
# upgradepkg --install-new --reinstall /tmp/ppp-2.4.5-*-1mu.t?z
Добавить в options.pptpd