mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-12-24 14:23:21 +02:00
[package] update ppp to v2.4.4 (#5102)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@15955 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
3ea3f46e5a
commit
184fbf8c19
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2006-2008 OpenWrt.org
|
||||
# Copyright (C) 2006-2009 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
@ -8,12 +8,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ppp
|
||||
PKG_VERSION:=2.4.3
|
||||
PKG_RELEASE:=11
|
||||
PKG_VERSION:=2.4.4
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=ftp://ftp.samba.org/pub/ppp/
|
||||
PKG_MD5SUM:=848f6c3cafeb6074ffeb293c3af79b7c
|
||||
PKG_MD5SUM:=183800762e266132218b204dfb428d29
|
||||
|
||||
PKG_BUILD_DEPENDS:=libpcap
|
||||
|
||||
|
@ -1,35 +0,0 @@
|
||||
From: Simon Peter <dn.tlp@gmx.net>
|
||||
Subject: Bug#306261: pppd does not properly close /dev/ppp on persist
|
||||
|
||||
When using the kernel PPPoE driver, pppd never
|
||||
closes /dev/ppp when the link has come down.
|
||||
|
||||
It opens superfluous fds to the device each time it re-opens the
|
||||
connection, with the unclosed ones falsely reported always ready for
|
||||
data by select().
|
||||
|
||||
This makes pppd eat up 100% CPU time after the first persist because of
|
||||
the always instantly returning select() on the unclosed fds.
|
||||
|
||||
The problem also occurs with the upstream version, but does not occur
|
||||
when a pty/tty device is used for the ppp connection.
|
||||
|
||||
|
||||
Index: ppp-2.4.3/pppd/sys-linux.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/sys-linux.c 2007-06-04 13:22:08.527558896 +0200
|
||||
+++ ppp-2.4.3/pppd/sys-linux.c 2007-06-04 13:22:08.807516336 +0200
|
||||
@@ -453,6 +453,13 @@
|
||||
if (new_style_driver) {
|
||||
int flags;
|
||||
|
||||
+ /* if a ppp_fd is already open, close it first */
|
||||
+ if(ppp_fd > 0) {
|
||||
+ close(ppp_fd);
|
||||
+ remove_fd(ppp_fd);
|
||||
+ ppp_fd = -1;
|
||||
+ }
|
||||
+
|
||||
/* Open an instance of /dev/ppp and connect the channel to it */
|
||||
if (ioctl(fd, PPPIOCGCHAN, &chindex) == -1) {
|
||||
error("Couldn't get channel number: %m");
|
176
package/ppp/patches/100-debian_ip-ip_option.patch
Normal file
176
package/ppp/patches/100-debian_ip-ip_option.patch
Normal file
@ -0,0 +1,176 @@
|
||||
diff -Naur ppp-2.4.4.orig/pppd/ipcp.c ppp-2.4.4/pppd/ipcp.c
|
||||
--- ppp-2.4.4.orig/pppd/ipcp.c 2005-08-25 19:59:34.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/ipcp.c 2009-05-07 15:47:29.000000000 -0400
|
||||
@@ -1850,7 +1850,7 @@
|
||||
*/
|
||||
if (ipcp_script_state == s_down && ipcp_script_pid == 0) {
|
||||
ipcp_script_state = s_up;
|
||||
- ipcp_script(_PATH_IPUP, 0);
|
||||
+ ipcp_script(path_ipup, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1900,7 +1900,7 @@
|
||||
/* Execute the ip-down script */
|
||||
if (ipcp_script_state == s_up && ipcp_script_pid == 0) {
|
||||
ipcp_script_state = s_down;
|
||||
- ipcp_script(_PATH_IPDOWN, 0);
|
||||
+ ipcp_script(path_ipdown, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1954,13 +1954,13 @@
|
||||
case s_up:
|
||||
if (ipcp_fsm[0].state != OPENED) {
|
||||
ipcp_script_state = s_down;
|
||||
- ipcp_script(_PATH_IPDOWN, 0);
|
||||
+ ipcp_script(path_ipdown, 0);
|
||||
}
|
||||
break;
|
||||
case s_down:
|
||||
if (ipcp_fsm[0].state == OPENED) {
|
||||
ipcp_script_state = s_up;
|
||||
- ipcp_script(_PATH_IPUP, 0);
|
||||
+ ipcp_script(path_ipup, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
diff -Naur ppp-2.4.4.orig/pppd/main.c ppp-2.4.4/pppd/main.c
|
||||
--- ppp-2.4.4.orig/pppd/main.c 2006-06-03 23:52:50.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/main.c 2009-05-07 15:47:29.000000000 -0400
|
||||
@@ -315,6 +315,9 @@
|
||||
struct protent *protp;
|
||||
char numbuf[16];
|
||||
|
||||
+ strlcpy(path_ipup, _PATH_IPUP, sizeof(path_ipup));
|
||||
+ strlcpy(path_ipdown, _PATH_IPDOWN, sizeof(path_ipdown));
|
||||
+
|
||||
link_stats_valid = 0;
|
||||
new_phase(PHASE_INITIALIZE);
|
||||
|
||||
diff -Naur ppp-2.4.4.orig/pppd/options.c ppp-2.4.4/pppd/options.c
|
||||
--- ppp-2.4.4.orig/pppd/options.c 2006-06-18 07:26:00.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/options.c 2009-05-07 15:47:29.000000000 -0400
|
||||
@@ -113,6 +113,8 @@
|
||||
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 */
|
||||
+char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */
|
||||
+char path_ipdown[MAXPATHLEN];/* pathname of ip-down script */
|
||||
bool multilink = 0; /* Enable multilink operation */
|
||||
char *bundle_name = NULL; /* bundle name for multilink */
|
||||
bool dump_options; /* print out option values */
|
||||
@@ -281,6 +283,13 @@
|
||||
"Number of seconds to wait for child processes at exit",
|
||||
OPT_PRIO },
|
||||
|
||||
+ { "ip-up-script", o_string, path_ipup,
|
||||
+ "Set pathname of ip-up script",
|
||||
+ OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
|
||||
+ { "ip-down-script", o_string, path_ipdown,
|
||||
+ "Set pathname of ip-down script",
|
||||
+ OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
|
||||
+
|
||||
#ifdef HAVE_MULTILINK
|
||||
{ "multilink", o_bool, &multilink,
|
||||
"Enable multilink operation", OPT_PRIO | 1 },
|
||||
diff -Naur ppp-2.4.4.orig/pppd/pppd.h ppp-2.4.4/pppd/pppd.h
|
||||
--- ppp-2.4.4.orig/pppd/pppd.h 2005-08-25 19:59:34.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/pppd.h 2009-05-07 15:47:29.000000000 -0400
|
||||
@@ -312,6 +312,8 @@
|
||||
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 char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */
|
||||
+extern char path_ipdown[MAXPATHLEN]; /* pathname of ip-down script */
|
||||
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 -Naur ppp-2.4.4.orig/pppd/ipcp.c ppp-2.4.4/pppd/ipcp.c
|
||||
--- ppp-2.4.4.orig/pppd/ipcp.c 2005-08-25 19:59:34.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/ipcp.c 2009-05-07 15:47:29.000000000 -0400
|
||||
@@ -1850,7 +1850,7 @@
|
||||
*/
|
||||
if (ipcp_script_state == s_down && ipcp_script_pid == 0) {
|
||||
ipcp_script_state = s_up;
|
||||
- ipcp_script(_PATH_IPUP, 0);
|
||||
+ ipcp_script(path_ipup, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1900,7 +1900,7 @@
|
||||
/* Execute the ip-down script */
|
||||
if (ipcp_script_state == s_up && ipcp_script_pid == 0) {
|
||||
ipcp_script_state = s_down;
|
||||
- ipcp_script(_PATH_IPDOWN, 0);
|
||||
+ ipcp_script(path_ipdown, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1954,13 +1954,13 @@
|
||||
case s_up:
|
||||
if (ipcp_fsm[0].state != OPENED) {
|
||||
ipcp_script_state = s_down;
|
||||
- ipcp_script(_PATH_IPDOWN, 0);
|
||||
+ ipcp_script(path_ipdown, 0);
|
||||
}
|
||||
break;
|
||||
case s_down:
|
||||
if (ipcp_fsm[0].state == OPENED) {
|
||||
ipcp_script_state = s_up;
|
||||
- ipcp_script(_PATH_IPUP, 0);
|
||||
+ ipcp_script(path_ipup, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
diff -Naur ppp-2.4.4.orig/pppd/main.c ppp-2.4.4/pppd/main.c
|
||||
--- ppp-2.4.4.orig/pppd/main.c 2006-06-03 23:52:50.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/main.c 2009-05-07 15:47:29.000000000 -0400
|
||||
@@ -315,6 +315,9 @@
|
||||
struct protent *protp;
|
||||
char numbuf[16];
|
||||
|
||||
+ strlcpy(path_ipup, _PATH_IPUP, sizeof(path_ipup));
|
||||
+ strlcpy(path_ipdown, _PATH_IPDOWN, sizeof(path_ipdown));
|
||||
+
|
||||
link_stats_valid = 0;
|
||||
new_phase(PHASE_INITIALIZE);
|
||||
|
||||
diff -Naur ppp-2.4.4.orig/pppd/options.c ppp-2.4.4/pppd/options.c
|
||||
--- ppp-2.4.4.orig/pppd/options.c 2006-06-18 07:26:00.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/options.c 2009-05-07 15:47:29.000000000 -0400
|
||||
@@ -113,6 +113,8 @@
|
||||
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 */
|
||||
+char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */
|
||||
+char path_ipdown[MAXPATHLEN];/* pathname of ip-down script */
|
||||
bool multilink = 0; /* Enable multilink operation */
|
||||
char *bundle_name = NULL; /* bundle name for multilink */
|
||||
bool dump_options; /* print out option values */
|
||||
@@ -281,6 +283,13 @@
|
||||
"Number of seconds to wait for child processes at exit",
|
||||
OPT_PRIO },
|
||||
|
||||
+ { "ip-up-script", o_string, path_ipup,
|
||||
+ "Set pathname of ip-up script",
|
||||
+ OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
|
||||
+ { "ip-down-script", o_string, path_ipdown,
|
||||
+ "Set pathname of ip-down script",
|
||||
+ OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
|
||||
+
|
||||
#ifdef HAVE_MULTILINK
|
||||
{ "multilink", o_bool, &multilink,
|
||||
"Enable multilink operation", OPT_PRIO | 1 },
|
||||
diff -Naur ppp-2.4.4.orig/pppd/pppd.h ppp-2.4.4/pppd/pppd.h
|
||||
--- ppp-2.4.4.orig/pppd/pppd.h 2005-08-25 19:59:34.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/pppd.h 2009-05-07 15:47:29.000000000 -0400
|
||||
@@ -312,6 +312,8 @@
|
||||
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 char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */
|
||||
+extern char path_ipdown[MAXPATHLEN]; /* pathname of ip-down script */
|
||||
extern bool multilink; /* enable multilink operation */
|
||||
extern bool noendpoint; /* don't send or accept endpt. discrim. */
|
||||
extern char *bundle_name; /* bundle name for multilink */
|
34
package/ppp/patches/101-debian_close_dev_ppp.patch
Normal file
34
package/ppp/patches/101-debian_close_dev_ppp.patch
Normal file
@ -0,0 +1,34 @@
|
||||
diff -Naur ppp-2.4.4.orig/pppd/sys-linux.c ppp-2.4.4/pppd/sys-linux.c
|
||||
--- ppp-2.4.4.orig/pppd/sys-linux.c 2005-08-26 18:44:35.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/sys-linux.c 2009-05-07 15:50:00.000000000 -0400
|
||||
@@ -453,6 +453,13 @@
|
||||
if (new_style_driver) {
|
||||
int flags;
|
||||
|
||||
+ /* if a ppp_fd is already open, close it first */
|
||||
+ if(ppp_fd > 0) {
|
||||
+ close(ppp_fd);
|
||||
+ remove_fd(ppp_fd);
|
||||
+ ppp_fd = -1;
|
||||
+ }
|
||||
+
|
||||
/* Open an instance of /dev/ppp and connect the channel to it */
|
||||
if (ioctl(fd, PPPIOCGCHAN, &chindex) == -1) {
|
||||
error("Couldn't get channel number: %m");
|
||||
diff -Naur ppp-2.4.4.orig/pppd/sys-linux.c ppp-2.4.4/pppd/sys-linux.c
|
||||
--- ppp-2.4.4.orig/pppd/sys-linux.c 2005-08-26 18:44:35.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/sys-linux.c 2009-05-07 15:50:00.000000000 -0400
|
||||
@@ -453,6 +453,13 @@
|
||||
if (new_style_driver) {
|
||||
int flags;
|
||||
|
||||
+ /* if a ppp_fd is already open, close it first */
|
||||
+ if(ppp_fd > 0) {
|
||||
+ close(ppp_fd);
|
||||
+ remove_fd(ppp_fd);
|
||||
+ ppp_fd = -1;
|
||||
+ }
|
||||
+
|
||||
/* Open an instance of /dev/ppp and connect the channel to it */
|
||||
if (ioctl(fd, PPPIOCGCHAN, &chindex) == -1) {
|
||||
error("Couldn't get channel number: %m");
|
@ -1,92 +0,0 @@
|
||||
Index: ppp-2.4.3/pppd/ipcp.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/ipcp.c 2007-06-04 13:22:08.478566344 +0200
|
||||
+++ ppp-2.4.3/pppd/ipcp.c 2007-06-04 13:22:09.003486544 +0200
|
||||
@@ -1846,7 +1846,7 @@
|
||||
*/
|
||||
if (ipcp_script_state == s_down && ipcp_script_pid == 0) {
|
||||
ipcp_script_state = s_up;
|
||||
- ipcp_script(_PATH_IPUP);
|
||||
+ ipcp_script(path_ipup);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1896,7 +1896,7 @@
|
||||
/* Execute the ip-down script */
|
||||
if (ipcp_script_state == s_up && ipcp_script_pid == 0) {
|
||||
ipcp_script_state = s_down;
|
||||
- ipcp_script(_PATH_IPDOWN);
|
||||
+ ipcp_script(path_ipdown);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1950,13 +1950,13 @@
|
||||
case s_up:
|
||||
if (ipcp_fsm[0].state != OPENED) {
|
||||
ipcp_script_state = s_down;
|
||||
- ipcp_script(_PATH_IPDOWN);
|
||||
+ ipcp_script(path_ipdown);
|
||||
}
|
||||
break;
|
||||
case s_down:
|
||||
if (ipcp_fsm[0].state == OPENED) {
|
||||
ipcp_script_state = s_up;
|
||||
- ipcp_script(_PATH_IPUP);
|
||||
+ ipcp_script(path_ipup);
|
||||
}
|
||||
break;
|
||||
}
|
||||
Index: ppp-2.4.3/pppd/main.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/main.c 2007-06-04 13:22:08.487564976 +0200
|
||||
+++ ppp-2.4.3/pppd/main.c 2007-06-04 13:22:09.004486392 +0200
|
||||
@@ -314,6 +314,9 @@
|
||||
struct protent *protp;
|
||||
char numbuf[16];
|
||||
|
||||
+ strlcpy(path_ipup, _PATH_IPUP, sizeof(path_ipup));
|
||||
+ strlcpy(path_ipdown, _PATH_IPDOWN, sizeof(path_ipdown));
|
||||
+
|
||||
link_stats_valid = 0;
|
||||
new_phase(PHASE_INITIALIZE);
|
||||
|
||||
Index: ppp-2.4.3/pppd/options.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/options.c 2007-06-04 13:22:08.495563760 +0200
|
||||
+++ ppp-2.4.3/pppd/options.c 2007-06-04 13:22:09.005486240 +0200
|
||||
@@ -108,6 +108,8 @@
|
||||
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 */
|
||||
+char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */
|
||||
+char path_ipdown[MAXPATHLEN];/* pathname of ip-down script */
|
||||
bool multilink = 0; /* Enable multilink operation */
|
||||
char *bundle_name = NULL; /* bundle name for multilink */
|
||||
bool dump_options; /* print out option values */
|
||||
@@ -276,6 +278,13 @@
|
||||
"Number of seconds to wait for child processes at exit",
|
||||
OPT_PRIO },
|
||||
|
||||
+ { "ip-up-script", o_string, path_ipup,
|
||||
+ "Set pathname of ip-up script",
|
||||
+ OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
|
||||
+ { "ip-down-script", o_string, path_ipdown,
|
||||
+ "Set pathname of ip-down script",
|
||||
+ OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
|
||||
+
|
||||
#ifdef HAVE_MULTILINK
|
||||
{ "multilink", o_bool, &multilink,
|
||||
"Enable multilink operation", OPT_PRIO | 1 },
|
||||
Index: ppp-2.4.3/pppd/pppd.h
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/pppd.h 2007-06-04 13:22:08.505562240 +0200
|
||||
+++ ppp-2.4.3/pppd/pppd.h 2007-06-04 13:22:09.005486240 +0200
|
||||
@@ -312,6 +312,8 @@
|
||||
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 char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */
|
||||
+extern char path_ipdown[MAXPATHLEN]; /* pathname of ip-down script */
|
||||
extern bool multilink; /* enable multilink operation */
|
||||
extern bool noendpoint; /* don't send or accept endpt. discrim. */
|
||||
extern char *bundle_name; /* bundle name for multilink */
|
40
package/ppp/patches/102-debian_fix_close_fd0.patch
Normal file
40
package/ppp/patches/102-debian_fix_close_fd0.patch
Normal file
@ -0,0 +1,40 @@
|
||||
diff -Naur ppp-2.4.4.orig/pppd/main.c ppp-2.4.4/pppd/main.c
|
||||
--- ppp-2.4.4.orig/pppd/main.c 2009-05-07 15:49:34.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/main.c 2009-05-07 15:53:42.000000000 -0400
|
||||
@@ -1570,6 +1570,8 @@
|
||||
if (errfd == 0 || errfd == 1)
|
||||
errfd = dup(errfd);
|
||||
|
||||
+ closelog();
|
||||
+
|
||||
/* dup the in, out, err fds to 0, 1, 2 */
|
||||
if (infd != 0)
|
||||
dup2(infd, 0);
|
||||
@@ -1578,7 +1580,6 @@
|
||||
if (errfd != 2)
|
||||
dup2(errfd, 2);
|
||||
|
||||
- closelog();
|
||||
if (log_to_fd > 2)
|
||||
close(log_to_fd);
|
||||
if (the_channel->close)
|
||||
diff -Naur ppp-2.4.4.orig/pppd/main.c ppp-2.4.4/pppd/main.c
|
||||
--- ppp-2.4.4.orig/pppd/main.c 2009-05-07 15:49:34.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/main.c 2009-05-07 15:53:42.000000000 -0400
|
||||
@@ -1570,6 +1570,8 @@
|
||||
if (errfd == 0 || errfd == 1)
|
||||
errfd = dup(errfd);
|
||||
|
||||
+ closelog();
|
||||
+
|
||||
/* dup the in, out, err fds to 0, 1, 2 */
|
||||
if (infd != 0)
|
||||
dup2(infd, 0);
|
||||
@@ -1578,7 +1580,6 @@
|
||||
if (errfd != 2)
|
||||
dup2(errfd, 2);
|
||||
|
||||
- closelog();
|
||||
if (log_to_fd > 2)
|
||||
close(log_to_fd);
|
||||
if (the_channel->close)
|
@ -1,15 +0,0 @@
|
||||
Index: ppp-2.4.3/pppd/plugins/rp-pppoe/discovery.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/plugins/rp-pppoe/discovery.c 2007-06-04 13:22:08.458569384 +0200
|
||||
+++ ppp-2.4.3/pppd/plugins/rp-pppoe/discovery.c 2007-06-04 13:22:09.225452800 +0200
|
||||
@@ -365,8 +365,8 @@
|
||||
if (!packetIsForMe(conn, &packet)) continue;
|
||||
|
||||
if (packet.code == CODE_PADO) {
|
||||
- if (NOT_UNICAST(packet.ethHdr.h_source)) {
|
||||
- printErr("Ignoring PADO packet from non-unicast MAC address");
|
||||
+ if (BROADCAST(packet.ethHdr.h_source)) {
|
||||
+ printErr("Ignoring PADO packet from broadcast MAC address");
|
||||
continue;
|
||||
}
|
||||
parsePacket(&packet, parsePADOTags, &pc);
|
26
package/ppp/patches/103-debian_fix_link_pidfile.patch
Normal file
26
package/ppp/patches/103-debian_fix_link_pidfile.patch
Normal file
@ -0,0 +1,26 @@
|
||||
diff -Naur ppp-2.4.4.orig/pppd/main.c ppp-2.4.4/pppd/main.c
|
||||
--- ppp-2.4.4.orig/pppd/main.c 2009-05-07 15:58:00.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/main.c 2009-05-07 15:58:19.000000000 -0400
|
||||
@@ -772,8 +772,7 @@
|
||||
/* update pid files if they have been written already */
|
||||
if (pidfilename[0])
|
||||
create_pidfile(pid);
|
||||
- if (linkpidfile[0])
|
||||
- create_linkpidfile(pid);
|
||||
+ create_linkpidfile(pid);
|
||||
exit(0); /* parent dies */
|
||||
}
|
||||
setsid();
|
||||
diff -Naur ppp-2.4.4.orig/pppd/main.c ppp-2.4.4/pppd/main.c
|
||||
--- ppp-2.4.4.orig/pppd/main.c 2009-05-07 15:58:00.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/main.c 2009-05-07 15:58:19.000000000 -0400
|
||||
@@ -772,8 +772,7 @@
|
||||
/* update pid files if they have been written already */
|
||||
if (pidfilename[0])
|
||||
create_pidfile(pid);
|
||||
- if (linkpidfile[0])
|
||||
- create_linkpidfile(pid);
|
||||
+ create_linkpidfile(pid);
|
||||
exit(0); /* parent dies */
|
||||
}
|
||||
setsid();
|
File diff suppressed because it is too large
Load Diff
@ -1,39 +0,0 @@
|
||||
Subject: Bug#284382: ppp: linkpidfile is not created upon detachment
|
||||
From: <herbert@gondor.apana.org.au>
|
||||
|
||||
Package: ppp
|
||||
Version: 2.4.2+20040428-2
|
||||
Severity: wishlist
|
||||
|
||||
When pppd detaches from the parent normally, that is, without nodetach
|
||||
or updetach set, the linkpidfile is not created even when linkname is
|
||||
set.
|
||||
|
||||
This is because the create_linkpidfile call in detach() is only made
|
||||
if the linkpidfile is filled in. However, linkpidfile is never filled
|
||||
in until create_linkpidfile has been called.
|
||||
|
||||
IMHO the call should be made uncondtionally in detach() since
|
||||
create_linkpidfile does its own check on linkname anyway.
|
||||
|
||||
Please note that the version of pppd in woody always wrote the
|
||||
linkpidfile after detaching. It did so in main() however. That
|
||||
call has now been removed which is why I'm seeing this problem.
|
||||
|
||||
[...]
|
||||
|
||||
--
|
||||
Index: ppp-2.4.3/pppd/main.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/main.c 2007-06-04 13:22:09.004486392 +0200
|
||||
+++ ppp-2.4.3/pppd/main.c 2007-06-04 13:22:10.548251704 +0200
|
||||
@@ -768,8 +768,7 @@
|
||||
/* update pid files if they have been written already */
|
||||
if (pidfilename[0])
|
||||
create_pidfile(pid);
|
||||
- if (linkpidfile[0])
|
||||
- create_linkpidfile(pid);
|
||||
+ create_linkpidfile(pid);
|
||||
exit(0); /* parent dies */
|
||||
}
|
||||
setsid();
|
24
package/ppp/patches/104-debian_fix_mschapv2_ppp.patch
Normal file
24
package/ppp/patches/104-debian_fix_mschapv2_ppp.patch
Normal file
@ -0,0 +1,24 @@
|
||||
diff -Naur ppp-2.4.4.orig/pppd/chap_ms.c ppp-2.4.4/pppd/chap_ms.c
|
||||
--- ppp-2.4.4.orig/pppd/chap_ms.c 2006-05-21 07:56:40.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/chap_ms.c 2009-05-07 16:13:09.000000000 -0400
|
||||
@@ -852,7 +852,7 @@
|
||||
u_char *p = &response[MS_CHAP2_PEER_CHALLENGE];
|
||||
int i;
|
||||
|
||||
- BZERO(response, sizeof(*response));
|
||||
+ BZERO(response, MS_CHAP2_RESPONSE_LEN);
|
||||
|
||||
/* Generate the Peer-Challenge if requested, or copy it if supplied. */
|
||||
if (!PeerChallenge)
|
||||
diff -Naur ppp-2.4.4.orig/pppd/chap_ms.c ppp-2.4.4/pppd/chap_ms.c
|
||||
--- ppp-2.4.4.orig/pppd/chap_ms.c 2006-05-21 07:56:40.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/chap_ms.c 2009-05-07 16:13:09.000000000 -0400
|
||||
@@ -852,7 +852,7 @@
|
||||
u_char *p = &response[MS_CHAP2_PEER_CHALLENGE];
|
||||
int i;
|
||||
|
||||
- BZERO(response, sizeof(*response));
|
||||
+ BZERO(response, MS_CHAP2_RESPONSE_LEN);
|
||||
|
||||
/* Generate the Peer-Challenge if requested, or copy it if supplied. */
|
||||
if (!PeerChallenge)
|
352
package/ppp/patches/105-debian_demand.patch
Normal file
352
package/ppp/patches/105-debian_demand.patch
Normal file
@ -0,0 +1,352 @@
|
||||
diff -Naur ppp-2.4.4.orig/pppd/demand.c ppp-2.4.4/pppd/demand.c
|
||||
--- ppp-2.4.4.orig/pppd/demand.c 2005-08-25 08:14:18.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/demand.c 2009-05-07 16:16:20.000000000 -0400
|
||||
@@ -36,6 +36,8 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <netdb.h>
|
||||
+#include <unistd.h>
|
||||
+#include <syslog.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
@@ -43,6 +45,8 @@
|
||||
#include <sys/resource.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
+#include <netinet/in.h>
|
||||
+#include <arpa/inet.h>
|
||||
#ifdef PPP_FILTER
|
||||
#include <pcap-bpf.h>
|
||||
#endif
|
||||
@@ -221,6 +225,14 @@
|
||||
int c, rv;
|
||||
|
||||
rv = 0;
|
||||
+
|
||||
+/* check for synchronous connection... */
|
||||
+
|
||||
+ if ( (p[0] == 0xFF) && (p[1] == 0x03) ) {
|
||||
+ rv = loop_frame(p,n);
|
||||
+ return rv;
|
||||
+ }
|
||||
+
|
||||
for (; n > 0; --n) {
|
||||
c = *p++;
|
||||
if (c == PPP_FLAG) {
|
||||
@@ -299,17 +311,102 @@
|
||||
* loopback, now that the real serial link is up.
|
||||
*/
|
||||
void
|
||||
-demand_rexmit(proto)
|
||||
+demand_rexmit(proto, newip)
|
||||
int proto;
|
||||
+ u_int32_t newip;
|
||||
{
|
||||
struct packet *pkt, *prev, *nextpkt;
|
||||
+ unsigned short checksum;
|
||||
+ unsigned short pkt_checksum = 0;
|
||||
+ unsigned iphdr;
|
||||
+ struct timeval tv;
|
||||
+ char cv = 0;
|
||||
+ char ipstr[16];
|
||||
|
||||
prev = NULL;
|
||||
pkt = pend_q;
|
||||
pend_q = NULL;
|
||||
+ tv.tv_sec = 1;
|
||||
+ tv.tv_usec = 0;
|
||||
+ select(0,NULL,NULL,NULL,&tv); /* Sleep for 1 Seconds */
|
||||
for (; pkt != NULL; pkt = nextpkt) {
|
||||
nextpkt = pkt->next;
|
||||
if (PPP_PROTOCOL(pkt->data) == proto) {
|
||||
+ if ( (proto == PPP_IP) && newip ) {
|
||||
+ /* Get old checksum */
|
||||
+
|
||||
+ iphdr = (pkt->data[4] & 15) << 2;
|
||||
+ checksum = *((unsigned short *) (pkt->data+14));
|
||||
+ if (checksum == 0xFFFF) {
|
||||
+ checksum = 0;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ if (pkt->data[13] == 17) {
|
||||
+ pkt_checksum = *((unsigned short *) (pkt->data+10+iphdr));
|
||||
+ if (pkt_checksum) {
|
||||
+ cv = 1;
|
||||
+ if (pkt_checksum == 0xFFFF) {
|
||||
+ pkt_checksum = 0;
|
||||
+ }
|
||||
+ }
|
||||
+ else {
|
||||
+ cv = 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (pkt->data[13] == 6) {
|
||||
+ pkt_checksum = *((unsigned short *) (pkt->data+20+iphdr));
|
||||
+ cv = 1;
|
||||
+ if (pkt_checksum == 0xFFFF) {
|
||||
+ pkt_checksum = 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Delete old Source-IP-Address */
|
||||
+ checksum -= *((unsigned short *) (pkt->data+16)) ^ 0xFFFF;
|
||||
+ checksum -= *((unsigned short *) (pkt->data+18)) ^ 0xFFFF;
|
||||
+
|
||||
+ pkt_checksum -= *((unsigned short *) (pkt->data+16)) ^ 0xFFFF;
|
||||
+ pkt_checksum -= *((unsigned short *) (pkt->data+18)) ^ 0xFFFF;
|
||||
+
|
||||
+ /* Change Source-IP-Address */
|
||||
+ * ((u_int32_t *) (pkt->data + 16)) = newip;
|
||||
+
|
||||
+ /* Add new Source-IP-Address */
|
||||
+ checksum += *((unsigned short *) (pkt->data+16)) ^ 0xFFFF;
|
||||
+ checksum += *((unsigned short *) (pkt->data+18)) ^ 0xFFFF;
|
||||
+
|
||||
+ pkt_checksum += *((unsigned short *) (pkt->data+16)) ^ 0xFFFF;
|
||||
+ pkt_checksum += *((unsigned short *) (pkt->data+18)) ^ 0xFFFF;
|
||||
+
|
||||
+ /* Write new checksum */
|
||||
+ if (!checksum) {
|
||||
+ checksum = 0xFFFF;
|
||||
+ }
|
||||
+ *((unsigned short *) (pkt->data+14)) = checksum;
|
||||
+ if (pkt->data[13] == 6) {
|
||||
+ *((unsigned short *) (pkt->data+20+iphdr)) = pkt_checksum;
|
||||
+ }
|
||||
+ if (cv && (pkt->data[13] == 17) ) {
|
||||
+ *((unsigned short *) (pkt->data+10+iphdr)) = pkt_checksum;
|
||||
+ }
|
||||
+
|
||||
+ /* Log Packet */
|
||||
+ strcpy(ipstr,inet_ntoa(*( (struct in_addr *) (pkt->data+16))));
|
||||
+ if (pkt->data[13] == 1) {
|
||||
+ syslog(LOG_INFO,"Open ICMP %s -> %s\n",
|
||||
+ ipstr,
|
||||
+ inet_ntoa(*( (struct in_addr *) (pkt->data+20))));
|
||||
+ } else {
|
||||
+ syslog(LOG_INFO,"Open %s %s:%d -> %s:%d\n",
|
||||
+ pkt->data[13] == 6 ? "TCP" : "UDP",
|
||||
+ ipstr,
|
||||
+ ntohs(*( (short *) (pkt->data+iphdr+4))),
|
||||
+ inet_ntoa(*( (struct in_addr *) (pkt->data+20))),
|
||||
+ ntohs(*( (short *) (pkt->data+iphdr+6))));
|
||||
+ }
|
||||
+ }
|
||||
output(0, pkt->data, pkt->length);
|
||||
free(pkt);
|
||||
} else {
|
||||
diff -Naur ppp-2.4.4.orig/pppd/ipcp.c ppp-2.4.4/pppd/ipcp.c
|
||||
--- ppp-2.4.4.orig/pppd/ipcp.c 2009-05-07 15:49:34.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/ipcp.c 2009-05-07 16:16:20.000000000 -0400
|
||||
@@ -1776,7 +1776,7 @@
|
||||
proxy_arp_set[f->unit] = 1;
|
||||
|
||||
}
|
||||
- demand_rexmit(PPP_IP);
|
||||
+ demand_rexmit(PPP_IP,go->ouraddr);
|
||||
sifnpmode(f->unit, PPP_IP, NPMODE_PASS);
|
||||
|
||||
} else {
|
||||
diff -Naur ppp-2.4.4.orig/pppd/ipv6cp.c ppp-2.4.4/pppd/ipv6cp.c
|
||||
--- ppp-2.4.4.orig/pppd/ipv6cp.c 2005-08-25 19:59:34.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/ipv6cp.c 2009-05-07 16:16:20.000000000 -0400
|
||||
@@ -1232,7 +1232,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
- demand_rexmit(PPP_IPV6);
|
||||
+ demand_rexmit(PPP_IPV6,0);
|
||||
sifnpmode(f->unit, PPP_IPV6, NPMODE_PASS);
|
||||
|
||||
} else {
|
||||
diff -Naur ppp-2.4.4.orig/pppd/pppd.h ppp-2.4.4/pppd/pppd.h
|
||||
--- ppp-2.4.4.orig/pppd/pppd.h 2009-05-07 15:49:34.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/pppd.h 2009-05-07 16:16:20.000000000 -0400
|
||||
@@ -565,7 +565,7 @@
|
||||
void demand_block __P((void)); /* set all NPs to queue up packets */
|
||||
void demand_unblock __P((void)); /* set all NPs to pass packets */
|
||||
void demand_discard __P((void)); /* set all NPs to discard packets */
|
||||
-void demand_rexmit __P((int)); /* retransmit saved frames for an NP */
|
||||
+void demand_rexmit __P((int, u_int32_t)); /* retransmit saved frames for an NP*/
|
||||
int loop_chars __P((unsigned char *, int)); /* process chars from loopback */
|
||||
int loop_frame __P((unsigned char *, int)); /* should we bring link up? */
|
||||
|
||||
diff -Naur ppp-2.4.4.orig/pppd/demand.c ppp-2.4.4/pppd/demand.c
|
||||
--- ppp-2.4.4.orig/pppd/demand.c 2005-08-25 08:14:18.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/demand.c 2009-05-07 16:16:20.000000000 -0400
|
||||
@@ -36,6 +36,8 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <netdb.h>
|
||||
+#include <unistd.h>
|
||||
+#include <syslog.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
@@ -43,6 +45,8 @@
|
||||
#include <sys/resource.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
+#include <netinet/in.h>
|
||||
+#include <arpa/inet.h>
|
||||
#ifdef PPP_FILTER
|
||||
#include <pcap-bpf.h>
|
||||
#endif
|
||||
@@ -221,6 +225,14 @@
|
||||
int c, rv;
|
||||
|
||||
rv = 0;
|
||||
+
|
||||
+/* check for synchronous connection... */
|
||||
+
|
||||
+ if ( (p[0] == 0xFF) && (p[1] == 0x03) ) {
|
||||
+ rv = loop_frame(p,n);
|
||||
+ return rv;
|
||||
+ }
|
||||
+
|
||||
for (; n > 0; --n) {
|
||||
c = *p++;
|
||||
if (c == PPP_FLAG) {
|
||||
@@ -299,17 +311,102 @@
|
||||
* loopback, now that the real serial link is up.
|
||||
*/
|
||||
void
|
||||
-demand_rexmit(proto)
|
||||
+demand_rexmit(proto, newip)
|
||||
int proto;
|
||||
+ u_int32_t newip;
|
||||
{
|
||||
struct packet *pkt, *prev, *nextpkt;
|
||||
+ unsigned short checksum;
|
||||
+ unsigned short pkt_checksum = 0;
|
||||
+ unsigned iphdr;
|
||||
+ struct timeval tv;
|
||||
+ char cv = 0;
|
||||
+ char ipstr[16];
|
||||
|
||||
prev = NULL;
|
||||
pkt = pend_q;
|
||||
pend_q = NULL;
|
||||
+ tv.tv_sec = 1;
|
||||
+ tv.tv_usec = 0;
|
||||
+ select(0,NULL,NULL,NULL,&tv); /* Sleep for 1 Seconds */
|
||||
for (; pkt != NULL; pkt = nextpkt) {
|
||||
nextpkt = pkt->next;
|
||||
if (PPP_PROTOCOL(pkt->data) == proto) {
|
||||
+ if ( (proto == PPP_IP) && newip ) {
|
||||
+ /* Get old checksum */
|
||||
+
|
||||
+ iphdr = (pkt->data[4] & 15) << 2;
|
||||
+ checksum = *((unsigned short *) (pkt->data+14));
|
||||
+ if (checksum == 0xFFFF) {
|
||||
+ checksum = 0;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ if (pkt->data[13] == 17) {
|
||||
+ pkt_checksum = *((unsigned short *) (pkt->data+10+iphdr));
|
||||
+ if (pkt_checksum) {
|
||||
+ cv = 1;
|
||||
+ if (pkt_checksum == 0xFFFF) {
|
||||
+ pkt_checksum = 0;
|
||||
+ }
|
||||
+ }
|
||||
+ else {
|
||||
+ cv = 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (pkt->data[13] == 6) {
|
||||
+ pkt_checksum = *((unsigned short *) (pkt->data+20+iphdr));
|
||||
+ cv = 1;
|
||||
+ if (pkt_checksum == 0xFFFF) {
|
||||
+ pkt_checksum = 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Delete old Source-IP-Address */
|
||||
+ checksum -= *((unsigned short *) (pkt->data+16)) ^ 0xFFFF;
|
||||
+ checksum -= *((unsigned short *) (pkt->data+18)) ^ 0xFFFF;
|
||||
+
|
||||
+ pkt_checksum -= *((unsigned short *) (pkt->data+16)) ^ 0xFFFF;
|
||||
+ pkt_checksum -= *((unsigned short *) (pkt->data+18)) ^ 0xFFFF;
|
||||
+
|
||||
+ /* Change Source-IP-Address */
|
||||
+ * ((u_int32_t *) (pkt->data + 16)) = newip;
|
||||
+
|
||||
+ /* Add new Source-IP-Address */
|
||||
+ checksum += *((unsigned short *) (pkt->data+16)) ^ 0xFFFF;
|
||||
+ checksum += *((unsigned short *) (pkt->data+18)) ^ 0xFFFF;
|
||||
+
|
||||
+ pkt_checksum += *((unsigned short *) (pkt->data+16)) ^ 0xFFFF;
|
||||
+ pkt_checksum += *((unsigned short *) (pkt->data+18)) ^ 0xFFFF;
|
||||
+
|
||||
+ /* Write new checksum */
|
||||
+ if (!checksum) {
|
||||
+ checksum = 0xFFFF;
|
||||
+ }
|
||||
+ *((unsigned short *) (pkt->data+14)) = checksum;
|
||||
+ if (pkt->data[13] == 6) {
|
||||
+ *((unsigned short *) (pkt->data+20+iphdr)) = pkt_checksum;
|
||||
+ }
|
||||
+ if (cv && (pkt->data[13] == 17) ) {
|
||||
+ *((unsigned short *) (pkt->data+10+iphdr)) = pkt_checksum;
|
||||
+ }
|
||||
+
|
||||
+ /* Log Packet */
|
||||
+ strcpy(ipstr,inet_ntoa(*( (struct in_addr *) (pkt->data+16))));
|
||||
+ if (pkt->data[13] == 1) {
|
||||
+ syslog(LOG_INFO,"Open ICMP %s -> %s\n",
|
||||
+ ipstr,
|
||||
+ inet_ntoa(*( (struct in_addr *) (pkt->data+20))));
|
||||
+ } else {
|
||||
+ syslog(LOG_INFO,"Open %s %s:%d -> %s:%d\n",
|
||||
+ pkt->data[13] == 6 ? "TCP" : "UDP",
|
||||
+ ipstr,
|
||||
+ ntohs(*( (short *) (pkt->data+iphdr+4))),
|
||||
+ inet_ntoa(*( (struct in_addr *) (pkt->data+20))),
|
||||
+ ntohs(*( (short *) (pkt->data+iphdr+6))));
|
||||
+ }
|
||||
+ }
|
||||
output(0, pkt->data, pkt->length);
|
||||
free(pkt);
|
||||
} else {
|
||||
diff -Naur ppp-2.4.4.orig/pppd/ipcp.c ppp-2.4.4/pppd/ipcp.c
|
||||
--- ppp-2.4.4.orig/pppd/ipcp.c 2009-05-07 15:49:34.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/ipcp.c 2009-05-07 16:16:20.000000000 -0400
|
||||
@@ -1776,7 +1776,7 @@
|
||||
proxy_arp_set[f->unit] = 1;
|
||||
|
||||
}
|
||||
- demand_rexmit(PPP_IP);
|
||||
+ demand_rexmit(PPP_IP,go->ouraddr);
|
||||
sifnpmode(f->unit, PPP_IP, NPMODE_PASS);
|
||||
|
||||
} else {
|
||||
diff -Naur ppp-2.4.4.orig/pppd/ipv6cp.c ppp-2.4.4/pppd/ipv6cp.c
|
||||
--- ppp-2.4.4.orig/pppd/ipv6cp.c 2005-08-25 19:59:34.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/ipv6cp.c 2009-05-07 16:16:20.000000000 -0400
|
||||
@@ -1232,7 +1232,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
- demand_rexmit(PPP_IPV6);
|
||||
+ demand_rexmit(PPP_IPV6,0);
|
||||
sifnpmode(f->unit, PPP_IPV6, NPMODE_PASS);
|
||||
|
||||
} else {
|
||||
diff -Naur ppp-2.4.4.orig/pppd/pppd.h ppp-2.4.4/pppd/pppd.h
|
||||
--- ppp-2.4.4.orig/pppd/pppd.h 2009-05-07 15:49:34.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/pppd.h 2009-05-07 16:16:20.000000000 -0400
|
||||
@@ -565,7 +565,7 @@
|
||||
void demand_block __P((void)); /* set all NPs to queue up packets */
|
||||
void demand_unblock __P((void)); /* set all NPs to pass packets */
|
||||
void demand_discard __P((void)); /* set all NPs to discard packets */
|
||||
-void demand_rexmit __P((int)); /* retransmit saved frames for an NP */
|
||||
+void demand_rexmit __P((int, u_int32_t)); /* retransmit saved frames for an NP*/
|
||||
int loop_chars __P((unsigned char *, int)); /* process chars from loopback */
|
||||
int loop_frame __P((unsigned char *, int)); /* should we bring link up? */
|
||||
|
@ -1,96 +0,0 @@
|
||||
Index: ppp-2.4.3/pppd/plugins/pppoatm/pppoatm.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/plugins/pppoatm/pppoatm.c 2007-06-04 13:22:08.348586104 +0200
|
||||
+++ ppp-2.4.3/pppd/plugins/pppoatm/pppoatm.c 2007-06-04 13:22:10.825209600 +0200
|
||||
@@ -70,18 +70,20 @@
|
||||
{
|
||||
struct sockaddr_atmpvc addr;
|
||||
extern struct stat devstat;
|
||||
+
|
||||
if (device_got_set)
|
||||
return 0;
|
||||
- //info("PPPoATM setdevname_pppoatm: '%s'", cp);
|
||||
+
|
||||
memset(&addr, 0, sizeof addr);
|
||||
if (text2atm(cp, (struct sockaddr *) &addr, sizeof(addr),
|
||||
T2A_PVC | T2A_NAME) < 0) {
|
||||
- if(doit)
|
||||
- info("atm does not recognize: %s", cp);
|
||||
+ if (doit)
|
||||
+ info("cannot parse the ATM address: %s", cp);
|
||||
return 0;
|
||||
- }
|
||||
- if (!doit) return 1;
|
||||
- //if (!dev_set_ok()) return -1;
|
||||
+ }
|
||||
+ if (!doit)
|
||||
+ return 1;
|
||||
+
|
||||
memcpy(&pvcaddr, &addr, sizeof pvcaddr);
|
||||
strlcpy(devnam, cp, sizeof devnam);
|
||||
devstat.st_mode = S_IFSOCK;
|
||||
@@ -93,7 +95,6 @@
|
||||
lcp_allowoptions[0].neg_asyncmap = 0;
|
||||
lcp_wantoptions[0].neg_pcompression = 0;
|
||||
}
|
||||
- info("PPPoATM setdevname_pppoatm - SUCCESS:%s", cp);
|
||||
device_got_set = 1;
|
||||
return 1;
|
||||
}
|
||||
@@ -108,6 +109,7 @@
|
||||
static void set_line_discipline_pppoatm(int fd)
|
||||
{
|
||||
struct atm_backend_ppp be;
|
||||
+
|
||||
be.backend_num = ATM_BACKEND_PPP;
|
||||
if (!llc_encaps)
|
||||
be.encaps = PPPOATM_ENCAPS_VC;
|
||||
@@ -115,6 +117,7 @@
|
||||
be.encaps = PPPOATM_ENCAPS_LLC;
|
||||
else
|
||||
be.encaps = PPPOATM_ENCAPS_AUTODETECT;
|
||||
+
|
||||
if (ioctl(fd, ATM_SETBACKEND, &be) < 0)
|
||||
fatal("ioctl(ATM_SETBACKEND): %m");
|
||||
}
|
||||
@@ -175,16 +178,19 @@
|
||||
{
|
||||
int sock;
|
||||
struct ifreq ifr;
|
||||
+
|
||||
if (mtu > pppoatm_max_mtu)
|
||||
error("Couldn't increase MTU to %d", mtu);
|
||||
+
|
||||
sock = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (sock < 0)
|
||||
fatal("Couldn't create IP socket: %m");
|
||||
+
|
||||
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
|
||||
ifr.ifr_mtu = mtu;
|
||||
if (ioctl(sock, SIOCSIFMTU, (caddr_t) &ifr) < 0)
|
||||
fatal("ioctl(SIOCSIFMTU): %m");
|
||||
- (void) close (sock);
|
||||
+ close(sock);
|
||||
}
|
||||
|
||||
static void recv_config_pppoa(int mru,
|
||||
@@ -198,7 +204,7 @@
|
||||
|
||||
void plugin_init(void)
|
||||
{
|
||||
-#if defined(__linux__)
|
||||
+#ifdef linux
|
||||
extern int new_style_driver; /* From sys-linux.c */
|
||||
if (!ppp_available() && !new_style_driver)
|
||||
fatal("Kernel doesn't support ppp_generic - "
|
||||
@@ -206,9 +212,9 @@
|
||||
#else
|
||||
fatal("No PPPoATM support on this OS");
|
||||
#endif
|
||||
- info("PPPoATM plugin_init");
|
||||
add_options(pppoa_options);
|
||||
}
|
||||
+
|
||||
struct channel pppoa_channel = {
|
||||
options: pppoa_options,
|
||||
process_extra_options: NULL,
|
@ -1,32 +0,0 @@
|
||||
Index: ppp-2.4.3/pppd/plugins/pppoatm/pppoatm.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/plugins/pppoatm/pppoatm.c 2007-06-04 13:22:10.825209600 +0200
|
||||
+++ ppp-2.4.3/pppd/plugins/pppoatm/pppoatm.c 2007-06-04 13:22:11.014180872 +0200
|
||||
@@ -179,8 +179,11 @@
|
||||
int sock;
|
||||
struct ifreq ifr;
|
||||
|
||||
- if (mtu > pppoatm_max_mtu)
|
||||
- error("Couldn't increase MTU to %d", mtu);
|
||||
+ if (pppoatm_max_mtu && mtu > pppoatm_max_mtu) {
|
||||
+ warn("Couldn't increase MTU to %d. Using %d",
|
||||
+ mtu, pppoatm_max_mtu);
|
||||
+ mtu = pppoatm_max_mtu;
|
||||
+ }
|
||||
|
||||
sock = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (sock < 0)
|
||||
@@ -198,8 +201,11 @@
|
||||
int pcomp,
|
||||
int accomp)
|
||||
{
|
||||
- if (mru > pppoatm_max_mru)
|
||||
- error("Couldn't increase MRU to %d", mru);
|
||||
+ if (pppoatm_max_mru && mru > pppoatm_max_mru) {
|
||||
+ warn("Couldn't increase MRU to %d. Using %d",
|
||||
+ mru, pppoatm_max_mru);
|
||||
+ mru = pppoatm_max_mru;
|
||||
+ }
|
||||
}
|
||||
|
||||
void plugin_init(void)
|
70
package/ppp/patches/106-debian_stripMSdomain.patch
Normal file
70
package/ppp/patches/106-debian_stripMSdomain.patch
Normal file
@ -0,0 +1,70 @@
|
||||
diff -Naur ppp-2.4.4.orig/pppd/chap-new.c ppp-2.4.4/pppd/chap-new.c
|
||||
--- ppp-2.4.4.orig/pppd/chap-new.c 2005-07-13 06:41:58.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/chap-new.c 2009-05-07 16:18:37.000000000 -0400
|
||||
@@ -57,6 +57,7 @@
|
||||
int chap_timeout_time = 3;
|
||||
int chap_max_transmits = 10;
|
||||
int chap_rechallenge_time = 0;
|
||||
+int chapms_strip_domain = 0;
|
||||
|
||||
/*
|
||||
* Command-line options.
|
||||
@@ -68,6 +69,8 @@
|
||||
"Set max #xmits for challenge", OPT_PRIO },
|
||||
{ "chap-interval", o_int, &chap_rechallenge_time,
|
||||
"Set interval for rechallenge", OPT_PRIO },
|
||||
+ { "chapms-strip-domain", o_bool, &chapms_strip_domain,
|
||||
+ "Strip the domain prefix before the Username", 1 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@@ -335,6 +338,14 @@
|
||||
/* Null terminate and clean remote name. */
|
||||
slprintf(rname, sizeof(rname), "%.*v", len, name);
|
||||
name = rname;
|
||||
+
|
||||
+ /* strip the MS domain name */
|
||||
+ if (chapms_strip_domain && strrchr(rname, '\\')) {
|
||||
+ char tmp[MAXNAMELEN+1];
|
||||
+
|
||||
+ strcpy(tmp, strrchr(rname, '\\') + 1);
|
||||
+ strcpy(rname, tmp);
|
||||
+ }
|
||||
}
|
||||
|
||||
if (chap_verify_hook)
|
||||
diff -Naur ppp-2.4.4.orig/pppd/chap-new.c ppp-2.4.4/pppd/chap-new.c
|
||||
--- ppp-2.4.4.orig/pppd/chap-new.c 2005-07-13 06:41:58.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/chap-new.c 2009-05-07 16:18:37.000000000 -0400
|
||||
@@ -57,6 +57,7 @@
|
||||
int chap_timeout_time = 3;
|
||||
int chap_max_transmits = 10;
|
||||
int chap_rechallenge_time = 0;
|
||||
+int chapms_strip_domain = 0;
|
||||
|
||||
/*
|
||||
* Command-line options.
|
||||
@@ -68,6 +69,8 @@
|
||||
"Set max #xmits for challenge", OPT_PRIO },
|
||||
{ "chap-interval", o_int, &chap_rechallenge_time,
|
||||
"Set interval for rechallenge", OPT_PRIO },
|
||||
+ { "chapms-strip-domain", o_bool, &chapms_strip_domain,
|
||||
+ "Strip the domain prefix before the Username", 1 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@@ -335,6 +338,14 @@
|
||||
/* Null terminate and clean remote name. */
|
||||
slprintf(rname, sizeof(rname), "%.*v", len, name);
|
||||
name = rname;
|
||||
+
|
||||
+ /* strip the MS domain name */
|
||||
+ if (chapms_strip_domain && strrchr(rname, '\\')) {
|
||||
+ char tmp[MAXNAMELEN+1];
|
||||
+
|
||||
+ strcpy(tmp, strrchr(rname, '\\') + 1);
|
||||
+ strcpy(rname, tmp);
|
||||
+ }
|
||||
}
|
||||
|
||||
if (chap_verify_hook)
|
192
package/ppp/patches/107-debian_pppatm_cleanup.patch
Normal file
192
package/ppp/patches/107-debian_pppatm_cleanup.patch
Normal file
@ -0,0 +1,192 @@
|
||||
diff -Naur ppp-2.4.4.orig/pppd/plugins/pppoatm/pppoatm.c ppp-2.4.4/pppd/plugins/pppoatm/pppoatm.c
|
||||
--- ppp-2.4.4.orig/pppd/plugins/pppoatm/pppoatm.c 2006-05-21 08:44:41.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/plugins/pppoatm/pppoatm.c 2009-05-07 16:22:22.000000000 -0400
|
||||
@@ -70,18 +70,20 @@
|
||||
{
|
||||
struct sockaddr_atmpvc addr;
|
||||
extern struct stat devstat;
|
||||
+
|
||||
if (device_got_set)
|
||||
return 0;
|
||||
- //info("PPPoATM setdevname_pppoatm: '%s'", cp);
|
||||
+
|
||||
memset(&addr, 0, sizeof addr);
|
||||
if (text2atm(cp, (struct sockaddr *) &addr, sizeof(addr),
|
||||
- T2A_PVC | T2A_NAME) < 0) {
|
||||
- if(doit)
|
||||
- info("atm does not recognize: %s", cp);
|
||||
+ T2A_PVC | T2A_NAME | T2A_WILDCARD) < 0) {
|
||||
+ if (doit)
|
||||
+ info("cannot parse the ATM address: %s", cp);
|
||||
return 0;
|
||||
- }
|
||||
- if (!doit) return 1;
|
||||
- //if (!dev_set_ok()) return -1;
|
||||
+ }
|
||||
+ if (!doit)
|
||||
+ return 1;
|
||||
+
|
||||
memcpy(&pvcaddr, &addr, sizeof pvcaddr);
|
||||
strlcpy(devnam, cp, sizeof devnam);
|
||||
devstat.st_mode = S_IFSOCK;
|
||||
@@ -93,7 +95,6 @@
|
||||
lcp_allowoptions[0].neg_asyncmap = 0;
|
||||
lcp_wantoptions[0].neg_pcompression = 0;
|
||||
}
|
||||
- info("PPPoATM setdevname_pppoatm - SUCCESS:%s", cp);
|
||||
device_got_set = 1;
|
||||
return 1;
|
||||
}
|
||||
@@ -108,6 +109,7 @@
|
||||
static void set_line_discipline_pppoatm(int fd)
|
||||
{
|
||||
struct atm_backend_ppp be;
|
||||
+
|
||||
be.backend_num = ATM_BACKEND_PPP;
|
||||
if (!llc_encaps)
|
||||
be.encaps = PPPOATM_ENCAPS_VC;
|
||||
@@ -115,6 +117,7 @@
|
||||
be.encaps = PPPOATM_ENCAPS_LLC;
|
||||
else
|
||||
be.encaps = PPPOATM_ENCAPS_AUTODETECT;
|
||||
+
|
||||
if (ioctl(fd, ATM_SETBACKEND, &be) < 0)
|
||||
fatal("ioctl(ATM_SETBACKEND): %m");
|
||||
}
|
||||
@@ -175,16 +178,19 @@
|
||||
{
|
||||
int sock;
|
||||
struct ifreq ifr;
|
||||
+
|
||||
if (mtu > pppoatm_max_mtu)
|
||||
error("Couldn't increase MTU to %d", mtu);
|
||||
+
|
||||
sock = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (sock < 0)
|
||||
fatal("Couldn't create IP socket: %m");
|
||||
+
|
||||
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
|
||||
ifr.ifr_mtu = mtu;
|
||||
if (ioctl(sock, SIOCSIFMTU, (caddr_t) &ifr) < 0)
|
||||
fatal("ioctl(SIOCSIFMTU): %m");
|
||||
- (void) close (sock);
|
||||
+ close(sock);
|
||||
}
|
||||
|
||||
static void recv_config_pppoa(int mru,
|
||||
@@ -198,7 +204,7 @@
|
||||
|
||||
void plugin_init(void)
|
||||
{
|
||||
-#if defined(__linux__)
|
||||
+#ifdef linux
|
||||
extern int new_style_driver; /* From sys-linux.c */
|
||||
if (!ppp_available() && !new_style_driver)
|
||||
fatal("Kernel doesn't support ppp_generic - "
|
||||
@@ -206,9 +212,9 @@
|
||||
#else
|
||||
fatal("No PPPoATM support on this OS");
|
||||
#endif
|
||||
- info("PPPoATM plugin_init");
|
||||
add_options(pppoa_options);
|
||||
}
|
||||
+
|
||||
struct channel pppoa_channel = {
|
||||
options: pppoa_options,
|
||||
process_extra_options: NULL,
|
||||
diff -Naur ppp-2.4.4.orig/pppd/plugins/pppoatm/pppoatm.c ppp-2.4.4/pppd/plugins/pppoatm/pppoatm.c
|
||||
--- ppp-2.4.4.orig/pppd/plugins/pppoatm/pppoatm.c 2006-05-21 08:44:41.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/plugins/pppoatm/pppoatm.c 2009-05-07 16:22:22.000000000 -0400
|
||||
@@ -70,18 +70,20 @@
|
||||
{
|
||||
struct sockaddr_atmpvc addr;
|
||||
extern struct stat devstat;
|
||||
+
|
||||
if (device_got_set)
|
||||
return 0;
|
||||
- //info("PPPoATM setdevname_pppoatm: '%s'", cp);
|
||||
+
|
||||
memset(&addr, 0, sizeof addr);
|
||||
if (text2atm(cp, (struct sockaddr *) &addr, sizeof(addr),
|
||||
- T2A_PVC | T2A_NAME) < 0) {
|
||||
- if(doit)
|
||||
- info("atm does not recognize: %s", cp);
|
||||
+ T2A_PVC | T2A_NAME | T2A_WILDCARD) < 0) {
|
||||
+ if (doit)
|
||||
+ info("cannot parse the ATM address: %s", cp);
|
||||
return 0;
|
||||
- }
|
||||
- if (!doit) return 1;
|
||||
- //if (!dev_set_ok()) return -1;
|
||||
+ }
|
||||
+ if (!doit)
|
||||
+ return 1;
|
||||
+
|
||||
memcpy(&pvcaddr, &addr, sizeof pvcaddr);
|
||||
strlcpy(devnam, cp, sizeof devnam);
|
||||
devstat.st_mode = S_IFSOCK;
|
||||
@@ -93,7 +95,6 @@
|
||||
lcp_allowoptions[0].neg_asyncmap = 0;
|
||||
lcp_wantoptions[0].neg_pcompression = 0;
|
||||
}
|
||||
- info("PPPoATM setdevname_pppoatm - SUCCESS:%s", cp);
|
||||
device_got_set = 1;
|
||||
return 1;
|
||||
}
|
||||
@@ -108,6 +109,7 @@
|
||||
static void set_line_discipline_pppoatm(int fd)
|
||||
{
|
||||
struct atm_backend_ppp be;
|
||||
+
|
||||
be.backend_num = ATM_BACKEND_PPP;
|
||||
if (!llc_encaps)
|
||||
be.encaps = PPPOATM_ENCAPS_VC;
|
||||
@@ -115,6 +117,7 @@
|
||||
be.encaps = PPPOATM_ENCAPS_LLC;
|
||||
else
|
||||
be.encaps = PPPOATM_ENCAPS_AUTODETECT;
|
||||
+
|
||||
if (ioctl(fd, ATM_SETBACKEND, &be) < 0)
|
||||
fatal("ioctl(ATM_SETBACKEND): %m");
|
||||
}
|
||||
@@ -175,16 +178,19 @@
|
||||
{
|
||||
int sock;
|
||||
struct ifreq ifr;
|
||||
+
|
||||
if (mtu > pppoatm_max_mtu)
|
||||
error("Couldn't increase MTU to %d", mtu);
|
||||
+
|
||||
sock = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (sock < 0)
|
||||
fatal("Couldn't create IP socket: %m");
|
||||
+
|
||||
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
|
||||
ifr.ifr_mtu = mtu;
|
||||
if (ioctl(sock, SIOCSIFMTU, (caddr_t) &ifr) < 0)
|
||||
fatal("ioctl(SIOCSIFMTU): %m");
|
||||
- (void) close (sock);
|
||||
+ close(sock);
|
||||
}
|
||||
|
||||
static void recv_config_pppoa(int mru,
|
||||
@@ -198,7 +204,7 @@
|
||||
|
||||
void plugin_init(void)
|
||||
{
|
||||
-#if defined(__linux__)
|
||||
+#ifdef linux
|
||||
extern int new_style_driver; /* From sys-linux.c */
|
||||
if (!ppp_available() && !new_style_driver)
|
||||
fatal("Kernel doesn't support ppp_generic - "
|
||||
@@ -206,9 +212,9 @@
|
||||
#else
|
||||
fatal("No PPPoATM support on this OS");
|
||||
#endif
|
||||
- info("PPPoATM plugin_init");
|
||||
add_options(pppoa_options);
|
||||
}
|
||||
+
|
||||
struct channel pppoa_channel = {
|
||||
options: pppoa_options,
|
||||
process_extra_options: NULL,
|
@ -1,36 +0,0 @@
|
||||
Index: ppp-2.4.3/pppd/chap-new.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/chap-new.c 2007-06-04 13:22:08.298593704 +0200
|
||||
+++ ppp-2.4.3/pppd/chap-new.c 2007-06-04 13:22:11.199152752 +0200
|
||||
@@ -57,6 +57,7 @@
|
||||
int chap_timeout_time = 3;
|
||||
int chap_max_transmits = 10;
|
||||
int chap_rechallenge_time = 0;
|
||||
+int chapms_strip_domain = 0;
|
||||
|
||||
/*
|
||||
* Command-line options.
|
||||
@@ -68,6 +69,8 @@
|
||||
"Set max #xmits for challenge", OPT_PRIO },
|
||||
{ "chap-interval", o_int, &chap_rechallenge_time,
|
||||
"Set interval for rechallenge", OPT_PRIO },
|
||||
+ { "chapms-strip-domain", o_bool, &chapms_strip_domain,
|
||||
+ "Strip the domain prefix before the Username", 1 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@@ -338,6 +341,14 @@
|
||||
/* Null terminate and clean remote name. */
|
||||
slprintf(rname, sizeof(rname), "%.*v", len, name);
|
||||
name = rname;
|
||||
+
|
||||
+ /* strip the MS domain name */
|
||||
+ if (chapms_strip_domain && strrchr(rname, '\\')) {
|
||||
+ char tmp[MAXNAMELEN+1];
|
||||
+
|
||||
+ strcpy(tmp, strrchr(rname, '\\') + 1);
|
||||
+ strcpy(rname, tmp);
|
||||
+ }
|
||||
}
|
||||
|
||||
if (chap_verify_hook)
|
@ -1,264 +0,0 @@
|
||||
Index: ppp-2.4.3/pppd/ipcp.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/ipcp.c 2007-06-04 13:22:09.003486544 +0200
|
||||
+++ ppp-2.4.3/pppd/ipcp.c 2007-06-04 13:22:11.387124176 +0200
|
||||
@@ -197,6 +197,16 @@
|
||||
"disable defaultroute option", OPT_ALIAS | OPT_A2CLR,
|
||||
&ipcp_wantoptions[0].default_route },
|
||||
|
||||
+#ifdef __linux__
|
||||
+ { "replacedefaultroute", o_bool,
|
||||
+ &ipcp_wantoptions[0].replace_default_route,
|
||||
+ "Replace default route", 1
|
||||
+ },
|
||||
+ { "noreplacedefaultroute", o_bool,
|
||||
+ &ipcp_allowoptions[0].replace_default_route,
|
||||
+ "Never replace default route", OPT_A2COPY,
|
||||
+ &ipcp_wantoptions[0].replace_default_route },
|
||||
+#endif
|
||||
{ "proxyarp", o_bool, &ipcp_wantoptions[0].proxy_arp,
|
||||
"Add proxy ARP entry", OPT_ENABLE|1, &ipcp_allowoptions[0].proxy_arp },
|
||||
{ "noproxyarp", o_bool, &ipcp_allowoptions[0].proxy_arp,
|
||||
@@ -263,7 +273,7 @@
|
||||
ip_active_pkt
|
||||
};
|
||||
|
||||
-static void ipcp_clear_addrs __P((int, u_int32_t, u_int32_t));
|
||||
+static void ipcp_clear_addrs __P((int, u_int32_t, u_int32_t, bool));
|
||||
static void ipcp_script __P((char *)); /* Run an up/down script */
|
||||
static void ipcp_script_done __P((void *));
|
||||
|
||||
@@ -1659,7 +1669,12 @@
|
||||
if (!sifnpmode(u, PPP_IP, NPMODE_QUEUE))
|
||||
return 0;
|
||||
if (wo->default_route)
|
||||
+#ifndef __linux__
|
||||
if (sifdefaultroute(u, wo->ouraddr, wo->hisaddr))
|
||||
+#else
|
||||
+ if (sifdefaultroute(u, wo->ouraddr, wo->hisaddr,
|
||||
+ wo->replace_default_route))
|
||||
+#endif
|
||||
default_route_set[u] = 1;
|
||||
if (wo->proxy_arp)
|
||||
if (sifproxyarp(u, wo->hisaddr))
|
||||
@@ -1741,7 +1756,8 @@
|
||||
*/
|
||||
if (demand) {
|
||||
if (go->ouraddr != wo->ouraddr || ho->hisaddr != wo->hisaddr) {
|
||||
- ipcp_clear_addrs(f->unit, wo->ouraddr, wo->hisaddr);
|
||||
+ ipcp_clear_addrs(f->unit, wo->ouraddr, wo->hisaddr,
|
||||
+ wo->replace_default_route);
|
||||
if (go->ouraddr != wo->ouraddr) {
|
||||
warn("Local IP address changed to %I", go->ouraddr);
|
||||
script_setenv("OLDIPLOCAL", ip_ntoa(wo->ouraddr), 0);
|
||||
@@ -1766,7 +1782,12 @@
|
||||
|
||||
/* assign a default route through the interface if required */
|
||||
if (ipcp_wantoptions[f->unit].default_route)
|
||||
+#ifndef __linux__
|
||||
if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr))
|
||||
+#else
|
||||
+ if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr,
|
||||
+ wo->replace_default_route))
|
||||
+#endif
|
||||
default_route_set[f->unit] = 1;
|
||||
|
||||
/* Make a proxy ARP entry if requested. */
|
||||
@@ -1813,7 +1834,12 @@
|
||||
|
||||
/* assign a default route through the interface if required */
|
||||
if (ipcp_wantoptions[f->unit].default_route)
|
||||
+#ifndef __linux__
|
||||
if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr))
|
||||
+#else
|
||||
+ if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr,
|
||||
+ wo->replace_default_route))
|
||||
+#endif
|
||||
default_route_set[f->unit] = 1;
|
||||
|
||||
/* Make a proxy ARP entry if requested. */
|
||||
@@ -1890,7 +1916,7 @@
|
||||
sifnpmode(f->unit, PPP_IP, NPMODE_DROP);
|
||||
sifdown(f->unit);
|
||||
ipcp_clear_addrs(f->unit, ipcp_gotoptions[f->unit].ouraddr,
|
||||
- ipcp_hisoptions[f->unit].hisaddr);
|
||||
+ ipcp_hisoptions[f->unit].hisaddr, 0);
|
||||
}
|
||||
|
||||
/* Execute the ip-down script */
|
||||
@@ -1906,16 +1932,25 @@
|
||||
* proxy arp entries, etc.
|
||||
*/
|
||||
static void
|
||||
-ipcp_clear_addrs(unit, ouraddr, hisaddr)
|
||||
+ipcp_clear_addrs(unit, ouraddr, hisaddr, replacedefaultroute)
|
||||
int unit;
|
||||
u_int32_t ouraddr; /* local address */
|
||||
u_int32_t hisaddr; /* remote address */
|
||||
+ bool replacedefaultroute;
|
||||
{
|
||||
if (proxy_arp_set[unit]) {
|
||||
cifproxyarp(unit, hisaddr);
|
||||
proxy_arp_set[unit] = 0;
|
||||
}
|
||||
- if (default_route_set[unit]) {
|
||||
+ /* If replacedefaultroute, sifdefaultroute will be called soon
|
||||
+ * with replacedefaultroute set and that will overwrite the current
|
||||
+ * default route. This is the case only when doing demand, otherwise
|
||||
+ * during demand, this cifdefaultroute would restore the old default
|
||||
+ * route which is not what we want in this case. In the non-demand
|
||||
+ * case, we'll delete the default route and restore the old if there
|
||||
+ * is one saved by an sifdefaultroute with replacedefaultroute.
|
||||
+ */
|
||||
+ if (!replacedefaultroute && default_route_set[unit]) {
|
||||
cifdefaultroute(unit, ouraddr, hisaddr);
|
||||
default_route_set[unit] = 0;
|
||||
}
|
||||
Index: ppp-2.4.3/pppd/ipcp.h
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/ipcp.h 2007-06-04 13:22:08.263599024 +0200
|
||||
+++ ppp-2.4.3/pppd/ipcp.h 2007-06-04 13:22:11.387124176 +0200
|
||||
@@ -70,6 +70,7 @@
|
||||
bool old_addrs; /* Use old (IP-Addresses) option? */
|
||||
bool req_addr; /* Ask peer to send IP address? */
|
||||
bool default_route; /* Assign default route through interface? */
|
||||
+ bool replace_default_route; /* Replace default route through interface? */
|
||||
bool proxy_arp; /* Make proxy ARP entry for peer? */
|
||||
bool neg_vj; /* Van Jacobson Compression? */
|
||||
bool old_vj; /* use old (short) form of VJ option? */
|
||||
Index: ppp-2.4.3/pppd/pppd.h
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/pppd.h 2007-06-04 13:22:09.005486240 +0200
|
||||
+++ ppp-2.4.3/pppd/pppd.h 2007-06-04 13:22:11.388124024 +0200
|
||||
@@ -642,7 +642,11 @@
|
||||
int cif6addr __P((int, eui64_t, eui64_t));
|
||||
/* Remove an IPv6 address from i/f */
|
||||
#endif
|
||||
+#ifndef __linux__
|
||||
int sifdefaultroute __P((int, u_int32_t, u_int32_t));
|
||||
+#else
|
||||
+int sifdefaultroute __P((int, u_int32_t, u_int32_t, bool replace_default_rt));
|
||||
+#endif
|
||||
/* Create default route through i/f */
|
||||
int cifdefaultroute __P((int, u_int32_t, u_int32_t));
|
||||
/* Delete default route through i/f */
|
||||
Index: ppp-2.4.3/pppd/sys-linux.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/sys-linux.c 2007-06-04 13:22:08.807516336 +0200
|
||||
+++ ppp-2.4.3/pppd/sys-linux.c 2007-06-04 13:22:11.389123872 +0200
|
||||
@@ -206,6 +206,8 @@
|
||||
|
||||
static int if_is_up; /* Interface has been marked up */
|
||||
static u_int32_t default_route_gateway; /* Gateway for default route added */
|
||||
+static struct rtentry old_def_rt; /* Old default route */
|
||||
+static int default_rt_repl_rest; /* replace and restore old default rt */
|
||||
static u_int32_t proxy_arp_addr; /* Addr for proxy arp entry added */
|
||||
static char proxy_arp_dev[16]; /* Device for proxy arp entry */
|
||||
static u_int32_t our_old_addr; /* for detecting address changes */
|
||||
@@ -1520,6 +1522,9 @@
|
||||
p = NULL;
|
||||
}
|
||||
|
||||
+ SET_SA_FAMILY (rt->rt_dst, AF_INET);
|
||||
+ SET_SA_FAMILY (rt->rt_gateway, AF_INET);
|
||||
+
|
||||
SIN_ADDR(rt->rt_dst) = strtoul(cols[route_dest_col], NULL, 16);
|
||||
SIN_ADDR(rt->rt_gateway) = strtoul(cols[route_gw_col], NULL, 16);
|
||||
SIN_ADDR(rt->rt_genmask) = strtoul(cols[route_mask_col], NULL, 16);
|
||||
@@ -1589,19 +1594,53 @@
|
||||
/********************************************************************
|
||||
*
|
||||
* sifdefaultroute - assign a default route through the address given.
|
||||
- */
|
||||
-
|
||||
-int sifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway)
|
||||
-{
|
||||
- struct rtentry rt;
|
||||
-
|
||||
- if (defaultroute_exists(&rt) && strcmp(rt.rt_dev, ifname) != 0) {
|
||||
- u_int32_t old_gateway = SIN_ADDR(rt.rt_gateway);
|
||||
-
|
||||
- if (old_gateway != gateway)
|
||||
- error("not replacing existing default route to %s [%I]",
|
||||
- rt.rt_dev, old_gateway);
|
||||
- return 0;
|
||||
+ *
|
||||
+ * If the global default_rt_repl_rest flag is set, then this function
|
||||
+ * already replaced the original system defaultroute with some other
|
||||
+ * route and it should just replace the current defaultroute with
|
||||
+ * another one, without saving the current route. Use: demand mode,
|
||||
+ * when pppd sets first a defaultroute it it's temporary ppp0 addresses
|
||||
+ * and then changes the temporary addresses to the addresses for the real
|
||||
+ * ppp connection when it has come up.
|
||||
+ */
|
||||
+
|
||||
+int sifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway, bool replace)
|
||||
+{
|
||||
+ struct rtentry rt, tmp_rt;
|
||||
+ struct rtentry *del_rt = NULL;
|
||||
+
|
||||
+
|
||||
+ if (default_rt_repl_rest) {
|
||||
+ /* We have already reclaced the original defaultroute, if we
|
||||
+ * are called again, we will delete the current default route
|
||||
+ * and set the new default route in this function.
|
||||
+ * - this is normally only the case the doing demand: */
|
||||
+ if (defaultroute_exists( &tmp_rt ))
|
||||
+ del_rt = &tmp_rt;
|
||||
+ } else if ( defaultroute_exists( &old_def_rt ) &&
|
||||
+ strcmp( old_def_rt.rt_dev, ifname ) != 0) {
|
||||
+ /* We did not yet replace an existing default route, let's
|
||||
+ * check if we should save and replace a default route:
|
||||
+ */
|
||||
+ u_int32_t old_gateway = SIN_ADDR(old_def_rt.rt_gateway);
|
||||
+
|
||||
+ if (old_gateway != gateway) {
|
||||
+ if (!replace) {
|
||||
+ error("not replacing default route to %s [%I]",
|
||||
+ old_def_rt.rt_dev, old_gateway);
|
||||
+ return 0;
|
||||
+ } else {
|
||||
+ // we need to copy rt_dev because we need it permanent too:
|
||||
+ char * tmp_dev = malloc(strlen(old_def_rt.rt_dev)+1);
|
||||
+ strcpy(tmp_dev, old_def_rt.rt_dev);
|
||||
+ old_def_rt.rt_dev = tmp_dev;
|
||||
+
|
||||
+ notice("replacing old default route to %s [%I]",
|
||||
+ old_def_rt.rt_dev, old_gateway);
|
||||
+ default_rt_repl_rest = 1;
|
||||
+ del_rt = &old_def_rt;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
memset (&rt, '\0', sizeof (rt));
|
||||
@@ -1623,6 +1662,12 @@
|
||||
error("default route ioctl(SIOCADDRT): %m");
|
||||
return 0;
|
||||
}
|
||||
+ if (default_rt_repl_rest && del_rt)
|
||||
+ if (ioctl(sock_fd, SIOCDELRT, del_rt) < 0) {
|
||||
+ if ( ! ok_error ( errno ))
|
||||
+ error("del old default route ioctl(SIOCDELRT): %m(%d)", errno);
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
default_route_gateway = gateway;
|
||||
return 1;
|
||||
@@ -1658,6 +1703,16 @@
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+ if (default_rt_repl_rest) {
|
||||
+ notice("restoring old default route to %s [%I]",
|
||||
+ old_def_rt.rt_dev, SIN_ADDR(old_def_rt.rt_gateway));
|
||||
+ if (ioctl(sock_fd, SIOCADDRT, &old_def_rt) < 0) {
|
||||
+ if ( ! ok_error ( errno ))
|
||||
+ error("restore default route ioctl(SIOCADDRT): %m(%d)", errno);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ default_rt_repl_rest = 0;
|
||||
+ }
|
||||
|
||||
return 1;
|
||||
}
|
62
package/ppp/patches/108-debian_pppatm_fix_mtu.patch
Normal file
62
package/ppp/patches/108-debian_pppatm_fix_mtu.patch
Normal file
@ -0,0 +1,62 @@
|
||||
diff -Naur ppp-2.4.4.orig/pppd/plugins/pppoatm/pppoatm.c ppp-2.4.4/pppd/plugins/pppoatm/pppoatm.c
|
||||
--- ppp-2.4.4.orig/pppd/plugins/pppoatm/pppoatm.c 2009-05-07 16:23:41.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/plugins/pppoatm/pppoatm.c 2009-05-07 16:23:57.000000000 -0400
|
||||
@@ -179,8 +179,11 @@
|
||||
int sock;
|
||||
struct ifreq ifr;
|
||||
|
||||
- if (mtu > pppoatm_max_mtu)
|
||||
- error("Couldn't increase MTU to %d", mtu);
|
||||
+ if (pppoatm_max_mtu && mtu > pppoatm_max_mtu) {
|
||||
+ warn("Couldn't increase MTU to %d. Using %d",
|
||||
+ mtu, pppoatm_max_mtu);
|
||||
+ mtu = pppoatm_max_mtu;
|
||||
+ }
|
||||
|
||||
sock = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (sock < 0)
|
||||
@@ -198,8 +201,11 @@
|
||||
int pcomp,
|
||||
int accomp)
|
||||
{
|
||||
- if (mru > pppoatm_max_mru)
|
||||
- error("Couldn't increase MRU to %d", mru);
|
||||
+ if (pppoatm_max_mru && mru > pppoatm_max_mru) {
|
||||
+ warn("Couldn't increase MRU to %d. Using %d",
|
||||
+ mru, pppoatm_max_mru);
|
||||
+ mru = pppoatm_max_mru;
|
||||
+ }
|
||||
}
|
||||
|
||||
void plugin_init(void)
|
||||
diff -Naur ppp-2.4.4.orig/pppd/plugins/pppoatm/pppoatm.c ppp-2.4.4/pppd/plugins/pppoatm/pppoatm.c
|
||||
--- ppp-2.4.4.orig/pppd/plugins/pppoatm/pppoatm.c 2009-05-07 16:23:41.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/plugins/pppoatm/pppoatm.c 2009-05-07 16:23:57.000000000 -0400
|
||||
@@ -179,8 +179,11 @@
|
||||
int sock;
|
||||
struct ifreq ifr;
|
||||
|
||||
- if (mtu > pppoatm_max_mtu)
|
||||
- error("Couldn't increase MTU to %d", mtu);
|
||||
+ if (pppoatm_max_mtu && mtu > pppoatm_max_mtu) {
|
||||
+ warn("Couldn't increase MTU to %d. Using %d",
|
||||
+ mtu, pppoatm_max_mtu);
|
||||
+ mtu = pppoatm_max_mtu;
|
||||
+ }
|
||||
|
||||
sock = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (sock < 0)
|
||||
@@ -198,8 +201,11 @@
|
||||
int pcomp,
|
||||
int accomp)
|
||||
{
|
||||
- if (mru > pppoatm_max_mru)
|
||||
- error("Couldn't increase MRU to %d", mru);
|
||||
+ if (pppoatm_max_mru && mru > pppoatm_max_mru) {
|
||||
+ warn("Couldn't increase MRU to %d. Using %d",
|
||||
+ mru, pppoatm_max_mru);
|
||||
+ mru = pppoatm_max_mru;
|
||||
+ }
|
||||
}
|
||||
|
||||
void plugin_init(void)
|
@ -1,180 +0,0 @@
|
||||
Index: ppp-2.4.3/pppd/demand.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/demand.c 2007-06-04 13:22:08.217606016 +0200
|
||||
+++ ppp-2.4.3/pppd/demand.c 2007-06-04 13:22:11.613089824 +0200
|
||||
@@ -36,6 +36,8 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <netdb.h>
|
||||
+#include <unistd.h>
|
||||
+#include <syslog.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
@@ -43,6 +45,8 @@
|
||||
#include <sys/resource.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
+#include <netinet/in.h>
|
||||
+#include <arpa/inet.h>
|
||||
#ifdef PPP_FILTER
|
||||
#include <pcap-bpf.h>
|
||||
#endif
|
||||
@@ -221,6 +225,14 @@
|
||||
int c, rv;
|
||||
|
||||
rv = 0;
|
||||
+
|
||||
+/* check for synchronous connection... */
|
||||
+
|
||||
+ if ( (p[0] == 0xFF) && (p[1] == 0x03) ) {
|
||||
+ rv = loop_frame(p,n);
|
||||
+ return rv;
|
||||
+ }
|
||||
+
|
||||
for (; n > 0; --n) {
|
||||
c = *p++;
|
||||
if (c == PPP_FLAG) {
|
||||
@@ -299,17 +311,102 @@
|
||||
* loopback, now that the real serial link is up.
|
||||
*/
|
||||
void
|
||||
-demand_rexmit(proto)
|
||||
+demand_rexmit(proto, newip)
|
||||
int proto;
|
||||
+ u_int32_t newip;
|
||||
{
|
||||
struct packet *pkt, *prev, *nextpkt;
|
||||
+ unsigned short checksum;
|
||||
+ unsigned short pkt_checksum = 0;
|
||||
+ unsigned iphdr;
|
||||
+ struct timeval tv;
|
||||
+ char cv = 0;
|
||||
+ char ipstr[16];
|
||||
|
||||
prev = NULL;
|
||||
pkt = pend_q;
|
||||
pend_q = NULL;
|
||||
+ tv.tv_sec = 1;
|
||||
+ tv.tv_usec = 0;
|
||||
+ select(0,NULL,NULL,NULL,&tv); /* Sleep for 1 Seconds */
|
||||
for (; pkt != NULL; pkt = nextpkt) {
|
||||
nextpkt = pkt->next;
|
||||
if (PPP_PROTOCOL(pkt->data) == proto) {
|
||||
+ if ( (proto == PPP_IP) && newip ) {
|
||||
+ /* Get old checksum */
|
||||
+
|
||||
+ iphdr = (pkt->data[4] & 15) << 2;
|
||||
+ checksum = *((unsigned short *) (pkt->data+14));
|
||||
+ if (checksum == 0xFFFF) {
|
||||
+ checksum = 0;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ if (pkt->data[13] == 17) {
|
||||
+ pkt_checksum = *((unsigned short *) (pkt->data+10+iphdr));
|
||||
+ if (pkt_checksum) {
|
||||
+ cv = 1;
|
||||
+ if (pkt_checksum == 0xFFFF) {
|
||||
+ pkt_checksum = 0;
|
||||
+ }
|
||||
+ }
|
||||
+ else {
|
||||
+ cv = 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (pkt->data[13] == 6) {
|
||||
+ pkt_checksum = *((unsigned short *) (pkt->data+20+iphdr));
|
||||
+ cv = 1;
|
||||
+ if (pkt_checksum == 0xFFFF) {
|
||||
+ pkt_checksum = 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Delete old Source-IP-Address */
|
||||
+ checksum -= *((unsigned short *) (pkt->data+16)) ^ 0xFFFF;
|
||||
+ checksum -= *((unsigned short *) (pkt->data+18)) ^ 0xFFFF;
|
||||
+
|
||||
+ pkt_checksum -= *((unsigned short *) (pkt->data+16)) ^ 0xFFFF;
|
||||
+ pkt_checksum -= *((unsigned short *) (pkt->data+18)) ^ 0xFFFF;
|
||||
+
|
||||
+ /* Change Source-IP-Address */
|
||||
+ * ((u_int32_t *) (pkt->data + 16)) = newip;
|
||||
+
|
||||
+ /* Add new Source-IP-Address */
|
||||
+ checksum += *((unsigned short *) (pkt->data+16)) ^ 0xFFFF;
|
||||
+ checksum += *((unsigned short *) (pkt->data+18)) ^ 0xFFFF;
|
||||
+
|
||||
+ pkt_checksum += *((unsigned short *) (pkt->data+16)) ^ 0xFFFF;
|
||||
+ pkt_checksum += *((unsigned short *) (pkt->data+18)) ^ 0xFFFF;
|
||||
+
|
||||
+ /* Write new checksum */
|
||||
+ if (!checksum) {
|
||||
+ checksum = 0xFFFF;
|
||||
+ }
|
||||
+ *((unsigned short *) (pkt->data+14)) = checksum;
|
||||
+ if (pkt->data[13] == 6) {
|
||||
+ *((unsigned short *) (pkt->data+20+iphdr)) = pkt_checksum;
|
||||
+ }
|
||||
+ if (cv && (pkt->data[13] == 17) ) {
|
||||
+ *((unsigned short *) (pkt->data+10+iphdr)) = pkt_checksum;
|
||||
+ }
|
||||
+
|
||||
+ /* Log Packet */
|
||||
+ strcpy(ipstr,inet_ntoa(*( (struct in_addr *) (pkt->data+16))));
|
||||
+ if (pkt->data[13] == 1) {
|
||||
+ syslog(LOG_INFO,"Open ICMP %s -> %s\n",
|
||||
+ ipstr,
|
||||
+ inet_ntoa(*( (struct in_addr *) (pkt->data+20))));
|
||||
+ } else {
|
||||
+ syslog(LOG_INFO,"Open %s %s:%d -> %s:%d\n",
|
||||
+ pkt->data[13] == 6 ? "TCP" : "UDP",
|
||||
+ ipstr,
|
||||
+ ntohs(*( (short *) (pkt->data+iphdr+4))),
|
||||
+ inet_ntoa(*( (struct in_addr *) (pkt->data+20))),
|
||||
+ ntohs(*( (short *) (pkt->data+iphdr+6))));
|
||||
+ }
|
||||
+ }
|
||||
output(0, pkt->data, pkt->length);
|
||||
free(pkt);
|
||||
} else {
|
||||
Index: ppp-2.4.3/pppd/ipcp.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/ipcp.c 2007-06-04 13:22:11.387124176 +0200
|
||||
+++ ppp-2.4.3/pppd/ipcp.c 2007-06-04 13:22:11.614089672 +0200
|
||||
@@ -1796,7 +1796,7 @@
|
||||
proxy_arp_set[f->unit] = 1;
|
||||
|
||||
}
|
||||
- demand_rexmit(PPP_IP);
|
||||
+ demand_rexmit(PPP_IP,go->ouraddr);
|
||||
sifnpmode(f->unit, PPP_IP, NPMODE_PASS);
|
||||
|
||||
} else {
|
||||
Index: ppp-2.4.3/pppd/ipv6cp.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/ipv6cp.c 2007-06-04 13:22:08.229604192 +0200
|
||||
+++ ppp-2.4.3/pppd/ipv6cp.c 2007-06-04 13:22:11.614089672 +0200
|
||||
@@ -1232,7 +1232,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
- demand_rexmit(PPP_IPV6);
|
||||
+ demand_rexmit(PPP_IPV6,0);
|
||||
sifnpmode(f->unit, PPP_IPV6, NPMODE_PASS);
|
||||
|
||||
} else {
|
||||
Index: ppp-2.4.3/pppd/pppd.h
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/pppd.h 2007-06-04 13:22:11.388124024 +0200
|
||||
+++ ppp-2.4.3/pppd/pppd.h 2007-06-04 13:22:11.615089520 +0200
|
||||
@@ -563,7 +563,7 @@
|
||||
void demand_block __P((void)); /* set all NPs to queue up packets */
|
||||
void demand_unblock __P((void)); /* set all NPs to pass packets */
|
||||
void demand_discard __P((void)); /* set all NPs to discard packets */
|
||||
-void demand_rexmit __P((int)); /* retransmit saved frames for an NP */
|
||||
+void demand_rexmit __P((int, u_int32_t)); /* retransmit saved frames for an NP*/
|
||||
int loop_chars __P((unsigned char *, int)); /* process chars from loopback */
|
||||
int loop_frame __P((unsigned char *, int)); /* should we bring link up? */
|
||||
|
2158
package/ppp/patches/109-debian_pppoe_cleanup.patch
Normal file
2158
package/ppp/patches/109-debian_pppoe_cleanup.patch
Normal file
File diff suppressed because it is too large
Load Diff
614
package/ppp/patches/110-debian_defaultroute.patch
Normal file
614
package/ppp/patches/110-debian_defaultroute.patch
Normal file
@ -0,0 +1,614 @@
|
||||
diff -Naur ppp-2.4.4.orig/pppd/ipcp.c ppp-2.4.4/pppd/ipcp.c
|
||||
--- ppp-2.4.4.orig/pppd/ipcp.c 2009-05-09 02:55:46.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/ipcp.c 2009-05-09 02:58:31.000000000 -0400
|
||||
@@ -197,6 +197,14 @@
|
||||
"disable defaultroute option", OPT_ALIAS | OPT_A2CLR,
|
||||
&ipcp_wantoptions[0].default_route },
|
||||
|
||||
+ { "replacedefaultroute", o_bool,
|
||||
+ &ipcp_wantoptions[0].replace_default_route,
|
||||
+ "Replace default route", 1
|
||||
+ },
|
||||
+ { "noreplacedefaultroute", o_bool,
|
||||
+ &ipcp_allowoptions[0].replace_default_route,
|
||||
+ "Never replace default route", OPT_A2COPY,
|
||||
+ &ipcp_wantoptions[0].replace_default_route },
|
||||
{ "proxyarp", o_bool, &ipcp_wantoptions[0].proxy_arp,
|
||||
"Add proxy ARP entry", OPT_ENABLE|1, &ipcp_allowoptions[0].proxy_arp },
|
||||
{ "noproxyarp", o_bool, &ipcp_allowoptions[0].proxy_arp,
|
||||
@@ -263,7 +271,7 @@
|
||||
ip_active_pkt
|
||||
};
|
||||
|
||||
-static void ipcp_clear_addrs __P((int, u_int32_t, u_int32_t));
|
||||
+static void ipcp_clear_addrs __P((int, u_int32_t, u_int32_t, bool));
|
||||
static void ipcp_script __P((char *, int)); /* Run an up/down script */
|
||||
static void ipcp_script_done __P((void *));
|
||||
|
||||
@@ -1660,7 +1668,8 @@
|
||||
if (!sifnpmode(u, PPP_IP, NPMODE_QUEUE))
|
||||
return 0;
|
||||
if (wo->default_route)
|
||||
- if (sifdefaultroute(u, wo->ouraddr, wo->hisaddr))
|
||||
+ if (sifdefaultroute(u, wo->ouraddr, wo->hisaddr,
|
||||
+ wo->replace_default_route))
|
||||
default_route_set[u] = 1;
|
||||
if (wo->proxy_arp)
|
||||
if (sifproxyarp(u, wo->hisaddr))
|
||||
@@ -1742,7 +1751,8 @@
|
||||
*/
|
||||
if (demand) {
|
||||
if (go->ouraddr != wo->ouraddr || ho->hisaddr != wo->hisaddr) {
|
||||
- ipcp_clear_addrs(f->unit, wo->ouraddr, wo->hisaddr);
|
||||
+ ipcp_clear_addrs(f->unit, wo->ouraddr, wo->hisaddr,
|
||||
+ wo->replace_default_route);
|
||||
if (go->ouraddr != wo->ouraddr) {
|
||||
warn("Local IP address changed to %I", go->ouraddr);
|
||||
script_setenv("OLDIPLOCAL", ip_ntoa(wo->ouraddr), 0);
|
||||
@@ -1767,7 +1777,8 @@
|
||||
|
||||
/* assign a default route through the interface if required */
|
||||
if (ipcp_wantoptions[f->unit].default_route)
|
||||
- if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr))
|
||||
+ if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr,
|
||||
+ wo->replace_default_route))
|
||||
default_route_set[f->unit] = 1;
|
||||
|
||||
/* Make a proxy ARP entry if requested. */
|
||||
@@ -1817,7 +1828,8 @@
|
||||
|
||||
/* assign a default route through the interface if required */
|
||||
if (ipcp_wantoptions[f->unit].default_route)
|
||||
- if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr))
|
||||
+ if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr,
|
||||
+ wo->replace_default_route))
|
||||
default_route_set[f->unit] = 1;
|
||||
|
||||
/* Make a proxy ARP entry if requested. */
|
||||
@@ -1894,7 +1906,7 @@
|
||||
sifnpmode(f->unit, PPP_IP, NPMODE_DROP);
|
||||
sifdown(f->unit);
|
||||
ipcp_clear_addrs(f->unit, ipcp_gotoptions[f->unit].ouraddr,
|
||||
- ipcp_hisoptions[f->unit].hisaddr);
|
||||
+ ipcp_hisoptions[f->unit].hisaddr, 0);
|
||||
}
|
||||
|
||||
/* Execute the ip-down script */
|
||||
@@ -1910,16 +1922,25 @@
|
||||
* proxy arp entries, etc.
|
||||
*/
|
||||
static void
|
||||
-ipcp_clear_addrs(unit, ouraddr, hisaddr)
|
||||
+ipcp_clear_addrs(unit, ouraddr, hisaddr, replacedefaultroute)
|
||||
int unit;
|
||||
u_int32_t ouraddr; /* local address */
|
||||
u_int32_t hisaddr; /* remote address */
|
||||
+ bool replacedefaultroute;
|
||||
{
|
||||
if (proxy_arp_set[unit]) {
|
||||
cifproxyarp(unit, hisaddr);
|
||||
proxy_arp_set[unit] = 0;
|
||||
}
|
||||
- if (default_route_set[unit]) {
|
||||
+ /* If replacedefaultroute, sifdefaultroute will be called soon
|
||||
+ * with replacedefaultroute set and that will overwrite the current
|
||||
+ * default route. This is the case only when doing demand, otherwise
|
||||
+ * during demand, this cifdefaultroute would restore the old default
|
||||
+ * route which is not what we want in this case. In the non-demand
|
||||
+ * case, we'll delete the default route and restore the old if there
|
||||
+ * is one saved by an sifdefaultroute with replacedefaultroute.
|
||||
+ */
|
||||
+ if (!replacedefaultroute && default_route_set[unit]) {
|
||||
cifdefaultroute(unit, ouraddr, hisaddr);
|
||||
default_route_set[unit] = 0;
|
||||
}
|
||||
diff -Naur ppp-2.4.4.orig/pppd/ipcp.h ppp-2.4.4/pppd/ipcp.h
|
||||
--- ppp-2.4.4.orig/pppd/ipcp.h 2009-05-09 02:54:59.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/ipcp.h 2009-05-09 02:58:31.000000000 -0400
|
||||
@@ -70,6 +70,7 @@
|
||||
bool old_addrs; /* Use old (IP-Addresses) option? */
|
||||
bool req_addr; /* Ask peer to send IP address? */
|
||||
bool default_route; /* Assign default route through interface? */
|
||||
+ bool replace_default_route; /* Replace default route through interface? */
|
||||
bool proxy_arp; /* Make proxy ARP entry for peer? */
|
||||
bool neg_vj; /* Van Jacobson Compression? */
|
||||
bool old_vj; /* use old (short) form of VJ option? */
|
||||
diff -Naur ppp-2.4.4.orig/pppd/pppd.8 ppp-2.4.4/pppd/pppd.8
|
||||
--- ppp-2.4.4.orig/pppd/pppd.8 2009-05-09 02:54:59.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/pppd.8 2009-05-09 02:58:31.000000000 -0400
|
||||
@@ -121,6 +121,11 @@
|
||||
This entry is removed when the PPP connection is broken. This option
|
||||
is privileged if the \fInodefaultroute\fR option has been specified.
|
||||
.TP
|
||||
+.B replacedefaultroute
|
||||
+This option is a flag to the defaultroute option. If defaultroute is
|
||||
+set and this flag is also set, pppd replaces an existing default route
|
||||
+with the new default route.
|
||||
+.TP
|
||||
.B disconnect \fIscript
|
||||
Execute the command specified by \fIscript\fR, by passing it to a
|
||||
shell, after
|
||||
@@ -706,7 +711,12 @@
|
||||
.TP
|
||||
.B nodefaultroute
|
||||
Disable the \fIdefaultroute\fR option. The system administrator who
|
||||
-wishes to prevent users from creating default routes with pppd
|
||||
+wishes to prevent users from adding a default route with pppd
|
||||
+can do so by placing this option in the /etc/ppp/options file.
|
||||
+.TP
|
||||
+.B noreplacedefaultroute
|
||||
+Disable the \fIreplacedefaultroute\fR option. The system administrator who
|
||||
+wishes to prevent users from replacing a default route with pppd
|
||||
can do so by placing this option in the /etc/ppp/options file.
|
||||
.TP
|
||||
.B nodeflate
|
||||
diff -Naur ppp-2.4.4.orig/pppd/pppd.h ppp-2.4.4/pppd/pppd.h
|
||||
--- ppp-2.4.4.orig/pppd/pppd.h 2009-05-09 02:55:46.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/pppd.h 2009-05-09 02:58:31.000000000 -0400
|
||||
@@ -644,7 +644,7 @@
|
||||
int cif6addr __P((int, eui64_t, eui64_t));
|
||||
/* Remove an IPv6 address from i/f */
|
||||
#endif
|
||||
-int sifdefaultroute __P((int, u_int32_t, u_int32_t));
|
||||
+int sifdefaultroute __P((int, u_int32_t, u_int32_t, bool replace_default_rt));
|
||||
/* Create default route through i/f */
|
||||
int cifdefaultroute __P((int, u_int32_t, u_int32_t));
|
||||
/* Delete default route through i/f */
|
||||
diff -Naur ppp-2.4.4.orig/pppd/sys-linux.c ppp-2.4.4/pppd/sys-linux.c
|
||||
--- ppp-2.4.4.orig/pppd/sys-linux.c 2009-05-09 02:55:46.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/sys-linux.c 2009-05-09 02:58:31.000000000 -0400
|
||||
@@ -206,6 +206,8 @@
|
||||
|
||||
static int if_is_up; /* Interface has been marked up */
|
||||
static int have_default_route; /* Gateway for default route added */
|
||||
+static struct rtentry old_def_rt; /* Old default route */
|
||||
+static int default_rt_repl_rest; /* replace and restore old default rt */
|
||||
static u_int32_t proxy_arp_addr; /* Addr for proxy arp entry added */
|
||||
static char proxy_arp_dev[16]; /* Device for proxy arp entry */
|
||||
static u_int32_t our_old_addr; /* for detecting address changes */
|
||||
@@ -1520,6 +1522,9 @@
|
||||
p = NULL;
|
||||
}
|
||||
|
||||
+ SET_SA_FAMILY (rt->rt_dst, AF_INET);
|
||||
+ SET_SA_FAMILY (rt->rt_gateway, AF_INET);
|
||||
+
|
||||
SIN_ADDR(rt->rt_dst) = strtoul(cols[route_dest_col], NULL, 16);
|
||||
SIN_ADDR(rt->rt_gateway) = strtoul(cols[route_gw_col], NULL, 16);
|
||||
SIN_ADDR(rt->rt_genmask) = strtoul(cols[route_mask_col], NULL, 16);
|
||||
@@ -1589,20 +1594,51 @@
|
||||
/********************************************************************
|
||||
*
|
||||
* sifdefaultroute - assign a default route through the address given.
|
||||
- */
|
||||
-
|
||||
-int sifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway)
|
||||
-{
|
||||
- struct rtentry rt;
|
||||
-
|
||||
- if (defaultroute_exists(&rt) && strcmp(rt.rt_dev, ifname) != 0) {
|
||||
- if (rt.rt_flags & RTF_GATEWAY)
|
||||
- error("not replacing existing default route via %I",
|
||||
- SIN_ADDR(rt.rt_gateway));
|
||||
- else
|
||||
+ *
|
||||
+ * If the global default_rt_repl_rest flag is set, then this function
|
||||
+ * already replaced the original system defaultroute with some other
|
||||
+ * route and it should just replace the current defaultroute with
|
||||
+ * another one, without saving the current route. Use: demand mode,
|
||||
+ * when pppd sets first a defaultroute it it's temporary ppp0 addresses
|
||||
+ * and then changes the temporary addresses to the addresses for the real
|
||||
+ * ppp connection when it has come up.
|
||||
+ */
|
||||
+
|
||||
+int sifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway, bool replace)
|
||||
+{
|
||||
+ struct rtentry rt, tmp_rt;
|
||||
+ struct rtentry *del_rt = NULL;
|
||||
+
|
||||
+ if (default_rt_repl_rest) {
|
||||
+ /* We have already reclaced the original defaultroute, if we
|
||||
+ are called again, we will delete the current default route
|
||||
+ and set the new default route in this function.
|
||||
+ - this is normally only the case the doing demand: */
|
||||
+ if (defaultroute_exists(&tmp_rt))
|
||||
+ del_rt = &tmp_rt;
|
||||
+ } else if (defaultroute_exists(&old_def_rt) &&
|
||||
+ strcmp(old_def_rt.rt_dev, ifname) != 0) {
|
||||
+ /* We did not yet replace an existing default route, let's
|
||||
+ check if we should save and replace a default route: */
|
||||
+ if (old_def_rt.rt_flags & RTF_GATEWAY) {
|
||||
+ if (!replace) {
|
||||
+ error("not replacing existing default route via %I",
|
||||
+ SIN_ADDR(old_def_rt.rt_gateway));
|
||||
+ return 0;
|
||||
+ } else {
|
||||
+ /* we need to copy rt_dev because we need it permanent too: */
|
||||
+ char *tmp_dev = malloc(strlen(old_def_rt.rt_dev) + 1);
|
||||
+ strcpy(tmp_dev, old_def_rt.rt_dev);
|
||||
+ old_def_rt.rt_dev = tmp_dev;
|
||||
+
|
||||
+ notice("replacing old default route to %s [%I]",
|
||||
+ old_def_rt.rt_dev, SIN_ADDR(old_def_rt.rt_gateway));
|
||||
+ default_rt_repl_rest = 1;
|
||||
+ del_rt = &old_def_rt;
|
||||
+ }
|
||||
+ } else
|
||||
error("not replacing existing default route through %s",
|
||||
- rt.rt_dev);
|
||||
- return 0;
|
||||
+ old_def_rt.rt_dev);
|
||||
}
|
||||
|
||||
memset (&rt, 0, sizeof (rt));
|
||||
@@ -1617,10 +1653,16 @@
|
||||
|
||||
rt.rt_flags = RTF_UP;
|
||||
if (ioctl(sock_fd, SIOCADDRT, &rt) < 0) {
|
||||
- if ( ! ok_error ( errno ))
|
||||
+ if (!ok_error(errno))
|
||||
error("default route ioctl(SIOCADDRT): %m");
|
||||
return 0;
|
||||
}
|
||||
+ if (default_rt_repl_rest && del_rt)
|
||||
+ if (ioctl(sock_fd, SIOCDELRT, del_rt) < 0) {
|
||||
+ if (!ok_error(errno))
|
||||
+ error("del old default route ioctl(SIOCDELRT): %m");
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
have_default_route = 1;
|
||||
return 1;
|
||||
@@ -1649,11 +1691,21 @@
|
||||
rt.rt_flags = RTF_UP;
|
||||
if (ioctl(sock_fd, SIOCDELRT, &rt) < 0 && errno != ESRCH) {
|
||||
if (still_ppp()) {
|
||||
- if ( ! ok_error ( errno ))
|
||||
+ if (!ok_error(errno))
|
||||
error("default route ioctl(SIOCDELRT): %m");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+ if (default_rt_repl_rest) {
|
||||
+ notice("restoring old default route to %s [%I]",
|
||||
+ old_def_rt.rt_dev, SIN_ADDR(old_def_rt.rt_gateway));
|
||||
+ if (ioctl(sock_fd, SIOCADDRT, &old_def_rt) < 0) {
|
||||
+ if (!ok_error(errno))
|
||||
+ error("restore default route ioctl(SIOCADDRT): %m");
|
||||
+ return 0;
|
||||
+ }
|
||||
+ default_rt_repl_rest = 0;
|
||||
+ }
|
||||
|
||||
return 1;
|
||||
}
|
||||
diff -Naur ppp-2.4.4.orig/pppd/sys-solaris.c ppp-2.4.4/pppd/sys-solaris.c
|
||||
--- ppp-2.4.4.orig/pppd/sys-solaris.c 2009-05-09 02:54:59.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/sys-solaris.c 2009-05-09 02:58:31.000000000 -0400
|
||||
@@ -2036,12 +2036,18 @@
|
||||
* sifdefaultroute - assign a default route through the address given.
|
||||
*/
|
||||
int
|
||||
-sifdefaultroute(u, l, g)
|
||||
+sifdefaultroute(u, l, g, replace)
|
||||
int u;
|
||||
u_int32_t l, g;
|
||||
+ bool replace;
|
||||
{
|
||||
struct rtentry rt;
|
||||
|
||||
+ if (replace) {
|
||||
+ error("replacedefaultroute not supported on this platform");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
#if defined(__USLC__)
|
||||
g = l; /* use the local address as gateway */
|
||||
#endif
|
||||
diff -Naur ppp-2.4.4.orig/pppd/ipcp.c ppp-2.4.4/pppd/ipcp.c
|
||||
--- ppp-2.4.4.orig/pppd/ipcp.c 2009-05-09 02:55:46.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/ipcp.c 2009-05-09 02:58:31.000000000 -0400
|
||||
@@ -197,6 +197,14 @@
|
||||
"disable defaultroute option", OPT_ALIAS | OPT_A2CLR,
|
||||
&ipcp_wantoptions[0].default_route },
|
||||
|
||||
+ { "replacedefaultroute", o_bool,
|
||||
+ &ipcp_wantoptions[0].replace_default_route,
|
||||
+ "Replace default route", 1
|
||||
+ },
|
||||
+ { "noreplacedefaultroute", o_bool,
|
||||
+ &ipcp_allowoptions[0].replace_default_route,
|
||||
+ "Never replace default route", OPT_A2COPY,
|
||||
+ &ipcp_wantoptions[0].replace_default_route },
|
||||
{ "proxyarp", o_bool, &ipcp_wantoptions[0].proxy_arp,
|
||||
"Add proxy ARP entry", OPT_ENABLE|1, &ipcp_allowoptions[0].proxy_arp },
|
||||
{ "noproxyarp", o_bool, &ipcp_allowoptions[0].proxy_arp,
|
||||
@@ -263,7 +271,7 @@
|
||||
ip_active_pkt
|
||||
};
|
||||
|
||||
-static void ipcp_clear_addrs __P((int, u_int32_t, u_int32_t));
|
||||
+static void ipcp_clear_addrs __P((int, u_int32_t, u_int32_t, bool));
|
||||
static void ipcp_script __P((char *, int)); /* Run an up/down script */
|
||||
static void ipcp_script_done __P((void *));
|
||||
|
||||
@@ -1660,7 +1668,8 @@
|
||||
if (!sifnpmode(u, PPP_IP, NPMODE_QUEUE))
|
||||
return 0;
|
||||
if (wo->default_route)
|
||||
- if (sifdefaultroute(u, wo->ouraddr, wo->hisaddr))
|
||||
+ if (sifdefaultroute(u, wo->ouraddr, wo->hisaddr,
|
||||
+ wo->replace_default_route))
|
||||
default_route_set[u] = 1;
|
||||
if (wo->proxy_arp)
|
||||
if (sifproxyarp(u, wo->hisaddr))
|
||||
@@ -1742,7 +1751,8 @@
|
||||
*/
|
||||
if (demand) {
|
||||
if (go->ouraddr != wo->ouraddr || ho->hisaddr != wo->hisaddr) {
|
||||
- ipcp_clear_addrs(f->unit, wo->ouraddr, wo->hisaddr);
|
||||
+ ipcp_clear_addrs(f->unit, wo->ouraddr, wo->hisaddr,
|
||||
+ wo->replace_default_route);
|
||||
if (go->ouraddr != wo->ouraddr) {
|
||||
warn("Local IP address changed to %I", go->ouraddr);
|
||||
script_setenv("OLDIPLOCAL", ip_ntoa(wo->ouraddr), 0);
|
||||
@@ -1767,7 +1777,8 @@
|
||||
|
||||
/* assign a default route through the interface if required */
|
||||
if (ipcp_wantoptions[f->unit].default_route)
|
||||
- if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr))
|
||||
+ if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr,
|
||||
+ wo->replace_default_route))
|
||||
default_route_set[f->unit] = 1;
|
||||
|
||||
/* Make a proxy ARP entry if requested. */
|
||||
@@ -1817,7 +1828,8 @@
|
||||
|
||||
/* assign a default route through the interface if required */
|
||||
if (ipcp_wantoptions[f->unit].default_route)
|
||||
- if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr))
|
||||
+ if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr,
|
||||
+ wo->replace_default_route))
|
||||
default_route_set[f->unit] = 1;
|
||||
|
||||
/* Make a proxy ARP entry if requested. */
|
||||
@@ -1894,7 +1906,7 @@
|
||||
sifnpmode(f->unit, PPP_IP, NPMODE_DROP);
|
||||
sifdown(f->unit);
|
||||
ipcp_clear_addrs(f->unit, ipcp_gotoptions[f->unit].ouraddr,
|
||||
- ipcp_hisoptions[f->unit].hisaddr);
|
||||
+ ipcp_hisoptions[f->unit].hisaddr, 0);
|
||||
}
|
||||
|
||||
/* Execute the ip-down script */
|
||||
@@ -1910,16 +1922,25 @@
|
||||
* proxy arp entries, etc.
|
||||
*/
|
||||
static void
|
||||
-ipcp_clear_addrs(unit, ouraddr, hisaddr)
|
||||
+ipcp_clear_addrs(unit, ouraddr, hisaddr, replacedefaultroute)
|
||||
int unit;
|
||||
u_int32_t ouraddr; /* local address */
|
||||
u_int32_t hisaddr; /* remote address */
|
||||
+ bool replacedefaultroute;
|
||||
{
|
||||
if (proxy_arp_set[unit]) {
|
||||
cifproxyarp(unit, hisaddr);
|
||||
proxy_arp_set[unit] = 0;
|
||||
}
|
||||
- if (default_route_set[unit]) {
|
||||
+ /* If replacedefaultroute, sifdefaultroute will be called soon
|
||||
+ * with replacedefaultroute set and that will overwrite the current
|
||||
+ * default route. This is the case only when doing demand, otherwise
|
||||
+ * during demand, this cifdefaultroute would restore the old default
|
||||
+ * route which is not what we want in this case. In the non-demand
|
||||
+ * case, we'll delete the default route and restore the old if there
|
||||
+ * is one saved by an sifdefaultroute with replacedefaultroute.
|
||||
+ */
|
||||
+ if (!replacedefaultroute && default_route_set[unit]) {
|
||||
cifdefaultroute(unit, ouraddr, hisaddr);
|
||||
default_route_set[unit] = 0;
|
||||
}
|
||||
diff -Naur ppp-2.4.4.orig/pppd/ipcp.h ppp-2.4.4/pppd/ipcp.h
|
||||
--- ppp-2.4.4.orig/pppd/ipcp.h 2009-05-09 02:54:59.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/ipcp.h 2009-05-09 02:58:31.000000000 -0400
|
||||
@@ -70,6 +70,7 @@
|
||||
bool old_addrs; /* Use old (IP-Addresses) option? */
|
||||
bool req_addr; /* Ask peer to send IP address? */
|
||||
bool default_route; /* Assign default route through interface? */
|
||||
+ bool replace_default_route; /* Replace default route through interface? */
|
||||
bool proxy_arp; /* Make proxy ARP entry for peer? */
|
||||
bool neg_vj; /* Van Jacobson Compression? */
|
||||
bool old_vj; /* use old (short) form of VJ option? */
|
||||
diff -Naur ppp-2.4.4.orig/pppd/pppd.8 ppp-2.4.4/pppd/pppd.8
|
||||
--- ppp-2.4.4.orig/pppd/pppd.8 2009-05-09 02:54:59.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/pppd.8 2009-05-09 02:58:31.000000000 -0400
|
||||
@@ -121,6 +121,11 @@
|
||||
This entry is removed when the PPP connection is broken. This option
|
||||
is privileged if the \fInodefaultroute\fR option has been specified.
|
||||
.TP
|
||||
+.B replacedefaultroute
|
||||
+This option is a flag to the defaultroute option. If defaultroute is
|
||||
+set and this flag is also set, pppd replaces an existing default route
|
||||
+with the new default route.
|
||||
+.TP
|
||||
.B disconnect \fIscript
|
||||
Execute the command specified by \fIscript\fR, by passing it to a
|
||||
shell, after
|
||||
@@ -706,7 +711,12 @@
|
||||
.TP
|
||||
.B nodefaultroute
|
||||
Disable the \fIdefaultroute\fR option. The system administrator who
|
||||
-wishes to prevent users from creating default routes with pppd
|
||||
+wishes to prevent users from adding a default route with pppd
|
||||
+can do so by placing this option in the /etc/ppp/options file.
|
||||
+.TP
|
||||
+.B noreplacedefaultroute
|
||||
+Disable the \fIreplacedefaultroute\fR option. The system administrator who
|
||||
+wishes to prevent users from replacing a default route with pppd
|
||||
can do so by placing this option in the /etc/ppp/options file.
|
||||
.TP
|
||||
.B nodeflate
|
||||
diff -Naur ppp-2.4.4.orig/pppd/pppd.h ppp-2.4.4/pppd/pppd.h
|
||||
--- ppp-2.4.4.orig/pppd/pppd.h 2009-05-09 02:55:46.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/pppd.h 2009-05-09 02:58:31.000000000 -0400
|
||||
@@ -644,7 +644,7 @@
|
||||
int cif6addr __P((int, eui64_t, eui64_t));
|
||||
/* Remove an IPv6 address from i/f */
|
||||
#endif
|
||||
-int sifdefaultroute __P((int, u_int32_t, u_int32_t));
|
||||
+int sifdefaultroute __P((int, u_int32_t, u_int32_t, bool replace_default_rt));
|
||||
/* Create default route through i/f */
|
||||
int cifdefaultroute __P((int, u_int32_t, u_int32_t));
|
||||
/* Delete default route through i/f */
|
||||
diff -Naur ppp-2.4.4.orig/pppd/sys-linux.c ppp-2.4.4/pppd/sys-linux.c
|
||||
--- ppp-2.4.4.orig/pppd/sys-linux.c 2009-05-09 02:55:46.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/sys-linux.c 2009-05-09 02:58:31.000000000 -0400
|
||||
@@ -206,6 +206,8 @@
|
||||
|
||||
static int if_is_up; /* Interface has been marked up */
|
||||
static int have_default_route; /* Gateway for default route added */
|
||||
+static struct rtentry old_def_rt; /* Old default route */
|
||||
+static int default_rt_repl_rest; /* replace and restore old default rt */
|
||||
static u_int32_t proxy_arp_addr; /* Addr for proxy arp entry added */
|
||||
static char proxy_arp_dev[16]; /* Device for proxy arp entry */
|
||||
static u_int32_t our_old_addr; /* for detecting address changes */
|
||||
@@ -1520,6 +1522,9 @@
|
||||
p = NULL;
|
||||
}
|
||||
|
||||
+ SET_SA_FAMILY (rt->rt_dst, AF_INET);
|
||||
+ SET_SA_FAMILY (rt->rt_gateway, AF_INET);
|
||||
+
|
||||
SIN_ADDR(rt->rt_dst) = strtoul(cols[route_dest_col], NULL, 16);
|
||||
SIN_ADDR(rt->rt_gateway) = strtoul(cols[route_gw_col], NULL, 16);
|
||||
SIN_ADDR(rt->rt_genmask) = strtoul(cols[route_mask_col], NULL, 16);
|
||||
@@ -1589,20 +1594,51 @@
|
||||
/********************************************************************
|
||||
*
|
||||
* sifdefaultroute - assign a default route through the address given.
|
||||
- */
|
||||
-
|
||||
-int sifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway)
|
||||
-{
|
||||
- struct rtentry rt;
|
||||
-
|
||||
- if (defaultroute_exists(&rt) && strcmp(rt.rt_dev, ifname) != 0) {
|
||||
- if (rt.rt_flags & RTF_GATEWAY)
|
||||
- error("not replacing existing default route via %I",
|
||||
- SIN_ADDR(rt.rt_gateway));
|
||||
- else
|
||||
+ *
|
||||
+ * If the global default_rt_repl_rest flag is set, then this function
|
||||
+ * already replaced the original system defaultroute with some other
|
||||
+ * route and it should just replace the current defaultroute with
|
||||
+ * another one, without saving the current route. Use: demand mode,
|
||||
+ * when pppd sets first a defaultroute it it's temporary ppp0 addresses
|
||||
+ * and then changes the temporary addresses to the addresses for the real
|
||||
+ * ppp connection when it has come up.
|
||||
+ */
|
||||
+
|
||||
+int sifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway, bool replace)
|
||||
+{
|
||||
+ struct rtentry rt, tmp_rt;
|
||||
+ struct rtentry *del_rt = NULL;
|
||||
+
|
||||
+ if (default_rt_repl_rest) {
|
||||
+ /* We have already reclaced the original defaultroute, if we
|
||||
+ are called again, we will delete the current default route
|
||||
+ and set the new default route in this function.
|
||||
+ - this is normally only the case the doing demand: */
|
||||
+ if (defaultroute_exists(&tmp_rt))
|
||||
+ del_rt = &tmp_rt;
|
||||
+ } else if (defaultroute_exists(&old_def_rt) &&
|
||||
+ strcmp(old_def_rt.rt_dev, ifname) != 0) {
|
||||
+ /* We did not yet replace an existing default route, let's
|
||||
+ check if we should save and replace a default route: */
|
||||
+ if (old_def_rt.rt_flags & RTF_GATEWAY) {
|
||||
+ if (!replace) {
|
||||
+ error("not replacing existing default route via %I",
|
||||
+ SIN_ADDR(old_def_rt.rt_gateway));
|
||||
+ return 0;
|
||||
+ } else {
|
||||
+ /* we need to copy rt_dev because we need it permanent too: */
|
||||
+ char *tmp_dev = malloc(strlen(old_def_rt.rt_dev) + 1);
|
||||
+ strcpy(tmp_dev, old_def_rt.rt_dev);
|
||||
+ old_def_rt.rt_dev = tmp_dev;
|
||||
+
|
||||
+ notice("replacing old default route to %s [%I]",
|
||||
+ old_def_rt.rt_dev, SIN_ADDR(old_def_rt.rt_gateway));
|
||||
+ default_rt_repl_rest = 1;
|
||||
+ del_rt = &old_def_rt;
|
||||
+ }
|
||||
+ } else
|
||||
error("not replacing existing default route through %s",
|
||||
- rt.rt_dev);
|
||||
- return 0;
|
||||
+ old_def_rt.rt_dev);
|
||||
}
|
||||
|
||||
memset (&rt, 0, sizeof (rt));
|
||||
@@ -1617,10 +1653,16 @@
|
||||
|
||||
rt.rt_flags = RTF_UP;
|
||||
if (ioctl(sock_fd, SIOCADDRT, &rt) < 0) {
|
||||
- if ( ! ok_error ( errno ))
|
||||
+ if (!ok_error(errno))
|
||||
error("default route ioctl(SIOCADDRT): %m");
|
||||
return 0;
|
||||
}
|
||||
+ if (default_rt_repl_rest && del_rt)
|
||||
+ if (ioctl(sock_fd, SIOCDELRT, del_rt) < 0) {
|
||||
+ if (!ok_error(errno))
|
||||
+ error("del old default route ioctl(SIOCDELRT): %m");
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
have_default_route = 1;
|
||||
return 1;
|
||||
@@ -1649,11 +1691,21 @@
|
||||
rt.rt_flags = RTF_UP;
|
||||
if (ioctl(sock_fd, SIOCDELRT, &rt) < 0 && errno != ESRCH) {
|
||||
if (still_ppp()) {
|
||||
- if ( ! ok_error ( errno ))
|
||||
+ if (!ok_error(errno))
|
||||
error("default route ioctl(SIOCDELRT): %m");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+ if (default_rt_repl_rest) {
|
||||
+ notice("restoring old default route to %s [%I]",
|
||||
+ old_def_rt.rt_dev, SIN_ADDR(old_def_rt.rt_gateway));
|
||||
+ if (ioctl(sock_fd, SIOCADDRT, &old_def_rt) < 0) {
|
||||
+ if (!ok_error(errno))
|
||||
+ error("restore default route ioctl(SIOCADDRT): %m");
|
||||
+ return 0;
|
||||
+ }
|
||||
+ default_rt_repl_rest = 0;
|
||||
+ }
|
||||
|
||||
return 1;
|
||||
}
|
||||
diff -Naur ppp-2.4.4.orig/pppd/sys-solaris.c ppp-2.4.4/pppd/sys-solaris.c
|
||||
--- ppp-2.4.4.orig/pppd/sys-solaris.c 2009-05-09 02:54:59.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/sys-solaris.c 2009-05-09 02:58:31.000000000 -0400
|
||||
@@ -2036,12 +2036,18 @@
|
||||
* sifdefaultroute - assign a default route through the address given.
|
||||
*/
|
||||
int
|
||||
-sifdefaultroute(u, l, g)
|
||||
+sifdefaultroute(u, l, g, replace)
|
||||
int u;
|
||||
u_int32_t l, g;
|
||||
+ bool replace;
|
||||
{
|
||||
struct rtentry rt;
|
||||
|
||||
+ if (replace) {
|
||||
+ error("replacedefaultroute not supported on this platform");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
#if defined(__USLC__)
|
||||
g = l; /* use the local address as gateway */
|
||||
#endif
|
@ -1,7 +1,6 @@
|
||||
Index: ppp-2.4.3/pppd/Makefile.linux
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/Makefile.linux 2007-06-04 13:22:08.197609056 +0200
|
||||
+++ ppp-2.4.3/pppd/Makefile.linux 2007-06-04 13:22:11.837055776 +0200
|
||||
diff -Naur ppp-2.4.4.orig/pppd/Makefile.linux ppp-2.4.4/pppd/Makefile.linux
|
||||
--- ppp-2.4.4.orig/pppd/Makefile.linux 2009-05-08 23:17:17.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/Makefile.linux 2009-05-08 23:18:37.000000000 -0400
|
||||
@@ -48,21 +48,21 @@
|
||||
# Uncomment the next line to include support for PPP packet filtering.
|
||||
# This requires that the libpcap library and headers be installed
|
||||
@ -36,19 +35,15 @@ Index: ppp-2.4.3/pppd/Makefile.linux
|
||||
-COMPILE_FLAGS= -DHAVE_PATHS_H -DIPX_CHANGE -DHAVE_MMAP
|
||||
+COMPILE_FLAGS= -DHAVE_PATHS_H -DHAVE_MMAP
|
||||
|
||||
CFLAGS= $(COPTS) $(COMPILE_FLAGS) $(INCLUDE_DIRS)
|
||||
CFLAGS= $(COPTS) $(COMPILE_FLAGS) $(INCLUDE_DIRS) '-DDESTDIR="@DESTDIR@"'
|
||||
|
||||
@@ -117,12 +117,12 @@
|
||||
@@ -117,10 +117,10 @@
|
||||
#LIBS += -lshadow $(LIBS)
|
||||
endif
|
||||
|
||||
-ifneq ($(wildcard /usr/include/crypt.h),)
|
||||
+#ifneq ($(wildcard /usr/include/crypt.h),)
|
||||
CFLAGS += -DHAVE_CRYPT_H=1
|
||||
-endif
|
||||
-ifneq ($(wildcard /usr/lib/libcrypt.*),)
|
||||
+#endif
|
||||
+#ifneq ($(wildcard /usr/lib/libcrypt.*),)
|
||||
CFLAGS += -DHAVE_CRYPT_H=1
|
||||
LIBS += -lcrypt
|
||||
-endif
|
||||
+#endif
|
||||
|
@ -1,7 +1,6 @@
|
||||
Index: ppp-2.4.3/include/linux/ppp-comp.h
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/include/linux/ppp-comp.h 2007-06-04 13:22:08.143617264 +0200
|
||||
+++ ppp-2.4.3/include/linux/ppp-comp.h 2007-06-04 13:22:12.031026288 +0200
|
||||
diff -Naur ppp-2.4.4.orig/include/linux/ppp-comp.h ppp-2.4.4/include/linux/ppp-comp.h
|
||||
--- ppp-2.4.4.orig/include/linux/ppp-comp.h 2009-05-09 03:44:09.000000000 -0400
|
||||
+++ ppp-2.4.4/include/linux/ppp-comp.h 2009-05-09 03:45:52.000000000 -0400
|
||||
@@ -36,7 +36,7 @@
|
||||
*/
|
||||
|
||||
@ -63,10 +62,9 @@ Index: ppp-2.4.3/include/linux/ppp-comp.h
|
||||
/*
|
||||
* Definitions for other, as yet unsupported, compression methods.
|
||||
*/
|
||||
Index: ppp-2.4.3/include/net/ppp-comp.h
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/include/net/ppp-comp.h 2007-06-04 13:22:08.150616200 +0200
|
||||
+++ ppp-2.4.3/include/net/ppp-comp.h 2007-06-04 13:22:12.031026288 +0200
|
||||
diff -Naur ppp-2.4.4.orig/include/net/ppp-comp.h ppp-2.4.4/include/net/ppp-comp.h
|
||||
--- ppp-2.4.4.orig/include/net/ppp-comp.h 2009-05-09 03:44:09.000000000 -0400
|
||||
+++ ppp-2.4.4/include/net/ppp-comp.h 2009-05-09 03:45:52.000000000 -0400
|
||||
@@ -255,6 +255,33 @@
|
||||
opts |= MPPE_OPT_UNKNOWN; \
|
||||
} while (/* CONSTCOND */ 0)
|
||||
@ -101,10 +99,9 @@ Index: ppp-2.4.3/include/net/ppp-comp.h
|
||||
/*
|
||||
* Definitions for other, as yet unsupported, compression methods.
|
||||
*/
|
||||
Index: ppp-2.4.3/pppd/ccp.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/ccp.c 2007-06-04 13:22:08.157615136 +0200
|
||||
+++ ppp-2.4.3/pppd/ccp.c 2007-06-04 13:22:12.033025984 +0200
|
||||
diff -Naur ppp-2.4.4.orig/pppd/ccp.c ppp-2.4.4/pppd/ccp.c
|
||||
--- ppp-2.4.4.orig/pppd/ccp.c 2009-05-09 03:44:09.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/ccp.c 2009-05-09 03:45:52.000000000 -0400
|
||||
@@ -62,12 +62,10 @@
|
||||
static char bsd_value[8];
|
||||
static char deflate_value[8];
|
||||
@ -720,8 +717,8 @@ Index: ppp-2.4.3/pppd/ccp.c
|
||||
*/
|
||||
static int
|
||||
ccp_nakci(f, p, len, treat_as_reject)
|
||||
@@ -900,6 +1079,8 @@
|
||||
int len;
|
||||
@@ -901,6 +1080,8 @@
|
||||
int treat_as_reject;
|
||||
{
|
||||
ccp_options *go = &ccp_gotoptions[f->unit];
|
||||
+ ccp_options *ao = &ccp_allowoptions[f->unit];
|
||||
@ -729,7 +726,7 @@ Index: ppp-2.4.3/pppd/ccp.c
|
||||
ccp_options no; /* options we've seen already */
|
||||
ccp_options try; /* options to ask for next time */
|
||||
|
||||
@@ -907,28 +1088,100 @@
|
||||
@@ -908,28 +1089,100 @@
|
||||
try = *go;
|
||||
|
||||
#ifdef MPPE
|
||||
@ -848,7 +845,7 @@ Index: ppp-2.4.3/pppd/ccp.c
|
||||
if (go->deflate && len >= CILEN_DEFLATE
|
||||
&& p[0] == (go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT)
|
||||
&& p[1] == CILEN_DEFLATE) {
|
||||
@@ -1001,14 +1254,50 @@
|
||||
@@ -1002,14 +1255,50 @@
|
||||
return -1;
|
||||
|
||||
#ifdef MPPE
|
||||
@ -903,7 +900,7 @@ Index: ppp-2.4.3/pppd/ccp.c
|
||||
if (go->deflate_correct && len >= CILEN_DEFLATE
|
||||
&& p[0] == CI_DEFLATE && p[1] == CILEN_DEFLATE) {
|
||||
if (p[2] != DEFLATE_MAKE_OPT(go->deflate_size)
|
||||
@@ -1072,14 +1361,15 @@
|
||||
@@ -1073,14 +1362,15 @@
|
||||
int dont_nak;
|
||||
{
|
||||
int ret, newret, res;
|
||||
@ -923,42 +920,34 @@ Index: ppp-2.4.3/pppd/ccp.c
|
||||
|
||||
ret = CONFACK;
|
||||
retp = p0 = p;
|
||||
@@ -1102,103 +1392,305 @@
|
||||
@@ -1103,106 +1393,302 @@
|
||||
switch (type) {
|
||||
#ifdef MPPE
|
||||
case CI_MPPE:
|
||||
- if (!ao->mppe || clen != CILEN_MPPE) {
|
||||
+ if ((!ao->mppc && !ao->mppe) || clen != CILEN_MPPE) {
|
||||
+ if ((!ao->mppc && !ao->mppe) || clen != CILEN_MPPE) {
|
||||
newret = CONFREJ;
|
||||
break;
|
||||
}
|
||||
- MPPE_CI_TO_OPTS(&p[2], ho->mppe);
|
||||
|
||||
-
|
||||
- /* Nak if anything unsupported or unknown are set. */
|
||||
- if (ho->mppe & MPPE_OPT_UNSUPPORTED) {
|
||||
- newret = CONFNAK;
|
||||
+ p2 = p[2];
|
||||
+ p5 = p[5];
|
||||
+ /* not sure what they want, tell 'em what we got */
|
||||
+ if (((p[2] & ~MPPE_STATELESS) != 0 || p[3] != 0 || p[4] != 0 ||
|
||||
+ (p[5] & ~(MPPE_40BIT | MPPE_56BIT | MPPE_128BIT |
|
||||
+ MPPE_MPPC)) != 0 || p[5] == 0) ||
|
||||
+ (p[2] == 0 && p[3] == 0 && p[4] == 0 && p[5] == 0)) {
|
||||
newret = CONFNAK;
|
||||
- ho->mppe &= ~MPPE_OPT_UNSUPPORTED;
|
||||
- }
|
||||
- if (ho->mppe & MPPE_OPT_UNKNOWN) {
|
||||
+ p2 = p[2];
|
||||
+ p5 = p[5];
|
||||
+ /* not sure what they want, tell 'em what we got */
|
||||
+ if (((p[2] & ~MPPE_STATELESS) != 0 || p[3] != 0 || p[4] != 0 ||
|
||||
+ (p[5] & ~(MPPE_40BIT | MPPE_56BIT | MPPE_128BIT |
|
||||
+ MPPE_MPPC)) != 0 || p[5] == 0) ||
|
||||
+ (p[2] == 0 && p[3] == 0 && p[4] == 0 && p[5] == 0)) {
|
||||
newret = CONFNAK;
|
||||
- newret = CONFNAK;
|
||||
- ho->mppe &= ~MPPE_OPT_UNKNOWN;
|
||||
+ p[2] = (wo->mppe_stateless ? MPPE_STATELESS : 0);
|
||||
+ p[3] = 0;
|
||||
+ p[4] = 0;
|
||||
+ p[5] = (wo->mppe_40 ? MPPE_40BIT : 0) |
|
||||
+ (wo->mppe_56 ? MPPE_56BIT : 0) |
|
||||
+ (wo->mppe_128 ? MPPE_128BIT : 0) |
|
||||
+ (wo->mppc ? MPPE_MPPC : 0);
|
||||
+ break;
|
||||
}
|
||||
|
||||
- }
|
||||
-
|
||||
- /* Check state opt */
|
||||
- if (ho->mppe & MPPE_OPT_STATEFUL) {
|
||||
- /*
|
||||
@ -969,58 +958,43 @@ Index: ppp-2.4.3/pppd/ccp.c
|
||||
- */
|
||||
- if (refuse_mppe_stateful) {
|
||||
- error("Refusing MPPE stateful mode offered by peer");
|
||||
+ if ((p[5] & MPPE_MPPC)) {
|
||||
+ if (ao->mppc) {
|
||||
+ ho->mppc = 1;
|
||||
+ BCOPY(p, opt_buf, CILEN_MPPE);
|
||||
+ opt_buf[2] = opt_buf[3] = opt_buf[4] = 0;
|
||||
+ opt_buf[5] = MPPE_MPPC;
|
||||
+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE, 1) <= 0) {
|
||||
+ ho->mppc = 0;
|
||||
+ p[5] &= ~MPPE_MPPC;
|
||||
+ newret = CONFNAK;
|
||||
+ }
|
||||
+ } else {
|
||||
newret = CONFREJ;
|
||||
- newret = CONFREJ;
|
||||
- break;
|
||||
+ if (wo->mppe || ao->mppe) {
|
||||
+ p[5] &= ~MPPE_MPPC;
|
||||
+ newret = CONFNAK;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ p[2] = (wo->mppe_stateless ? MPPE_STATELESS : 0);
|
||||
+ p[3] = 0;
|
||||
+ p[4] = 0;
|
||||
+ p[5] = (wo->mppe_40 ? MPPE_40BIT : 0) |
|
||||
+ (wo->mppe_56 ? MPPE_56BIT : 0) |
|
||||
+ (wo->mppe_128 ? MPPE_128BIT : 0) |
|
||||
+ (wo->mppc ? MPPE_MPPC : 0);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (ao->mppe)
|
||||
+ ho->mppe = 1;
|
||||
+
|
||||
+ if ((p[2] & MPPE_STATELESS)) {
|
||||
+ if (ao->mppe_stateless) {
|
||||
+ if (wo->mppe_stateless)
|
||||
+ ho->mppe_stateless = 1;
|
||||
+ else {
|
||||
+ newret = CONFNAK;
|
||||
+ if (!dont_nak)
|
||||
+ p[2] &= ~MPPE_STATELESS;
|
||||
+ }
|
||||
+ } else {
|
||||
+ newret = CONFNAK;
|
||||
+ if (!dont_nak)
|
||||
+ p[2] &= ~MPPE_STATELESS;
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (wo->mppe_stateless && !dont_nak) {
|
||||
+ wo->mppe_stateless = 0;
|
||||
+ newret = CONFNAK;
|
||||
+ p[2] |= MPPE_STATELESS;
|
||||
+ if ((p[5] & MPPE_MPPC)) {
|
||||
+ if (ao->mppc) {
|
||||
+ ho->mppc = 1;
|
||||
+ BCOPY(p, opt_buf, CILEN_MPPE);
|
||||
+ opt_buf[2] = opt_buf[3] = opt_buf[4] = 0;
|
||||
+ opt_buf[5] = MPPE_MPPC;
|
||||
+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE, 1) <= 0) {
|
||||
+ ho->mppc = 0;
|
||||
+ p[5] &= ~MPPE_MPPC;
|
||||
+ newret = CONFNAK;
|
||||
+ }
|
||||
+ } else {
|
||||
+ newret = CONFREJ;
|
||||
+ if (wo->mppe || ao->mppe) {
|
||||
+ p[5] &= ~MPPE_MPPC;
|
||||
+ newret = CONFNAK;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
-
|
||||
- /* Find out which of {S,L} are set. */
|
||||
- if ((ho->mppe & MPPE_OPT_128)
|
||||
- && (ho->mppe & MPPE_OPT_40)) {
|
||||
- /* Both are set, negotiate the strongest. */
|
||||
+ if ((p[5] & ~MPPE_MPPC) == (MPPE_40BIT|MPPE_56BIT|MPPE_128BIT)) {
|
||||
newret = CONFNAK;
|
||||
- newret = CONFNAK;
|
||||
- if (ao->mppe & MPPE_OPT_128)
|
||||
- ho->mppe &= ~MPPE_OPT_40;
|
||||
- else if (ao->mppe & MPPE_OPT_40)
|
||||
@ -1028,179 +1002,200 @@ Index: ppp-2.4.3/pppd/ccp.c
|
||||
- else {
|
||||
- newret = CONFREJ;
|
||||
- break;
|
||||
+ if (ao->mppe_128) {
|
||||
+ ho->mppe_128 = 1;
|
||||
+ p[5] &= ~(MPPE_40BIT|MPPE_56BIT);
|
||||
+ BCOPY(p, opt_buf, CILEN_MPPE);
|
||||
+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
|
||||
+ MPPE_MAX_KEY_LEN);
|
||||
+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
|
||||
+ MPPE_MAX_KEY_LEN, 1) <= 0) {
|
||||
+ ho->mppe_128 = 0;
|
||||
+ p[5] |= (MPPE_40BIT|MPPE_56BIT);
|
||||
+ p[5] &= ~MPPE_128BIT;
|
||||
+ goto check_mppe_56_40;
|
||||
+ }
|
||||
+ goto check_mppe;
|
||||
}
|
||||
- }
|
||||
- } else if (ho->mppe & MPPE_OPT_128) {
|
||||
- if (!(ao->mppe & MPPE_OPT_128)) {
|
||||
- newret = CONFREJ;
|
||||
- break;
|
||||
+ p[5] &= ~MPPE_128BIT;
|
||||
+ goto check_mppe_56_40;
|
||||
+ }
|
||||
+ if ((p[5] & ~MPPE_MPPC) == (MPPE_56BIT|MPPE_128BIT)) {
|
||||
+ newret = CONFNAK;
|
||||
+ if (ao->mppe_128) {
|
||||
+ ho->mppe_128 = 1;
|
||||
+ p[5] &= ~MPPE_56BIT;
|
||||
+ BCOPY(p, opt_buf, CILEN_MPPE);
|
||||
+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
|
||||
+ MPPE_MAX_KEY_LEN);
|
||||
+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
|
||||
+ MPPE_MAX_KEY_LEN, 1) <= 0) {
|
||||
+ ho->mppe_128 = 0;
|
||||
+ p[5] |= MPPE_56BIT;
|
||||
+ p[5] &= ~MPPE_128BIT;
|
||||
+ goto check_mppe_56;
|
||||
+ }
|
||||
+ goto check_mppe;
|
||||
}
|
||||
- }
|
||||
- } else if (ho->mppe & MPPE_OPT_40) {
|
||||
- if (!(ao->mppe & MPPE_OPT_40)) {
|
||||
- newret = CONFREJ;
|
||||
- break;
|
||||
+ p[5] &= ~MPPE_128BIT;
|
||||
+ goto check_mppe_56;
|
||||
+ }
|
||||
+ if ((p[5] & ~MPPE_MPPC) == (MPPE_40BIT|MPPE_128BIT)) {
|
||||
+ newret = CONFNAK;
|
||||
+ if (ao->mppe_128) {
|
||||
+ ho->mppe_128 = 1;
|
||||
+ p[5] &= ~MPPE_40BIT;
|
||||
+ BCOPY(p, opt_buf, CILEN_MPPE);
|
||||
- }
|
||||
+ if (ao->mppe)
|
||||
+ ho->mppe = 1;
|
||||
+
|
||||
+ if ((p[2] & MPPE_STATELESS)) {
|
||||
+ if (ao->mppe_stateless) {
|
||||
+ if (wo->mppe_stateless)
|
||||
+ ho->mppe_stateless = 1;
|
||||
+ else {
|
||||
+ newret = CONFNAK;
|
||||
+ if (!dont_nak)
|
||||
+ p[2] &= ~MPPE_STATELESS;
|
||||
+ }
|
||||
+ } else {
|
||||
+ newret = CONFNAK;
|
||||
+ if (!dont_nak)
|
||||
+ p[2] &= ~MPPE_STATELESS;
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (wo->mppe_stateless && !dont_nak) {
|
||||
+ wo->mppe_stateless = 0;
|
||||
+ newret = CONFNAK;
|
||||
+ p[2] |= MPPE_STATELESS;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if ((p[5] & ~MPPE_MPPC) == (MPPE_40BIT|MPPE_56BIT|MPPE_128BIT)) {
|
||||
+ newret = CONFNAK;
|
||||
+ if (ao->mppe_128) {
|
||||
+ ho->mppe_128 = 1;
|
||||
+ p[5] &= ~(MPPE_40BIT|MPPE_56BIT);
|
||||
+ BCOPY(p, opt_buf, CILEN_MPPE);
|
||||
+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
|
||||
+ MPPE_MAX_KEY_LEN);
|
||||
+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
|
||||
+ MPPE_MAX_KEY_LEN, 1) <= 0) {
|
||||
+ ho->mppe_128 = 0;
|
||||
+ p[5] |= (MPPE_40BIT|MPPE_56BIT);
|
||||
+ p[5] &= ~MPPE_128BIT;
|
||||
+ goto check_mppe_56_40;
|
||||
+ }
|
||||
+ goto check_mppe;
|
||||
+ }
|
||||
+ p[5] &= ~MPPE_128BIT;
|
||||
+ goto check_mppe_56_40;
|
||||
+ }
|
||||
+ if ((p[5] & ~MPPE_MPPC) == (MPPE_56BIT|MPPE_128BIT)) {
|
||||
+ newret = CONFNAK;
|
||||
+ if (ao->mppe_128) {
|
||||
+ ho->mppe_128 = 1;
|
||||
+ p[5] &= ~MPPE_56BIT;
|
||||
+ BCOPY(p, opt_buf, CILEN_MPPE);
|
||||
+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
|
||||
+ MPPE_MAX_KEY_LEN);
|
||||
+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
|
||||
+ MPPE_MAX_KEY_LEN, 1) <= 0) {
|
||||
+ ho->mppe_128 = 0;
|
||||
+ p[5] |= MPPE_40BIT;
|
||||
+ p[5] &= ~MPPE_128BIT;
|
||||
+ goto check_mppe_40;
|
||||
+ }
|
||||
+ goto check_mppe;
|
||||
+ }
|
||||
+ MPPE_MAX_KEY_LEN);
|
||||
+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
|
||||
+ MPPE_MAX_KEY_LEN, 1) <= 0) {
|
||||
+ ho->mppe_128 = 0;
|
||||
+ p[5] |= MPPE_56BIT;
|
||||
+ p[5] &= ~MPPE_128BIT;
|
||||
+ goto check_mppe_56;
|
||||
+ }
|
||||
+ goto check_mppe;
|
||||
+ }
|
||||
+ p[5] &= ~MPPE_128BIT;
|
||||
+ goto check_mppe_56;
|
||||
+ }
|
||||
+ if ((p[5] & ~MPPE_MPPC) == (MPPE_40BIT|MPPE_128BIT)) {
|
||||
+ newret = CONFNAK;
|
||||
+ if (ao->mppe_128) {
|
||||
+ ho->mppe_128 = 1;
|
||||
+ p[5] &= ~MPPE_40BIT;
|
||||
+ BCOPY(p, opt_buf, CILEN_MPPE);
|
||||
+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
|
||||
+ MPPE_MAX_KEY_LEN);
|
||||
+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
|
||||
+ MPPE_MAX_KEY_LEN, 1) <= 0) {
|
||||
+ ho->mppe_128 = 0;
|
||||
+ p[5] |= MPPE_40BIT;
|
||||
+ p[5] &= ~MPPE_128BIT;
|
||||
+ goto check_mppe_40;
|
||||
+ }
|
||||
+ goto check_mppe;
|
||||
+ }
|
||||
+ p[5] &= ~MPPE_128BIT;
|
||||
+ goto check_mppe_40;
|
||||
+ }
|
||||
+ if ((p[5] & ~MPPE_MPPC) == MPPE_128BIT) {
|
||||
+ if (ao->mppe_128) {
|
||||
+ ho->mppe_128 = 1;
|
||||
+ BCOPY(p, opt_buf, CILEN_MPPE);
|
||||
+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
|
||||
+ MPPE_MAX_KEY_LEN);
|
||||
+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
|
||||
+ MPPE_MAX_KEY_LEN, 1) <= 0) {
|
||||
+ ho->mppe_128 = 0;
|
||||
+ p[5] &= ~MPPE_128BIT;
|
||||
+ newret = CONFNAK;
|
||||
+ }
|
||||
+ goto check_mppe;
|
||||
+ }
|
||||
+ p[5] &= ~MPPE_128BIT;
|
||||
+ goto check_mppe_40;
|
||||
+ }
|
||||
+ if ((p[5] & ~MPPE_MPPC) == MPPE_128BIT) {
|
||||
+ if (ao->mppe_128) {
|
||||
+ ho->mppe_128 = 1;
|
||||
+ BCOPY(p, opt_buf, CILEN_MPPE);
|
||||
+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
|
||||
+ MPPE_MAX_KEY_LEN);
|
||||
+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
|
||||
+ MPPE_MAX_KEY_LEN, 1) <= 0) {
|
||||
+ ho->mppe_128 = 0;
|
||||
+ p[5] &= ~MPPE_128BIT;
|
||||
+ newret = CONFNAK;
|
||||
+ }
|
||||
+ goto check_mppe;
|
||||
+ }
|
||||
+ p[5] &= ~MPPE_128BIT;
|
||||
+ newret = CONFNAK;
|
||||
+ goto check_mppe;
|
||||
+ }
|
||||
+ check_mppe_56_40:
|
||||
+ newret = CONFNAK;
|
||||
+ goto check_mppe;
|
||||
+ }
|
||||
+ check_mppe_56_40:
|
||||
+ if ((p[5] & ~MPPE_MPPC) == (MPPE_40BIT|MPPE_56BIT)) {
|
||||
+ newret = CONFNAK;
|
||||
+ if (ao->mppe_56) {
|
||||
+ ho->mppe_56 = 1;
|
||||
+ p[5] &= ~MPPE_40BIT;
|
||||
+ newret = CONFNAK;
|
||||
+ if (ao->mppe_56) {
|
||||
+ ho->mppe_56 = 1;
|
||||
+ p[5] &= ~MPPE_40BIT;
|
||||
+ BCOPY(p, opt_buf, CILEN_MPPE);
|
||||
+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
|
||||
+ MPPE_MAX_KEY_LEN);
|
||||
+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
|
||||
+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
|
||||
+ MPPE_MAX_KEY_LEN);
|
||||
+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
|
||||
+ MPPE_MAX_KEY_LEN, 1) <= 0) {
|
||||
+ ho->mppe_56 = 0;
|
||||
+ p[5] |= MPPE_40BIT;
|
||||
+ p[5] &= ~MPPE_56BIT;
|
||||
+ ho->mppe_56 = 0;
|
||||
+ p[5] |= MPPE_40BIT;
|
||||
+ p[5] &= ~MPPE_56BIT;
|
||||
+ newret = CONFNAK;
|
||||
+ goto check_mppe_40;
|
||||
+ }
|
||||
+ goto check_mppe_40;
|
||||
+ }
|
||||
+ goto check_mppe;
|
||||
+ }
|
||||
+ }
|
||||
+ p[5] &= ~MPPE_56BIT;
|
||||
+ goto check_mppe_40;
|
||||
+ }
|
||||
+ check_mppe_56:
|
||||
+ goto check_mppe_40;
|
||||
+ }
|
||||
+ check_mppe_56:
|
||||
+ if ((p[5] & ~MPPE_MPPC) == MPPE_56BIT) {
|
||||
+ if (ao->mppe_56) {
|
||||
+ ho->mppe_56 = 1;
|
||||
+ BCOPY(p, opt_buf, CILEN_MPPE);
|
||||
+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
|
||||
+ if (ao->mppe_56) {
|
||||
+ ho->mppe_56 = 1;
|
||||
+ BCOPY(p, opt_buf, CILEN_MPPE);
|
||||
+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
|
||||
+ MPPE_MAX_KEY_LEN);
|
||||
+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
|
||||
+ MPPE_MAX_KEY_LEN, 1) <= 0) {
|
||||
+ ho->mppe_56 = 0;
|
||||
+ p[5] &= ~MPPE_56BIT;
|
||||
+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
|
||||
+ MPPE_MAX_KEY_LEN, 1) <= 0) {
|
||||
+ ho->mppe_56 = 0;
|
||||
+ p[5] &= ~MPPE_56BIT;
|
||||
+ newret = CONFNAK;
|
||||
+ }
|
||||
+ }
|
||||
+ goto check_mppe;
|
||||
+ }
|
||||
+ p[5] &= ~MPPE_56BIT;
|
||||
+ newret = CONFNAK;
|
||||
+ }
|
||||
+ p[5] &= ~MPPE_56BIT;
|
||||
+ newret = CONFNAK;
|
||||
+ goto check_mppe;
|
||||
+ }
|
||||
+ check_mppe_40:
|
||||
+ }
|
||||
+ check_mppe_40:
|
||||
+ if ((p[5] & ~MPPE_MPPC) == MPPE_40BIT) {
|
||||
+ if (ao->mppe_40) {
|
||||
+ ho->mppe_40 = 1;
|
||||
+ BCOPY(p, opt_buf, CILEN_MPPE);
|
||||
+ if (ao->mppe_40) {
|
||||
+ ho->mppe_40 = 1;
|
||||
+ BCOPY(p, opt_buf, CILEN_MPPE);
|
||||
+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
|
||||
+ MPPE_MAX_KEY_LEN);
|
||||
+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
|
||||
+ MPPE_MAX_KEY_LEN, 1) <= 0) {
|
||||
+ ho->mppe_40 = 0;
|
||||
+ MPPE_MAX_KEY_LEN);
|
||||
+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
|
||||
+ MPPE_MAX_KEY_LEN, 1) <= 0) {
|
||||
+ ho->mppe_40 = 0;
|
||||
+ p[5] &= ~MPPE_40BIT;
|
||||
+ newret = CONFNAK;
|
||||
+ }
|
||||
+ goto check_mppe;
|
||||
+ }
|
||||
+ p[5] &= ~MPPE_40BIT;
|
||||
+ }
|
||||
+
|
||||
+ check_mppe:
|
||||
+ if (!ho->mppe_40 && !ho->mppe_56 && !ho->mppe_128) {
|
||||
+ if (wo->mppe_40 || wo->mppe_56 || wo->mppe_128) {
|
||||
+ newret = CONFNAK;
|
||||
+ p[2] |= (wo->mppe_stateless ? MPPE_STATELESS : 0);
|
||||
+ newret = CONFNAK;
|
||||
+ }
|
||||
+ goto check_mppe;
|
||||
+ }
|
||||
+ p[5] &= ~MPPE_40BIT;
|
||||
+ }
|
||||
+
|
||||
+ check_mppe:
|
||||
+ if (!ho->mppe_40 && !ho->mppe_56 && !ho->mppe_128) {
|
||||
+ if (wo->mppe_40 || wo->mppe_56 || wo->mppe_128) {
|
||||
+ newret = CONFNAK;
|
||||
+ p[2] |= (wo->mppe_stateless ? MPPE_STATELESS : 0);
|
||||
+ p[5] |= (wo->mppe_40 ? MPPE_40BIT : 0) |
|
||||
+ (wo->mppe_56 ? MPPE_56BIT : 0) |
|
||||
+ (wo->mppe_128 ? MPPE_128BIT : 0) |
|
||||
+ (wo->mppc ? MPPE_MPPC : 0);
|
||||
+ } else {
|
||||
+ ho->mppe = ho->mppe_stateless = 0;
|
||||
}
|
||||
+ (wo->mppe_56 ? MPPE_56BIT : 0) |
|
||||
+ (wo->mppe_128 ? MPPE_128BIT : 0) |
|
||||
+ (wo->mppc ? MPPE_MPPC : 0);
|
||||
+ } else {
|
||||
+ ho->mppe = ho->mppe_stateless = 0;
|
||||
+ }
|
||||
} else {
|
||||
- /* Neither are set. */
|
||||
+ /* MPPE is not compatible with other compression types */
|
||||
+ if (wo->mppe) {
|
||||
+ ao->bsd_compress = 0;
|
||||
+ ao->predictor_1 = 0;
|
||||
+ ao->predictor_2 = 0;
|
||||
+ ao->deflate = 0;
|
||||
+ ao->lzs = 0;
|
||||
+ }
|
||||
+ }
|
||||
+ if ((!ho->mppc || !ao->mppc) && !ho->mppe) {
|
||||
+ p[2] = p2;
|
||||
+ p[5] = p5;
|
||||
newret = CONFREJ;
|
||||
break;
|
||||
}
|
||||
|
||||
- /* We cannot accept this. */
|
||||
- newret = CONFNAK;
|
||||
- /* Give the peer our idea of what can be used,
|
||||
- so it can choose and confirm */
|
||||
- ho->mppe = ao->mppe;
|
||||
- }
|
||||
-
|
||||
- /* rebuild the opts */
|
||||
- MPPE_OPTS_TO_CI(ho->mppe, &p[2]);
|
||||
- if (newret == CONFACK) {
|
||||
@ -1229,79 +1224,99 @@ Index: ppp-2.4.3/pppd/ccp.c
|
||||
- else
|
||||
- newret = CONFREJ;
|
||||
- }
|
||||
+ /*
|
||||
+ * I have commented the code below because according to RFC1547
|
||||
+ * MTU is only information for higher level protocols about
|
||||
+ * "the maximum allowable length for a packet (q.v.) transmitted
|
||||
+ * over a point-to-point link without incurring network layer
|
||||
+ * fragmentation." Of course a PPP implementation should be able
|
||||
+ * to handle overhead added by MPPE - in our case apropriate code
|
||||
+ * is located in drivers/net/ppp_generic.c in the kernel sources.
|
||||
+ *
|
||||
+ * According to RFC1661:
|
||||
+ * - when negotiated MRU is less than 1500 octets, a PPP
|
||||
+ * implementation must still be able to receive at least 1500
|
||||
+ * octets,
|
||||
+ * - when PFC is negotiated, a PPP implementation is still
|
||||
+ * required to receive frames with uncompressed protocol field.
|
||||
+ *
|
||||
+ * So why not to handle MPPE overhead without changing MTU value?
|
||||
+ * I am sure that RFC3078, unfortunately silently, assumes that.
|
||||
+ */
|
||||
|
||||
/*
|
||||
-
|
||||
- /*
|
||||
- * We have accepted MPPE or are willing to negotiate
|
||||
- * MPPE parameters. A CONFREJ is due to subsequent
|
||||
- * (non-MPPE) processing.
|
||||
+ * We need to decrease the interface MTU by MPPE_PAD
|
||||
+ * because MPPE frames **grow**. The kernel [must]
|
||||
+ * allocate MPPE_PAD extra bytes in xmit buffers.
|
||||
*/
|
||||
- */
|
||||
- rej_for_ci_mppe = 0;
|
||||
+/*
|
||||
+ mtu = netif_get_mtu(f->unit);
|
||||
+ if (mtu) {
|
||||
+ netif_set_mtu(f->unit, mtu - MPPE_PAD);
|
||||
+ } else {
|
||||
- break;
|
||||
-#endif /* MPPE */
|
||||
+ /* MPPE is not compatible with other compression types */
|
||||
+ if (wo->mppe) {
|
||||
+ ao->bsd_compress = 0;
|
||||
+ ao->predictor_1 = 0;
|
||||
+ ao->predictor_2 = 0;
|
||||
+ ao->deflate = 0;
|
||||
+ ao->lzs = 0;
|
||||
+ }
|
||||
+ }
|
||||
+ if ((!ho->mppc || !ao->mppc) && !ho->mppe) {
|
||||
+ p[2] = p2;
|
||||
+ p[5] = p5;
|
||||
+ newret = CONFREJ;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * I have commented the code below because according to RFC1547
|
||||
+ * MTU is only information for higher level protocols about
|
||||
+ * "the maximum allowable length for a packet (q.v.) transmitted
|
||||
+ * over a point-to-point link without incurring network layer
|
||||
+ * fragmentation." Of course a PPP implementation should be able
|
||||
+ * to handle overhead added by MPPE - in our case apropriate code
|
||||
+ * is located in drivers/net/ppp_generic.c in the kernel sources.
|
||||
+ *
|
||||
+ * According to RFC1661:
|
||||
+ * - when negotiated MRU is less than 1500 octets, a PPP
|
||||
+ * implementation must still be able to receive at least 1500
|
||||
+ * octets,
|
||||
+ * - when PFC is negotiated, a PPP implementation is still
|
||||
+ * required to receive frames with uncompressed protocol field.
|
||||
+ *
|
||||
+ * So why not to handle MPPE overhead without changing MTU value?
|
||||
+ * I am sure that RFC3078, unfortunately silently, assumes that.
|
||||
+ */
|
||||
+
|
||||
+ /*
|
||||
+ * We need to decrease the interface MTU by MPPE_PAD
|
||||
+ * because MPPE frames **grow**. The kernel [must]
|
||||
+ * allocate MPPE_PAD extra bytes in xmit buffers.
|
||||
+ */
|
||||
+ /*
|
||||
+ mtu = netif_get_mtu(f->unit);
|
||||
+ if (mtu) {
|
||||
+ netif_set_mtu(f->unit, mtu - MPPE_PAD);
|
||||
+ } else {
|
||||
+ newret = CONFREJ;
|
||||
+ if (ccp_wantoptions[f->unit].mppe) {
|
||||
+ error("Cannot adjust MTU needed by MPPE.");
|
||||
+ lcp_close(f->unit, "Cannot adjust MTU needed by MPPE.");
|
||||
+ }
|
||||
+ }
|
||||
+*/
|
||||
break;
|
||||
#endif /* MPPE */
|
||||
+
|
||||
+ if (ccp_wantoptions[f->unit].mppe) {
|
||||
+ error("Cannot adjust MTU needed by MPPE.");
|
||||
+ lcp_close(f->unit, "Cannot adjust MTU needed by MPPE.");
|
||||
+ }
|
||||
+ }
|
||||
+ */
|
||||
+ break;
|
||||
+ #endif /* MPPE */
|
||||
+
|
||||
+ case CI_LZS:
|
||||
+ if (!ao->lzs || clen != CILEN_LZS) {
|
||||
+ newret = CONFREJ;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ ho->lzs = 1;
|
||||
+ if (!ao->lzs || clen != CILEN_LZS) {
|
||||
+ newret = CONFREJ;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ ho->lzs = 1;
|
||||
+ ho->lzs_hists = (p[2] << 8) | p[3];
|
||||
+ ho->lzs_mode = p[4];
|
||||
+ if ((ho->lzs_hists != ao->lzs_hists) ||
|
||||
+ ho->lzs_mode = p[4];
|
||||
+ if ((ho->lzs_hists != ao->lzs_hists) ||
|
||||
+ (ho->lzs_mode != ao->lzs_mode)) {
|
||||
+ newret = CONFNAK;
|
||||
+ if (!dont_nak) {
|
||||
+ p[2] = ao->lzs_hists >> 8;
|
||||
+ p[3] = ao->lzs_hists & 0xff;
|
||||
+ p[4] = ao->lzs_mode;
|
||||
+ } else
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (p == p0 && ccp_test(f->unit, p, CILEN_LZS, 1) <= 0) {
|
||||
+ newret = CONFREJ;
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+ newret = CONFNAK;
|
||||
+ if (!dont_nak) {
|
||||
+ p[2] = ao->lzs_hists >> 8;
|
||||
+ p[3] = ao->lzs_hists & 0xff;
|
||||
+ p[4] = ao->lzs_mode;
|
||||
+ } else
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (p == p0 && ccp_test(f->unit, p, CILEN_LZS, 1) <= 0) {
|
||||
+ newret = CONFREJ;
|
||||
+ }
|
||||
+ break;
|
||||
case CI_DEFLATE:
|
||||
case CI_DEFLATE_DRAFT:
|
||||
if (!ao->deflate || clen != CILEN_DEFLATE
|
||||
@@ -1340,12 +1832,6 @@
|
||||
@@ -1344,12 +1830,6 @@
|
||||
else
|
||||
*lenp = retp - p0;
|
||||
}
|
||||
@ -1314,7 +1329,7 @@ Index: ppp-2.4.3/pppd/ccp.c
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1367,24 +1853,35 @@
|
||||
@@ -1371,24 +1851,35 @@
|
||||
char *p = result;
|
||||
char *q = result + sizeof(result); /* 1 past result */
|
||||
|
||||
@ -1366,7 +1381,7 @@ Index: ppp-2.4.3/pppd/ccp.c
|
||||
case CI_DEFLATE:
|
||||
case CI_DEFLATE_DRAFT:
|
||||
if (opt2 != NULL && opt2->deflate_size != opt->deflate_size)
|
||||
@@ -1440,12 +1937,12 @@
|
||||
@@ -1444,12 +1935,12 @@
|
||||
} else if (ANY_COMPRESS(*ho))
|
||||
notice("%s transmit compression enabled", method_name(ho, NULL));
|
||||
#ifdef MPPE
|
||||
@ -1381,7 +1396,7 @@ Index: ppp-2.4.3/pppd/ccp.c
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1468,7 +1965,7 @@
|
||||
@@ -1472,7 +1963,7 @@
|
||||
lcp_close(f->unit, "MPPE disabled");
|
||||
}
|
||||
}
|
||||
@ -1390,7 +1405,7 @@ Index: ppp-2.4.3/pppd/ccp.c
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1528,24 +2025,28 @@
|
||||
@@ -1532,24 +2023,28 @@
|
||||
#ifdef MPPE
|
||||
case CI_MPPE:
|
||||
if (optlen >= CILEN_MPPE) {
|
||||
@ -1431,7 +1446,7 @@ Index: ppp-2.4.3/pppd/ccp.c
|
||||
case CI_DEFLATE:
|
||||
case CI_DEFLATE_DRAFT:
|
||||
if (optlen >= CILEN_DEFLATE) {
|
||||
@@ -1631,6 +2132,7 @@
|
||||
@@ -1635,6 +2130,7 @@
|
||||
error("Lost compression sync: disabling compression");
|
||||
ccp_close(unit, "Lost compression sync");
|
||||
#ifdef MPPE
|
||||
@ -1439,7 +1454,7 @@ Index: ppp-2.4.3/pppd/ccp.c
|
||||
/*
|
||||
* If we were doing MPPE, we must also take the link down.
|
||||
*/
|
||||
@@ -1638,9 +2140,18 @@
|
||||
@@ -1642,9 +2138,18 @@
|
||||
error("Too many MPPE errors, closing LCP");
|
||||
lcp_close(unit, "Too many MPPE errors");
|
||||
}
|
||||
@ -1459,15 +1474,14 @@ Index: ppp-2.4.3/pppd/ccp.c
|
||||
* Send a reset-request to reset the peer's compressor.
|
||||
* We don't do that if we are still waiting for an
|
||||
* acknowledgement to a previous reset-request.
|
||||
@@ -1671,4 +2182,3 @@
|
||||
@@ -1675,4 +2180,3 @@
|
||||
} else
|
||||
ccp_localstate[f->unit] &= ~RACK_PENDING;
|
||||
}
|
||||
-
|
||||
Index: ppp-2.4.3/pppd/ccp.h
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/ccp.h 2007-06-04 13:22:08.162614376 +0200
|
||||
+++ ppp-2.4.3/pppd/ccp.h 2007-06-04 13:22:12.033025984 +0200
|
||||
diff -Naur ppp-2.4.4.orig/pppd/ccp.h ppp-2.4.4/pppd/ccp.h
|
||||
--- ppp-2.4.4.orig/pppd/ccp.h 2009-05-09 03:44:09.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/ccp.h 2009-05-09 03:45:52.000000000 -0400
|
||||
@@ -37,9 +37,17 @@
|
||||
bool predictor_2; /* do Predictor-2? */
|
||||
bool deflate_correct; /* use correct code for deflate? */
|
||||
@ -1486,11 +1500,10 @@ Index: ppp-2.4.3/pppd/ccp.h
|
||||
short method; /* code for chosen compression method */
|
||||
} ccp_options;
|
||||
|
||||
Index: ppp-2.4.3/pppd/chap_ms.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/chap_ms.c 2007-06-04 13:22:08.168613464 +0200
|
||||
+++ ppp-2.4.3/pppd/chap_ms.c 2007-06-04 13:22:12.033025984 +0200
|
||||
@@ -895,13 +895,17 @@
|
||||
diff -Naur ppp-2.4.4.orig/pppd/chap_ms.c ppp-2.4.4/pppd/chap_ms.c
|
||||
--- ppp-2.4.4.orig/pppd/chap_ms.c 2009-05-09 03:45:07.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/chap_ms.c 2009-05-09 03:45:52.000000000 -0400
|
||||
@@ -897,13 +897,17 @@
|
||||
/*
|
||||
* Disable undesirable encryption types. Note that we don't ENABLE
|
||||
* any encryption types, to avoid overriding manual configuration.
|
||||
@ -1510,82 +1523,3 @@ Index: ppp-2.4.3/pppd/chap_ms.c
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
Index: ppp-2.4.3/pppd/pppd.8
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/pppd.8 2007-06-04 13:22:08.175612400 +0200
|
||||
+++ ppp-2.4.3/pppd/pppd.8 2007-06-04 13:22:12.034025832 +0200
|
||||
@@ -622,9 +622,29 @@
|
||||
Enables the use of PPP multilink; this is an alias for the `multilink'
|
||||
option. This option is currently only available under Linux.
|
||||
.TP
|
||||
-.B mppe\-stateful
|
||||
-Allow MPPE to use stateful mode. Stateless mode is still attempted first.
|
||||
-The default is to disallow stateful mode.
|
||||
+.B mppc
|
||||
+Enables MPPC (Microsoft Point to Point Compression). This is the default.
|
||||
+.TP
|
||||
+.B mppe \fIsubopt1[,subopt2[,subopt3[..]]]
|
||||
+Modify MPPE (Microsoft Point to Point Encryption) parameters. In order
|
||||
+for MPPE to successfully come up, you must have authenticated with either
|
||||
+MS-CHAP or MS-CHAPv2. By default MPPE is optional, it means that pppd will
|
||||
+not propose MPPE to the peer, but will negotiate MPPE if peer wants that.
|
||||
+You can change this using \fIrequired\fR suboption.
|
||||
+This option is presently only supported under Linux, and only if your
|
||||
+kernel has been configured to include MPPE support.
|
||||
+.IP
|
||||
+MPPE suboptions:
|
||||
+.br
|
||||
+\fIrequired\fR - require MPPE; disconnect if peer doesn't support it,
|
||||
+.br
|
||||
+\fIstateless\fR - try to negotiate stateless mode; default is stateful,
|
||||
+.br
|
||||
+\fIno40\fR - disable 40 bit keys,
|
||||
+.br
|
||||
+\fIno56\fR - disable 56 bit keys,
|
||||
+.br
|
||||
+\fIno128\fR - disable 128 bit keys
|
||||
.TP
|
||||
.B mpshortseq
|
||||
Enables the use of short (12-bit) sequence numbers in multilink
|
||||
@@ -757,17 +777,11 @@
|
||||
Disables the use of PPP multilink. This option is currently only
|
||||
available under Linux.
|
||||
.TP
|
||||
-.B nomppe
|
||||
-Disables MPPE (Microsoft Point to Point Encryption). This is the default.
|
||||
-.TP
|
||||
-.B nomppe\-40
|
||||
-Disable 40-bit encryption with MPPE.
|
||||
+.B nomppc
|
||||
+Disables MPPC (Microsoft Point to Point Compression).
|
||||
.TP
|
||||
-.B nomppe\-128
|
||||
-Disable 128-bit encryption with MPPE.
|
||||
-.TP
|
||||
-.B nomppe\-stateful
|
||||
-Disable MPPE stateful mode. This is the default.
|
||||
+.B nomppe
|
||||
+Disables MPPE (Microsoft Point to Point Encryption).
|
||||
.TP
|
||||
.B nompshortseq
|
||||
Disables the use of short (12-bit) sequence numbers in the PPP
|
||||
@@ -948,19 +962,6 @@
|
||||
Require the peer to authenticate itself using CHAP [Challenge
|
||||
Handshake Authentication Protocol] authentication.
|
||||
.TP
|
||||
-.B require\-mppe
|
||||
-Require the use of MPPE (Microsoft Point to Point Encryption). This
|
||||
-option disables all other compression types. This option enables
|
||||
-both 40-bit and 128-bit encryption. In order for MPPE to successfully
|
||||
-come up, you must have authenticated with either MS\-CHAP or MS\-CHAPv2.
|
||||
-This option is presently only supported under Linux, and only if your
|
||||
-kernel has been configured to include MPPE support.
|
||||
-.TP
|
||||
-.B require\-mppe\-40
|
||||
-Require the use of MPPE, with 40-bit encryption.
|
||||
-.TP
|
||||
-.B require\-mppe\-128
|
||||
-Require the use of MPPE, with 128-bit encryption.
|
||||
.TP
|
||||
.B require\-mschap
|
||||
Require the peer to authenticate itself using MS\-CHAP [Microsoft Challenge
|
||||
|
@ -1,13 +0,0 @@
|
||||
Index: ppp-2.4.3/pppd/plugins/pppoatm/pppoatm.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/plugins/pppoatm/pppoatm.c 2007-06-04 13:22:11.014180872 +0200
|
||||
+++ ppp-2.4.3/pppd/plugins/pppoatm/pppoatm.c 2007-06-04 13:22:12.281988136 +0200
|
||||
@@ -136,8 +136,6 @@
|
||||
int fd;
|
||||
struct atm_qos qos;
|
||||
|
||||
- system ("/sbin/modprobe pppoatm");
|
||||
-
|
||||
if (!device_got_set)
|
||||
no_device_given_pppoatm();
|
||||
fd = socket(AF_ATMPVC, SOCK_DGRAM, 0);
|
172
package/ppp/patches/202-no_strip.patch
Normal file
172
package/ppp/patches/202-no_strip.patch
Normal file
@ -0,0 +1,172 @@
|
||||
diff -Naur ppp-2.4.4.orig/chat/Makefile.linux ppp-2.4.4/chat/Makefile.linux
|
||||
--- ppp-2.4.4.orig/chat/Makefile.linux 2006-06-04 01:07:46.000000000 -0400
|
||||
+++ ppp-2.4.4/chat/Makefile.linux 2009-05-07 18:04:23.000000000 -0400
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
install: chat
|
||||
mkdir -p $(BINDIR) $(MANDIR)
|
||||
- $(INSTALL) -s -c chat $(BINDIR)
|
||||
+ $(INSTALL) -c chat $(BINDIR)
|
||||
$(INSTALL) -c -m 644 chat.8 $(MANDIR)
|
||||
|
||||
clean:
|
||||
diff -Naur ppp-2.4.4.orig/pppd/Makefile.linux ppp-2.4.4/pppd/Makefile.linux
|
||||
--- ppp-2.4.4.orig/pppd/Makefile.linux 2009-05-07 17:04:21.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/Makefile.linux 2009-05-07 18:04:23.000000000 -0400
|
||||
@@ -99,7 +99,7 @@
|
||||
CFLAGS += -DUSE_SRP -DOPENSSL -I/usr/local/ssl/include
|
||||
LIBS += -lsrp -L/usr/local/ssl/lib -lcrypto
|
||||
TARGETS += srp-entry
|
||||
-EXTRAINSTALL = $(INSTALL) -s -c -m 555 srp-entry $(BINDIR)/srp-entry
|
||||
+EXTRAINSTALL = $(INSTALL) -c -m 555 srp-entry $(BINDIR)/srp-entry
|
||||
MANPAGES += srp-entry.8
|
||||
EXTRACLEAN += srp-entry.o
|
||||
NEEDDES=y
|
||||
@@ -200,7 +200,7 @@
|
||||
install: pppd
|
||||
mkdir -p $(BINDIR) $(MANDIR)
|
||||
$(EXTRAINSTALL)
|
||||
- $(INSTALL) -s -c -m 555 pppd $(BINDIR)/pppd
|
||||
+ $(INSTALL) -c -m 555 pppd $(BINDIR)/pppd
|
||||
if chgrp pppusers $(BINDIR)/pppd 2>/dev/null; then \
|
||||
chmod o-rx,u+s $(BINDIR)/pppd; fi
|
||||
$(INSTALL) -c -m 444 pppd.8 $(MANDIR)
|
||||
diff -Naur ppp-2.4.4.orig/pppd/plugins/radius/Makefile.linux ppp-2.4.4/pppd/plugins/radius/Makefile.linux
|
||||
--- ppp-2.4.4.orig/pppd/plugins/radius/Makefile.linux 2006-06-04 01:04:14.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/plugins/radius/Makefile.linux 2009-05-07 18:04:23.000000000 -0400
|
||||
@@ -36,9 +36,9 @@
|
||||
|
||||
install: all
|
||||
$(INSTALL) -d -m 755 $(LIBDIR)
|
||||
- $(INSTALL) -s -c -m 755 radius.so $(LIBDIR)
|
||||
- $(INSTALL) -s -c -m 755 radattr.so $(LIBDIR)
|
||||
- $(INSTALL) -s -c -m 755 radrealms.so $(LIBDIR)
|
||||
+ $(INSTALL) -c -m 755 radius.so $(LIBDIR)
|
||||
+ $(INSTALL) -c -m 755 radattr.so $(LIBDIR)
|
||||
+ $(INSTALL) -c -m 755 radrealms.so $(LIBDIR)
|
||||
$(INSTALL) -c -m 444 pppd-radius.8 $(MANDIR)
|
||||
$(INSTALL) -c -m 444 pppd-radattr.8 $(MANDIR)
|
||||
|
||||
diff -Naur ppp-2.4.4.orig/pppd/plugins/rp-pppoe/Makefile.linux ppp-2.4.4/pppd/plugins/rp-pppoe/Makefile.linux
|
||||
--- ppp-2.4.4.orig/pppd/plugins/rp-pppoe/Makefile.linux 2009-05-07 17:02:45.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/plugins/rp-pppoe/Makefile.linux 2009-05-07 18:04:23.000000000 -0400
|
||||
@@ -39,9 +39,9 @@
|
||||
|
||||
install: all
|
||||
$(INSTALL) -d -m 755 $(LIBDIR)
|
||||
- $(INSTALL) -s -c -m 4550 rp-pppoe.so $(LIBDIR)
|
||||
+ $(INSTALL) -c -m 4550 rp-pppoe.so $(LIBDIR)
|
||||
$(INSTALL) -d -m 755 $(BINDIR)
|
||||
- $(INSTALL) -s -c -m 555 pppoe-discovery $(BINDIR)
|
||||
+ $(INSTALL) -c -m 555 pppoe-discovery $(BINDIR)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.so
|
||||
diff -Naur ppp-2.4.4.orig/pppdump/Makefile.linux ppp-2.4.4/pppdump/Makefile.linux
|
||||
--- ppp-2.4.4.orig/pppdump/Makefile.linux 2006-06-04 01:04:14.000000000 -0400
|
||||
+++ ppp-2.4.4/pppdump/Makefile.linux 2009-05-07 18:04:23.000000000 -0400
|
||||
@@ -17,5 +17,5 @@
|
||||
|
||||
install:
|
||||
mkdir -p $(BINDIR) $(MANDIR)
|
||||
- $(INSTALL) -s -c pppdump $(BINDIR)
|
||||
+ $(INSTALL) -c pppdump $(BINDIR)
|
||||
$(INSTALL) -c -m 444 pppdump.8 $(MANDIR)
|
||||
diff -Naur ppp-2.4.4.orig/pppstats/Makefile.linux ppp-2.4.4/pppstats/Makefile.linux
|
||||
--- ppp-2.4.4.orig/pppstats/Makefile.linux 2006-06-04 01:07:46.000000000 -0400
|
||||
+++ ppp-2.4.4/pppstats/Makefile.linux 2009-05-07 18:04:23.000000000 -0400
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
install: pppstats
|
||||
-mkdir -p $(MANDIR)
|
||||
- $(INSTALL) -s -c pppstats $(BINDIR)
|
||||
+ $(INSTALL) -c pppstats $(BINDIR)
|
||||
$(INSTALL) -c -m 444 pppstats.8 $(MANDIR)
|
||||
|
||||
pppstats: $(PPPSTATSRCS)
|
||||
diff -Naur ppp-2.4.4.orig/chat/Makefile.linux ppp-2.4.4/chat/Makefile.linux
|
||||
--- ppp-2.4.4.orig/chat/Makefile.linux 2006-06-04 01:07:46.000000000 -0400
|
||||
+++ ppp-2.4.4/chat/Makefile.linux 2009-05-07 18:04:23.000000000 -0400
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
install: chat
|
||||
mkdir -p $(BINDIR) $(MANDIR)
|
||||
- $(INSTALL) -s -c chat $(BINDIR)
|
||||
+ $(INSTALL) -c chat $(BINDIR)
|
||||
$(INSTALL) -c -m 644 chat.8 $(MANDIR)
|
||||
|
||||
clean:
|
||||
diff -Naur ppp-2.4.4.orig/pppd/Makefile.linux ppp-2.4.4/pppd/Makefile.linux
|
||||
--- ppp-2.4.4.orig/pppd/Makefile.linux 2009-05-07 17:04:21.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/Makefile.linux 2009-05-07 18:04:23.000000000 -0400
|
||||
@@ -99,7 +99,7 @@
|
||||
CFLAGS += -DUSE_SRP -DOPENSSL -I/usr/local/ssl/include
|
||||
LIBS += -lsrp -L/usr/local/ssl/lib -lcrypto
|
||||
TARGETS += srp-entry
|
||||
-EXTRAINSTALL = $(INSTALL) -s -c -m 555 srp-entry $(BINDIR)/srp-entry
|
||||
+EXTRAINSTALL = $(INSTALL) -c -m 555 srp-entry $(BINDIR)/srp-entry
|
||||
MANPAGES += srp-entry.8
|
||||
EXTRACLEAN += srp-entry.o
|
||||
NEEDDES=y
|
||||
@@ -200,7 +200,7 @@
|
||||
install: pppd
|
||||
mkdir -p $(BINDIR) $(MANDIR)
|
||||
$(EXTRAINSTALL)
|
||||
- $(INSTALL) -s -c -m 555 pppd $(BINDIR)/pppd
|
||||
+ $(INSTALL) -c -m 555 pppd $(BINDIR)/pppd
|
||||
if chgrp pppusers $(BINDIR)/pppd 2>/dev/null; then \
|
||||
chmod o-rx,u+s $(BINDIR)/pppd; fi
|
||||
$(INSTALL) -c -m 444 pppd.8 $(MANDIR)
|
||||
diff -Naur ppp-2.4.4.orig/pppd/plugins/radius/Makefile.linux ppp-2.4.4/pppd/plugins/radius/Makefile.linux
|
||||
--- ppp-2.4.4.orig/pppd/plugins/radius/Makefile.linux 2006-06-04 01:04:14.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/plugins/radius/Makefile.linux 2009-05-07 18:04:23.000000000 -0400
|
||||
@@ -36,9 +36,9 @@
|
||||
|
||||
install: all
|
||||
$(INSTALL) -d -m 755 $(LIBDIR)
|
||||
- $(INSTALL) -s -c -m 755 radius.so $(LIBDIR)
|
||||
- $(INSTALL) -s -c -m 755 radattr.so $(LIBDIR)
|
||||
- $(INSTALL) -s -c -m 755 radrealms.so $(LIBDIR)
|
||||
+ $(INSTALL) -c -m 755 radius.so $(LIBDIR)
|
||||
+ $(INSTALL) -c -m 755 radattr.so $(LIBDIR)
|
||||
+ $(INSTALL) -c -m 755 radrealms.so $(LIBDIR)
|
||||
$(INSTALL) -c -m 444 pppd-radius.8 $(MANDIR)
|
||||
$(INSTALL) -c -m 444 pppd-radattr.8 $(MANDIR)
|
||||
|
||||
diff -Naur ppp-2.4.4.orig/pppd/plugins/rp-pppoe/Makefile.linux ppp-2.4.4/pppd/plugins/rp-pppoe/Makefile.linux
|
||||
--- ppp-2.4.4.orig/pppd/plugins/rp-pppoe/Makefile.linux 2009-05-07 17:02:45.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/plugins/rp-pppoe/Makefile.linux 2009-05-07 18:04:23.000000000 -0400
|
||||
@@ -39,9 +39,9 @@
|
||||
|
||||
install: all
|
||||
$(INSTALL) -d -m 755 $(LIBDIR)
|
||||
- $(INSTALL) -s -c -m 4550 rp-pppoe.so $(LIBDIR)
|
||||
+ $(INSTALL) -c -m 4550 rp-pppoe.so $(LIBDIR)
|
||||
$(INSTALL) -d -m 755 $(BINDIR)
|
||||
- $(INSTALL) -s -c -m 555 pppoe-discovery $(BINDIR)
|
||||
+ $(INSTALL) -c -m 555 pppoe-discovery $(BINDIR)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.so
|
||||
diff -Naur ppp-2.4.4.orig/pppdump/Makefile.linux ppp-2.4.4/pppdump/Makefile.linux
|
||||
--- ppp-2.4.4.orig/pppdump/Makefile.linux 2006-06-04 01:04:14.000000000 -0400
|
||||
+++ ppp-2.4.4/pppdump/Makefile.linux 2009-05-07 18:04:23.000000000 -0400
|
||||
@@ -17,5 +17,5 @@
|
||||
|
||||
install:
|
||||
mkdir -p $(BINDIR) $(MANDIR)
|
||||
- $(INSTALL) -s -c pppdump $(BINDIR)
|
||||
+ $(INSTALL) -c pppdump $(BINDIR)
|
||||
$(INSTALL) -c -m 444 pppdump.8 $(MANDIR)
|
||||
diff -Naur ppp-2.4.4.orig/pppstats/Makefile.linux ppp-2.4.4/pppstats/Makefile.linux
|
||||
--- ppp-2.4.4.orig/pppstats/Makefile.linux 2006-06-04 01:07:46.000000000 -0400
|
||||
+++ ppp-2.4.4/pppstats/Makefile.linux 2009-05-07 18:04:23.000000000 -0400
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
install: pppstats
|
||||
-mkdir -p $(MANDIR)
|
||||
- $(INSTALL) -s -c pppstats $(BINDIR)
|
||||
+ $(INSTALL) -c pppstats $(BINDIR)
|
||||
$(INSTALL) -c -m 444 pppstats.8 $(MANDIR)
|
||||
|
||||
pppstats: $(PPPSTATSRCS)
|
@ -1,92 +0,0 @@
|
||||
Index: ppp-2.4.3/chat/Makefile.linux
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/chat/Makefile.linux 2007-06-04 13:22:08.064629272 +0200
|
||||
+++ ppp-2.4.3/chat/Makefile.linux 2007-06-04 13:22:12.463960472 +0200
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
install: chat
|
||||
mkdir -p $(BINDIR)
|
||||
- $(INSTALL) -s -c chat $(BINDIR)
|
||||
+ $(INSTALL) -c chat $(BINDIR)
|
||||
$(INSTALL) -c -m 644 chat.8 $(MANDIR)
|
||||
|
||||
clean:
|
||||
Index: ppp-2.4.3/pppd/Makefile.linux
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/Makefile.linux 2007-06-04 13:22:11.837055776 +0200
|
||||
+++ ppp-2.4.3/pppd/Makefile.linux 2007-06-04 13:22:12.463960472 +0200
|
||||
@@ -99,7 +99,7 @@
|
||||
CFLAGS += -DUSE_SRP -DOPENSSL -I/usr/local/ssl/include
|
||||
LIBS += -lsrp -L/usr/local/ssl/lib -lcrypto
|
||||
TARGETS += srp-entry
|
||||
-EXTRAINSTALL = $(INSTALL) -s -c -m 555 srp-entry $(BINDIR)/srp-entry
|
||||
+EXTRAINSTALL = $(INSTALL) -c -m 555 srp-entry $(BINDIR)/srp-entry
|
||||
MANPAGES += srp-entry.8
|
||||
EXTRACLEAN += srp-entry.o
|
||||
NEEDDES=y
|
||||
@@ -202,7 +202,7 @@
|
||||
install: pppd
|
||||
mkdir -p $(BINDIR) $(MANDIR)
|
||||
$(EXTRAINSTALL)
|
||||
- $(INSTALL) -s -c -m 555 pppd $(BINDIR)/pppd
|
||||
+ $(INSTALL) -c -m 555 pppd $(BINDIR)/pppd
|
||||
if chgrp pppusers $(BINDIR)/pppd 2>/dev/null; then \
|
||||
chmod o-rx,u+s $(BINDIR)/pppd; fi
|
||||
$(INSTALL) -c -m 444 pppd.8 $(MANDIR)
|
||||
Index: ppp-2.4.3/pppd/plugins/radius/Makefile.linux
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/plugins/radius/Makefile.linux 2007-06-04 13:22:08.076627448 +0200
|
||||
+++ ppp-2.4.3/pppd/plugins/radius/Makefile.linux 2007-06-04 13:22:12.463960472 +0200
|
||||
@@ -36,9 +36,9 @@
|
||||
|
||||
install: all
|
||||
$(INSTALL) -d -m 755 $(LIBDIR)
|
||||
- $(INSTALL) -s -c -m 755 radius.so $(LIBDIR)
|
||||
- $(INSTALL) -s -c -m 755 radattr.so $(LIBDIR)
|
||||
- $(INSTALL) -s -c -m 755 radrealms.so $(LIBDIR)
|
||||
+ $(INSTALL) -c -m 755 radius.so $(LIBDIR)
|
||||
+ $(INSTALL) -c -m 755 radattr.so $(LIBDIR)
|
||||
+ $(INSTALL) -c -m 755 radrealms.so $(LIBDIR)
|
||||
$(INSTALL) -c -m 444 pppd-radius.8 $(MANDIR)
|
||||
$(INSTALL) -c -m 444 pppd-radattr.8 $(MANDIR)
|
||||
|
||||
Index: ppp-2.4.3/pppd/plugins/rp-pppoe/Makefile.linux
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/plugins/rp-pppoe/Makefile.linux 2007-06-04 13:22:09.416423768 +0200
|
||||
+++ ppp-2.4.3/pppd/plugins/rp-pppoe/Makefile.linux 2007-06-04 13:22:12.468959712 +0200
|
||||
@@ -39,9 +39,9 @@
|
||||
|
||||
install: all
|
||||
$(INSTALL) -d -m 755 $(LIBDIR)
|
||||
- $(INSTALL) -s -c -m 4550 rp-pppoe.so $(LIBDIR)
|
||||
+ $(INSTALL) -c -m 4550 rp-pppoe.so $(LIBDIR)
|
||||
$(INSTALL) -d -m 755 $(BINDIR)
|
||||
- $(INSTALL) -s -c -m 555 pppoe-discovery $(BINDIR)
|
||||
+ $(INSTALL) -c -m 555 pppoe-discovery $(BINDIR)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.so
|
||||
Index: ppp-2.4.3/pppdump/Makefile.linux
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppdump/Makefile.linux 2007-06-04 13:22:08.091625168 +0200
|
||||
+++ ppp-2.4.3/pppdump/Makefile.linux 2007-06-04 13:22:12.468959712 +0200
|
||||
@@ -17,5 +17,5 @@
|
||||
|
||||
install:
|
||||
mkdir -p $(BINDIR) $(MANDIR)
|
||||
- $(INSTALL) -s -c pppdump $(BINDIR)
|
||||
+ $(INSTALL) -c pppdump $(BINDIR)
|
||||
$(INSTALL) -c -m 444 pppdump.8 $(MANDIR)
|
||||
Index: ppp-2.4.3/pppstats/Makefile.linux
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppstats/Makefile.linux 2007-06-04 13:22:08.099623952 +0200
|
||||
+++ ppp-2.4.3/pppstats/Makefile.linux 2007-06-04 13:22:12.468959712 +0200
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
install: pppstats
|
||||
-mkdir -p $(MANDIR)
|
||||
- $(INSTALL) -s -c pppstats $(BINDIR)
|
||||
+ $(INSTALL) -c pppstats $(BINDIR)
|
||||
$(INSTALL) -c -m 444 pppstats.8 $(MANDIR)
|
||||
|
||||
pppstats: $(PPPSTATSRCS)
|
52
package/ppp/patches/203-opt_flags.patch
Normal file
52
package/ppp/patches/203-opt_flags.patch
Normal file
@ -0,0 +1,52 @@
|
||||
diff -Naur ppp-2.4.4.orig/pppd/plugins/radius/Makefile.linux ppp-2.4.4/pppd/plugins/radius/Makefile.linux
|
||||
--- ppp-2.4.4.orig/pppd/plugins/radius/Makefile.linux 2009-05-07 18:05:57.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/plugins/radius/Makefile.linux 2009-05-07 18:06:23.000000000 -0400
|
||||
@@ -12,7 +12,8 @@
|
||||
INSTALL = install
|
||||
|
||||
PLUGIN=radius.so radattr.so radrealms.so
|
||||
-CFLAGS=-I. -I../.. -I../../../include -O2 -fPIC -DRC_LOG_FACILITY=LOG_DAEMON
|
||||
+COPTS = -O2
|
||||
+CFLAGS=-I. -I../.. -I../../../include $(COPTS) -fPIC -DRC_LOG_FACILITY=LOG_DAEMON
|
||||
|
||||
# Uncomment the next line to include support for Microsoft's
|
||||
# MS-CHAP authentication protocol.
|
||||
diff -Naur ppp-2.4.4.orig/pppdump/Makefile.linux ppp-2.4.4/pppdump/Makefile.linux
|
||||
--- ppp-2.4.4.orig/pppdump/Makefile.linux 2009-05-07 18:05:57.000000000 -0400
|
||||
+++ ppp-2.4.4/pppdump/Makefile.linux 2009-05-07 18:06:23.000000000 -0400
|
||||
@@ -2,7 +2,8 @@
|
||||
BINDIR = $(DESTDIR)/sbin
|
||||
MANDIR = $(DESTDIR)/share/man/man8
|
||||
|
||||
-CFLAGS= -O -I../include/net
|
||||
+COPTS = -O
|
||||
+CFLAGS= $(COPTS) -I../include/net
|
||||
OBJS = pppdump.o bsd-comp.o deflate.o zlib.o
|
||||
|
||||
INSTALL= install
|
||||
diff -Naur ppp-2.4.4.orig/pppd/plugins/radius/Makefile.linux ppp-2.4.4/pppd/plugins/radius/Makefile.linux
|
||||
--- ppp-2.4.4.orig/pppd/plugins/radius/Makefile.linux 2009-05-07 18:05:57.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/plugins/radius/Makefile.linux 2009-05-07 18:06:23.000000000 -0400
|
||||
@@ -12,7 +12,8 @@
|
||||
INSTALL = install
|
||||
|
||||
PLUGIN=radius.so radattr.so radrealms.so
|
||||
-CFLAGS=-I. -I../.. -I../../../include -O2 -fPIC -DRC_LOG_FACILITY=LOG_DAEMON
|
||||
+COPTS = -O2
|
||||
+CFLAGS=-I. -I../.. -I../../../include $(COPTS) -fPIC -DRC_LOG_FACILITY=LOG_DAEMON
|
||||
|
||||
# Uncomment the next line to include support for Microsoft's
|
||||
# MS-CHAP authentication protocol.
|
||||
diff -Naur ppp-2.4.4.orig/pppdump/Makefile.linux ppp-2.4.4/pppdump/Makefile.linux
|
||||
--- ppp-2.4.4.orig/pppdump/Makefile.linux 2009-05-07 18:05:57.000000000 -0400
|
||||
+++ ppp-2.4.4/pppdump/Makefile.linux 2009-05-07 18:06:23.000000000 -0400
|
||||
@@ -2,7 +2,8 @@
|
||||
BINDIR = $(DESTDIR)/sbin
|
||||
MANDIR = $(DESTDIR)/share/man/man8
|
||||
|
||||
-CFLAGS= -O -I../include/net
|
||||
+COPTS = -O
|
||||
+CFLAGS= $(COPTS) -I../include/net
|
||||
OBJS = pppdump.o bsd-comp.o deflate.o zlib.o
|
||||
|
||||
INSTALL= install
|
@ -1,28 +0,0 @@
|
||||
Index: ppp-2.4.3/pppd/plugins/radius/Makefile.linux
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/plugins/radius/Makefile.linux 2007-06-04 13:22:12.463960472 +0200
|
||||
+++ ppp-2.4.3/pppd/plugins/radius/Makefile.linux 2007-06-04 13:22:12.705923688 +0200
|
||||
@@ -12,7 +12,8 @@
|
||||
INSTALL = install
|
||||
|
||||
PLUGIN=radius.so radattr.so radrealms.so
|
||||
-CFLAGS=-I. -I../.. -I../../../include -O2 -fPIC -DRC_LOG_FACILITY=LOG_DAEMON
|
||||
+COPTS = -O2
|
||||
+CFLAGS=-I. -I../.. -I../../../include $(COPTS) -fPIC -DRC_LOG_FACILITY=LOG_DAEMON
|
||||
|
||||
# Uncomment the next line to include support for Microsoft's
|
||||
# MS-CHAP authentication protocol.
|
||||
Index: ppp-2.4.3/pppdump/Makefile.linux
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppdump/Makefile.linux 2007-06-04 13:22:12.468959712 +0200
|
||||
+++ ppp-2.4.3/pppdump/Makefile.linux 2007-06-04 13:22:12.705923688 +0200
|
||||
@@ -2,7 +2,8 @@
|
||||
BINDIR = $(DESTDIR)/sbin
|
||||
MANDIR = $(DESTDIR)/share/man/man8
|
||||
|
||||
-CFLAGS= -O -I../include/net
|
||||
+COPTS = -O
|
||||
+CFLAGS= $(COPTS) -I../include/net
|
||||
OBJS = pppdump.o bsd-comp.o deflate.o zlib.o
|
||||
|
||||
INSTALL= install
|
148
package/ppp/patches/204-radius_config.patch
Normal file
148
package/ppp/patches/204-radius_config.patch
Normal file
@ -0,0 +1,148 @@
|
||||
diff -Naur ppp-2.4.4.orig/pppd/plugins/radius/config.c ppp-2.4.4/pppd/plugins/radius/config.c
|
||||
--- ppp-2.4.4.orig/pppd/plugins/radius/config.c 2004-11-14 02:26:26.000000000 -0500
|
||||
+++ ppp-2.4.4/pppd/plugins/radius/config.c 2009-05-07 19:31:14.000000000 -0400
|
||||
@@ -369,31 +369,37 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
+#if 0
|
||||
if (rc_conf_int("login_tries") <= 0)
|
||||
{
|
||||
error("%s: login_tries <= 0 is illegal", filename);
|
||||
return (-1);
|
||||
}
|
||||
+#endif
|
||||
if (rc_conf_str("seqfile") == NULL)
|
||||
{
|
||||
error("%s: seqfile not specified", filename);
|
||||
return (-1);
|
||||
}
|
||||
+#if 0
|
||||
if (rc_conf_int("login_timeout") <= 0)
|
||||
{
|
||||
error("%s: login_timeout <= 0 is illegal", filename);
|
||||
return (-1);
|
||||
}
|
||||
+#endif
|
||||
if (rc_conf_str("mapfile") == NULL)
|
||||
{
|
||||
error("%s: mapfile not specified", filename);
|
||||
return (-1);
|
||||
}
|
||||
+#if 0
|
||||
if (rc_conf_str("nologin") == NULL)
|
||||
{
|
||||
error("%s: nologin not specified", filename);
|
||||
return (-1);
|
||||
}
|
||||
+#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
diff -Naur ppp-2.4.4.orig/pppd/plugins/radius/options.h ppp-2.4.4/pppd/plugins/radius/options.h
|
||||
--- ppp-2.4.4.orig/pppd/plugins/radius/options.h 2004-11-14 02:26:26.000000000 -0500
|
||||
+++ ppp-2.4.4/pppd/plugins/radius/options.h 2009-05-07 19:31:14.000000000 -0400
|
||||
@@ -31,24 +31,21 @@
|
||||
static SERVER acctserver = {0};
|
||||
static SERVER authserver = {0};
|
||||
|
||||
-int default_tries = 4;
|
||||
-int default_timeout = 60;
|
||||
-
|
||||
static OPTION config_options[] = {
|
||||
/* internally used options */
|
||||
{"config_file", OT_STR, ST_UNDEF, NULL},
|
||||
/* General options */
|
||||
{"auth_order", OT_AUO, ST_UNDEF, NULL},
|
||||
-{"login_tries", OT_INT, ST_UNDEF, &default_tries},
|
||||
-{"login_timeout", OT_INT, ST_UNDEF, &default_timeout},
|
||||
-{"nologin", OT_STR, ST_UNDEF, "/etc/nologin"},
|
||||
-{"issue", OT_STR, ST_UNDEF, "/etc/radiusclient/issue"},
|
||||
+{"login_tries", OT_INT, ST_UNDEF, NULL},
|
||||
+{"login_timeout", OT_INT, ST_UNDEF, NULL},
|
||||
+{"nologin", OT_STR, ST_UNDEF, NULL},
|
||||
+{"issue", OT_STR, ST_UNDEF, NULL},
|
||||
/* RADIUS specific options */
|
||||
{"authserver", OT_SRV, ST_UNDEF, &authserver},
|
||||
{"acctserver", OT_SRV, ST_UNDEF, &acctserver},
|
||||
{"servers", OT_STR, ST_UNDEF, NULL},
|
||||
{"dictionary", OT_STR, ST_UNDEF, NULL},
|
||||
-{"login_radius", OT_STR, ST_UNDEF, "/usr/sbin/login.radius"},
|
||||
+{"login_radius", OT_STR, ST_UNDEF, NULL},
|
||||
{"seqfile", OT_STR, ST_UNDEF, NULL},
|
||||
{"mapfile", OT_STR, ST_UNDEF, NULL},
|
||||
{"default_realm", OT_STR, ST_UNDEF, NULL},
|
||||
diff -Naur ppp-2.4.4.orig/pppd/plugins/radius/config.c ppp-2.4.4/pppd/plugins/radius/config.c
|
||||
--- ppp-2.4.4.orig/pppd/plugins/radius/config.c 2004-11-14 02:26:26.000000000 -0500
|
||||
+++ ppp-2.4.4/pppd/plugins/radius/config.c 2009-05-07 19:31:14.000000000 -0400
|
||||
@@ -369,31 +369,37 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
+#if 0
|
||||
if (rc_conf_int("login_tries") <= 0)
|
||||
{
|
||||
error("%s: login_tries <= 0 is illegal", filename);
|
||||
return (-1);
|
||||
}
|
||||
+#endif
|
||||
if (rc_conf_str("seqfile") == NULL)
|
||||
{
|
||||
error("%s: seqfile not specified", filename);
|
||||
return (-1);
|
||||
}
|
||||
+#if 0
|
||||
if (rc_conf_int("login_timeout") <= 0)
|
||||
{
|
||||
error("%s: login_timeout <= 0 is illegal", filename);
|
||||
return (-1);
|
||||
}
|
||||
+#endif
|
||||
if (rc_conf_str("mapfile") == NULL)
|
||||
{
|
||||
error("%s: mapfile not specified", filename);
|
||||
return (-1);
|
||||
}
|
||||
+#if 0
|
||||
if (rc_conf_str("nologin") == NULL)
|
||||
{
|
||||
error("%s: nologin not specified", filename);
|
||||
return (-1);
|
||||
}
|
||||
+#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
diff -Naur ppp-2.4.4.orig/pppd/plugins/radius/options.h ppp-2.4.4/pppd/plugins/radius/options.h
|
||||
--- ppp-2.4.4.orig/pppd/plugins/radius/options.h 2004-11-14 02:26:26.000000000 -0500
|
||||
+++ ppp-2.4.4/pppd/plugins/radius/options.h 2009-05-07 19:31:14.000000000 -0400
|
||||
@@ -31,24 +31,21 @@
|
||||
static SERVER acctserver = {0};
|
||||
static SERVER authserver = {0};
|
||||
|
||||
-int default_tries = 4;
|
||||
-int default_timeout = 60;
|
||||
-
|
||||
static OPTION config_options[] = {
|
||||
/* internally used options */
|
||||
{"config_file", OT_STR, ST_UNDEF, NULL},
|
||||
/* General options */
|
||||
{"auth_order", OT_AUO, ST_UNDEF, NULL},
|
||||
-{"login_tries", OT_INT, ST_UNDEF, &default_tries},
|
||||
-{"login_timeout", OT_INT, ST_UNDEF, &default_timeout},
|
||||
-{"nologin", OT_STR, ST_UNDEF, "/etc/nologin"},
|
||||
-{"issue", OT_STR, ST_UNDEF, "/etc/radiusclient/issue"},
|
||||
+{"login_tries", OT_INT, ST_UNDEF, NULL},
|
||||
+{"login_timeout", OT_INT, ST_UNDEF, NULL},
|
||||
+{"nologin", OT_STR, ST_UNDEF, NULL},
|
||||
+{"issue", OT_STR, ST_UNDEF, NULL},
|
||||
/* RADIUS specific options */
|
||||
{"authserver", OT_SRV, ST_UNDEF, &authserver},
|
||||
{"acctserver", OT_SRV, ST_UNDEF, &acctserver},
|
||||
{"servers", OT_STR, ST_UNDEF, NULL},
|
||||
{"dictionary", OT_STR, ST_UNDEF, NULL},
|
||||
-{"login_radius", OT_STR, ST_UNDEF, "/usr/sbin/login.radius"},
|
||||
+{"login_radius", OT_STR, ST_UNDEF, NULL},
|
||||
{"seqfile", OT_STR, ST_UNDEF, NULL},
|
||||
{"mapfile", OT_STR, ST_UNDEF, NULL},
|
||||
{"default_realm", OT_STR, ST_UNDEF, NULL},
|
56
package/ppp/patches/205-no_exponential_timeout.patch
Normal file
56
package/ppp/patches/205-no_exponential_timeout.patch
Normal file
@ -0,0 +1,56 @@
|
||||
diff -Naur ppp-2.4.4.orig/pppd/plugins/rp-pppoe/discovery.c ppp-2.4.4/pppd/plugins/rp-pppoe/discovery.c
|
||||
--- ppp-2.4.4.orig/pppd/plugins/rp-pppoe/discovery.c 2009-05-07 19:47:30.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/plugins/rp-pppoe/discovery.c 2009-05-07 20:23:04.000000000 -0400
|
||||
@@ -593,12 +593,14 @@
|
||||
conn->discoveryState = STATE_SENT_PADI;
|
||||
waitForPADO(conn, timeout);
|
||||
|
||||
+#if 0
|
||||
/* If we're just probing for access concentrators, don't do
|
||||
exponential backoff. This reduces the time for an unsuccessful
|
||||
probe to 15 seconds. */
|
||||
if (!conn->printACNames) {
|
||||
timeout *= 2;
|
||||
}
|
||||
+#endif
|
||||
if (conn->printACNames && conn->numPADOs) {
|
||||
break;
|
||||
}
|
||||
@@ -621,7 +623,9 @@
|
||||
sendPADR(conn);
|
||||
conn->discoveryState = STATE_SENT_PADR;
|
||||
waitForPADS(conn, timeout);
|
||||
+#if 0
|
||||
timeout *= 2;
|
||||
+#endif
|
||||
} while (conn->discoveryState == STATE_SENT_PADR);
|
||||
|
||||
/* We're done. */
|
||||
diff -Naur ppp-2.4.4.orig/pppd/plugins/rp-pppoe/discovery.c ppp-2.4.4/pppd/plugins/rp-pppoe/discovery.c
|
||||
--- ppp-2.4.4.orig/pppd/plugins/rp-pppoe/discovery.c 2009-05-07 19:47:30.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/plugins/rp-pppoe/discovery.c 2009-05-07 20:23:04.000000000 -0400
|
||||
@@ -593,12 +593,14 @@
|
||||
conn->discoveryState = STATE_SENT_PADI;
|
||||
waitForPADO(conn, timeout);
|
||||
|
||||
+#if 0
|
||||
/* If we're just probing for access concentrators, don't do
|
||||
exponential backoff. This reduces the time for an unsuccessful
|
||||
probe to 15 seconds. */
|
||||
if (!conn->printACNames) {
|
||||
timeout *= 2;
|
||||
}
|
||||
+#endif
|
||||
if (conn->printACNames && conn->numPADOs) {
|
||||
break;
|
||||
}
|
||||
@@ -621,7 +623,9 @@
|
||||
sendPADR(conn);
|
||||
conn->discoveryState = STATE_SENT_PADR;
|
||||
waitForPADS(conn, timeout);
|
||||
+#if 0
|
||||
timeout *= 2;
|
||||
+#endif
|
||||
} while (conn->discoveryState == STATE_SENT_PADR);
|
||||
|
||||
/* We're done. */
|
@ -1,17 +0,0 @@
|
||||
Index: ppp-2.4.3/pppd/plugins/rp-pppoe/plugin.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/plugins/rp-pppoe/plugin.c 2007-06-04 13:22:09.417423616 +0200
|
||||
+++ ppp-2.4.3/pppd/plugins/rp-pppoe/plugin.c 2007-06-04 13:22:12.953885992 +0200
|
||||
@@ -282,9 +282,9 @@
|
||||
if (strlen(cmd) > 4 && !strncmp(cmd, "nic-", 4)) {
|
||||
/* Strip off "nic-" */
|
||||
cmd += 4;
|
||||
- } else if (strlen(cmd) < 4
|
||||
- || (strncmp(cmd, "eth", 3) && strncmp(cmd, "nas", 3)
|
||||
- && strncmp(cmd, "tap", 3) && strncmp(cmd, "br", 2))) {
|
||||
+ } else if (strlen(cmd) < 3
|
||||
+ || (strncmp(cmd, "eth", 3) && strncmp(cmd, "nas", 3) && strncmp(cmd, "vlan", 4) && strncmp(cmd, "ath", 3)
|
||||
+ && strncmp(cmd, "tap", 3) && strncmp(cmd, "br", 2))) {
|
||||
return 0;
|
||||
}
|
||||
|
164
package/ppp/patches/206-compensate_time_change.patch
Normal file
164
package/ppp/patches/206-compensate_time_change.patch
Normal file
@ -0,0 +1,164 @@
|
||||
diff -Naur ppp-2.4.4.orig/pppd/main.c ppp-2.4.4/pppd/main.c
|
||||
--- ppp-2.4.4.orig/pppd/main.c 2009-05-07 22:25:24.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/main.c 2009-05-07 22:22:40.000000000 -0400
|
||||
@@ -90,6 +90,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
+#include <sys/sysinfo.h>
|
||||
|
||||
#include "pppd.h"
|
||||
#include "magic.h"
|
||||
@@ -227,6 +228,7 @@
|
||||
|
||||
/* Prototypes for procedures local to this file. */
|
||||
|
||||
+static void check_time(void);
|
||||
static void setup_signals __P((void));
|
||||
static void create_pidfile __P((int pid));
|
||||
static void create_linkpidfile __P((int pid));
|
||||
@@ -532,6 +534,7 @@
|
||||
info("Starting link");
|
||||
}
|
||||
|
||||
+ check_time();
|
||||
gettimeofday(&start_time, NULL);
|
||||
script_unsetenv("CONNECT_TIME");
|
||||
script_unsetenv("BYTES_SENT");
|
||||
@@ -1264,6 +1267,36 @@
|
||||
|
||||
static struct callout *callout = NULL; /* Callout list */
|
||||
static struct timeval timenow; /* Current time */
|
||||
+static long uptime_diff = 0;
|
||||
+static int uptime_diff_set = 0;
|
||||
+
|
||||
+static void check_time(void)
|
||||
+{
|
||||
+ long new_diff;
|
||||
+ struct timeval t;
|
||||
+ struct sysinfo i;
|
||||
+ struct callout *p;
|
||||
+
|
||||
+ gettimeofday(&t, NULL);
|
||||
+ sysinfo(&i);
|
||||
+ new_diff = t.tv_sec - i.uptime;
|
||||
+
|
||||
+ if (!uptime_diff_set) {
|
||||
+ uptime_diff = new_diff;
|
||||
+ uptime_diff_set = 1;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if ((new_diff - 5 > uptime_diff) || (new_diff + 5 < uptime_diff)) {
|
||||
+ /* system time has changed, update counters and timeouts */
|
||||
+ info("System time change detected.");
|
||||
+ start_time.tv_sec += new_diff - uptime_diff;
|
||||
+
|
||||
+ for (p = callout; p != NULL; p = p->c_next)
|
||||
+ p->c_time.tv_sec += new_diff - uptime_diff;
|
||||
+ }
|
||||
+ uptime_diff = new_diff;
|
||||
+}
|
||||
|
||||
/*
|
||||
* timeout - Schedule a timeout.
|
||||
@@ -1334,6 +1367,8 @@
|
||||
{
|
||||
struct callout *p;
|
||||
|
||||
+ check_time();
|
||||
+
|
||||
while (callout != NULL) {
|
||||
p = callout;
|
||||
|
||||
@@ -1361,6 +1396,8 @@
|
||||
{
|
||||
if (callout == NULL)
|
||||
return NULL;
|
||||
+
|
||||
+ check_time();
|
||||
|
||||
gettimeofday(&timenow, NULL);
|
||||
tvp->tv_sec = callout->c_time.tv_sec - timenow.tv_sec;
|
||||
diff -Naur ppp-2.4.4.orig/pppd/main.c ppp-2.4.4/pppd/main.c
|
||||
--- ppp-2.4.4.orig/pppd/main.c 2009-05-07 22:25:24.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/main.c 2009-05-07 22:22:40.000000000 -0400
|
||||
@@ -90,6 +90,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
+#include <sys/sysinfo.h>
|
||||
|
||||
#include "pppd.h"
|
||||
#include "magic.h"
|
||||
@@ -227,6 +228,7 @@
|
||||
|
||||
/* Prototypes for procedures local to this file. */
|
||||
|
||||
+static void check_time(void);
|
||||
static void setup_signals __P((void));
|
||||
static void create_pidfile __P((int pid));
|
||||
static void create_linkpidfile __P((int pid));
|
||||
@@ -532,6 +534,7 @@
|
||||
info("Starting link");
|
||||
}
|
||||
|
||||
+ check_time();
|
||||
gettimeofday(&start_time, NULL);
|
||||
script_unsetenv("CONNECT_TIME");
|
||||
script_unsetenv("BYTES_SENT");
|
||||
@@ -1264,6 +1267,36 @@
|
||||
|
||||
static struct callout *callout = NULL; /* Callout list */
|
||||
static struct timeval timenow; /* Current time */
|
||||
+static long uptime_diff = 0;
|
||||
+static int uptime_diff_set = 0;
|
||||
+
|
||||
+static void check_time(void)
|
||||
+{
|
||||
+ long new_diff;
|
||||
+ struct timeval t;
|
||||
+ struct sysinfo i;
|
||||
+ struct callout *p;
|
||||
+
|
||||
+ gettimeofday(&t, NULL);
|
||||
+ sysinfo(&i);
|
||||
+ new_diff = t.tv_sec - i.uptime;
|
||||
+
|
||||
+ if (!uptime_diff_set) {
|
||||
+ uptime_diff = new_diff;
|
||||
+ uptime_diff_set = 1;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if ((new_diff - 5 > uptime_diff) || (new_diff + 5 < uptime_diff)) {
|
||||
+ /* system time has changed, update counters and timeouts */
|
||||
+ info("System time change detected.");
|
||||
+ start_time.tv_sec += new_diff - uptime_diff;
|
||||
+
|
||||
+ for (p = callout; p != NULL; p = p->c_next)
|
||||
+ p->c_time.tv_sec += new_diff - uptime_diff;
|
||||
+ }
|
||||
+ uptime_diff = new_diff;
|
||||
+}
|
||||
|
||||
/*
|
||||
* timeout - Schedule a timeout.
|
||||
@@ -1334,6 +1367,8 @@
|
||||
{
|
||||
struct callout *p;
|
||||
|
||||
+ check_time();
|
||||
+
|
||||
while (callout != NULL) {
|
||||
p = callout;
|
||||
|
||||
@@ -1361,6 +1396,8 @@
|
||||
{
|
||||
if (callout == NULL)
|
||||
return NULL;
|
||||
+
|
||||
+ check_time();
|
||||
|
||||
gettimeofday(&timenow, NULL);
|
||||
tvp->tv_sec = callout->c_time.tv_sec - timenow.tv_sec;
|
@ -1,76 +0,0 @@
|
||||
Index: ppp-2.4.3/pppd/plugins/radius/config.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/plugins/radius/config.c 2007-06-04 13:22:07.980642040 +0200
|
||||
+++ ppp-2.4.3/pppd/plugins/radius/config.c 2007-06-04 13:22:13.139857720 +0200
|
||||
@@ -369,31 +369,37 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
+#if 0
|
||||
if (rc_conf_int("login_tries") <= 0)
|
||||
{
|
||||
error("%s: login_tries <= 0 is illegal", filename);
|
||||
return (-1);
|
||||
}
|
||||
+#endif
|
||||
if (rc_conf_str("seqfile") == NULL)
|
||||
{
|
||||
error("%s: seqfile not specified", filename);
|
||||
return (-1);
|
||||
}
|
||||
+#if 0
|
||||
if (rc_conf_int("login_timeout") <= 0)
|
||||
{
|
||||
error("%s: login_timeout <= 0 is illegal", filename);
|
||||
return (-1);
|
||||
}
|
||||
+#endif
|
||||
if (rc_conf_str("mapfile") == NULL)
|
||||
{
|
||||
error("%s: mapfile not specified", filename);
|
||||
return (-1);
|
||||
}
|
||||
+#if 0
|
||||
if (rc_conf_str("nologin") == NULL)
|
||||
{
|
||||
error("%s: nologin not specified", filename);
|
||||
return (-1);
|
||||
}
|
||||
+#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
Index: ppp-2.4.3/pppd/plugins/radius/options.h
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/plugins/radius/options.h 2007-06-04 13:22:07.989640672 +0200
|
||||
+++ ppp-2.4.3/pppd/plugins/radius/options.h 2007-06-04 13:22:13.139857720 +0200
|
||||
@@ -31,24 +31,21 @@
|
||||
static SERVER acctserver = {0};
|
||||
static SERVER authserver = {0};
|
||||
|
||||
-int default_tries = 4;
|
||||
-int default_timeout = 60;
|
||||
-
|
||||
static OPTION config_options[] = {
|
||||
/* internally used options */
|
||||
{"config_file", OT_STR, ST_UNDEF, NULL},
|
||||
/* General options */
|
||||
{"auth_order", OT_AUO, ST_UNDEF, NULL},
|
||||
-{"login_tries", OT_INT, ST_UNDEF, &default_tries},
|
||||
-{"login_timeout", OT_INT, ST_UNDEF, &default_timeout},
|
||||
-{"nologin", OT_STR, ST_UNDEF, "/etc/nologin"},
|
||||
-{"issue", OT_STR, ST_UNDEF, "/etc/radiusclient/issue"},
|
||||
+{"login_tries", OT_INT, ST_UNDEF, NULL},
|
||||
+{"login_timeout", OT_INT, ST_UNDEF, NULL},
|
||||
+{"nologin", OT_STR, ST_UNDEF, NULL},
|
||||
+{"issue", OT_STR, ST_UNDEF, NULL},
|
||||
/* RADIUS specific options */
|
||||
{"authserver", OT_SRV, ST_UNDEF, &authserver},
|
||||
{"acctserver", OT_SRV, ST_UNDEF, &acctserver},
|
||||
{"servers", OT_STR, ST_UNDEF, NULL},
|
||||
{"dictionary", OT_STR, ST_UNDEF, NULL},
|
||||
-{"login_radius", OT_STR, ST_UNDEF, "/usr/sbin/login.radius"},
|
||||
+{"login_radius", OT_STR, ST_UNDEF, NULL},
|
||||
{"seqfile", OT_STR, ST_UNDEF, NULL},
|
||||
{"mapfile", OT_STR, ST_UNDEF, NULL},
|
||||
{"default_realm", OT_STR, ST_UNDEF, NULL},
|
36
package/ppp/patches/207-lcp_mtu_max.patch
Normal file
36
package/ppp/patches/207-lcp_mtu_max.patch
Normal file
@ -0,0 +1,36 @@
|
||||
diff -Naur ppp-2.4.4.orig/pppd/lcp.c ppp-2.4.4/pppd/lcp.c
|
||||
--- ppp-2.4.4.orig/pppd/lcp.c 2009-05-07 22:24:09.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/lcp.c 2009-05-07 22:26:57.000000000 -0400
|
||||
@@ -1904,12 +1904,12 @@
|
||||
* the interface MTU is set to the lowest of that, the
|
||||
* MTU we want to use, and our link MRU.
|
||||
*/
|
||||
- mtu = ho->neg_mru? ho->mru: PPP_MRU;
|
||||
+ mtu = MIN(ho->neg_mru? ho->mru: PPP_MRU, ao->mru);
|
||||
mru = go->neg_mru? MAX(wo->mru, go->mru): PPP_MRU;
|
||||
#ifdef HAVE_MULTILINK
|
||||
if (!(multilink && go->neg_mrru && ho->neg_mrru))
|
||||
#endif /* HAVE_MULTILINK */
|
||||
- netif_set_mtu(f->unit, MIN(MIN(mtu, mru), ao->mru));
|
||||
+ netif_set_mtu(f->unit, MIN(mtu, mru));
|
||||
ppp_send_config(f->unit, mtu,
|
||||
(ho->neg_asyncmap? ho->asyncmap: 0xffffffff),
|
||||
ho->neg_pcompression, ho->neg_accompression);
|
||||
diff -Naur ppp-2.4.4.orig/pppd/lcp.c ppp-2.4.4/pppd/lcp.c
|
||||
--- ppp-2.4.4.orig/pppd/lcp.c 2009-05-07 22:24:09.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/lcp.c 2009-05-07 22:26:57.000000000 -0400
|
||||
@@ -1904,12 +1904,12 @@
|
||||
* the interface MTU is set to the lowest of that, the
|
||||
* MTU we want to use, and our link MRU.
|
||||
*/
|
||||
- mtu = ho->neg_mru? ho->mru: PPP_MRU;
|
||||
+ mtu = MIN(ho->neg_mru? ho->mru: PPP_MRU, ao->mru);
|
||||
mru = go->neg_mru? MAX(wo->mru, go->mru): PPP_MRU;
|
||||
#ifdef HAVE_MULTILINK
|
||||
if (!(multilink && go->neg_mrru && ho->neg_mrru))
|
||||
#endif /* HAVE_MULTILINK */
|
||||
- netif_set_mtu(f->unit, MIN(MIN(mtu, mru), ao->mru));
|
||||
+ netif_set_mtu(f->unit, MIN(mtu, mru));
|
||||
ppp_send_config(f->unit, mtu,
|
||||
(ho->neg_asyncmap? ho->asyncmap: 0xffffffff),
|
||||
ho->neg_pcompression, ho->neg_accompression);
|
@ -1,133 +0,0 @@
|
||||
Index: ppp-2.4.3/pppd/auth.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/auth.c 2007-06-04 13:22:07.941647968 +0200
|
||||
+++ ppp-2.4.3/pppd/auth.c 2007-06-04 13:22:13.340827168 +0200
|
||||
@@ -532,6 +532,12 @@
|
||||
link_required(unit)
|
||||
int unit;
|
||||
{
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+start_link(unit)
|
||||
+ int unit;
|
||||
+{
|
||||
new_phase(PHASE_SERIALCONN);
|
||||
|
||||
devfd = the_channel->connect();
|
||||
@@ -984,10 +990,12 @@
|
||||
int unit, protocol, prot_flavor;
|
||||
{
|
||||
int bit;
|
||||
+ const char *prot = "";
|
||||
|
||||
switch (protocol) {
|
||||
case PPP_CHAP:
|
||||
bit = CHAP_WITHPEER;
|
||||
+ prot = "CHAP";
|
||||
switch (prot_flavor) {
|
||||
case CHAP_MD5:
|
||||
bit |= CHAP_MD5_WITHPEER;
|
||||
@@ -1006,15 +1014,19 @@
|
||||
if (passwd_from_file)
|
||||
BZERO(passwd, MAXSECRETLEN);
|
||||
bit = PAP_WITHPEER;
|
||||
+ prot = "PAP";
|
||||
break;
|
||||
case PPP_EAP:
|
||||
bit = EAP_WITHPEER;
|
||||
+ prot = "EAP";
|
||||
break;
|
||||
default:
|
||||
warn("auth_withpeer_success: unknown protocol %x", protocol);
|
||||
bit = 0;
|
||||
}
|
||||
|
||||
+ notice("%s authentication succeeded", prot);
|
||||
+
|
||||
/* Save the authentication method for later. */
|
||||
auth_done[unit] |= bit;
|
||||
|
||||
@@ -1648,6 +1660,7 @@
|
||||
static void
|
||||
plogout()
|
||||
{
|
||||
+ char *tty;
|
||||
#ifdef USE_PAM
|
||||
int pam_error;
|
||||
|
||||
@@ -1658,14 +1671,12 @@
|
||||
}
|
||||
/* Apparently the pam stuff does closelog(). */
|
||||
reopen_log();
|
||||
-#else /* ! USE_PAM */
|
||||
- char *tty;
|
||||
+#endif /* USE_PAM */
|
||||
|
||||
tty = devnam;
|
||||
if (strncmp(tty, "/dev/", 5) == 0)
|
||||
tty += 5;
|
||||
logwtmp(tty, "", ""); /* Wipe out utmp logout entry */
|
||||
-#endif /* ! USE_PAM */
|
||||
logged_in = 0;
|
||||
}
|
||||
|
||||
Index: ppp-2.4.3/pppd/main.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/main.c 2007-06-04 13:22:10.548251704 +0200
|
||||
+++ ppp-2.4.3/pppd/main.c 2007-06-04 13:22:13.340827168 +0200
|
||||
@@ -537,6 +537,7 @@
|
||||
script_unsetenv("BYTES_RCVD");
|
||||
|
||||
lcp_open(0); /* Start protocol */
|
||||
+ start_link(0);
|
||||
while (phase != PHASE_DEAD) {
|
||||
handle_events();
|
||||
get_input();
|
||||
Index: ppp-2.4.3/pppd/pppd.h
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/pppd.h 2007-06-04 13:22:11.615089520 +0200
|
||||
+++ ppp-2.4.3/pppd/pppd.h 2007-06-04 13:22:13.341827016 +0200
|
||||
@@ -526,6 +526,7 @@
|
||||
|
||||
/* Procedures exported from auth.c */
|
||||
void link_required __P((int)); /* we are starting to use the link */
|
||||
+void start_link __P((int)); /* bring the link up now */
|
||||
void link_terminated __P((int)); /* we are finished with the link */
|
||||
void link_down __P((int)); /* the LCP layer has left the Opened state */
|
||||
void upper_layers_down __P((int));/* take all NCPs down */
|
||||
Index: ppp-2.4.3/pppd/tty.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/tty.c 2007-06-04 13:22:07.960645080 +0200
|
||||
+++ ppp-2.4.3/pppd/tty.c 2007-06-04 13:22:13.341827016 +0200
|
||||
@@ -755,14 +755,6 @@
|
||||
close(pty_master);
|
||||
pty_master = -1;
|
||||
}
|
||||
- if (pty_slave >= 0) {
|
||||
- close(pty_slave);
|
||||
- pty_slave = -1;
|
||||
- }
|
||||
- if (real_ttyfd >= 0) {
|
||||
- close(real_ttyfd);
|
||||
- real_ttyfd = -1;
|
||||
- }
|
||||
ttyfd = -1;
|
||||
if (got_sigterm)
|
||||
asked_to_quit = 1;
|
||||
@@ -781,6 +773,7 @@
|
||||
} else {
|
||||
info("Serial link disconnected.");
|
||||
}
|
||||
+ stop_charshunt(NULL, 0);
|
||||
}
|
||||
|
||||
void tty_close_fds()
|
||||
@@ -944,7 +937,6 @@
|
||||
exit(0);
|
||||
}
|
||||
charshunt_pid = cpid;
|
||||
- add_notifier(&sigreceived, stop_charshunt, 0);
|
||||
record_child(cpid, "pppd (charshunt)", charshunt_done, NULL);
|
||||
return 1;
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
Index: ppp-2.4.3/pppd/plugins/rp-pppoe/discovery.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/plugins/rp-pppoe/discovery.c 2007-06-04 13:22:09.414424072 +0200
|
||||
+++ ppp-2.4.3/pppd/plugins/rp-pppoe/discovery.c 2007-06-04 13:22:13.567792664 +0200
|
||||
@@ -593,12 +593,14 @@
|
||||
conn->discoveryState = STATE_SENT_PADI;
|
||||
waitForPADO(conn, timeout);
|
||||
|
||||
+#if 0
|
||||
/* If we're just probing for access concentrators, don't do
|
||||
exponential backoff. This reduces the time for an unsuccessful
|
||||
probe to 15 seconds. */
|
||||
if (!conn->printACNames) {
|
||||
timeout *= 2;
|
||||
}
|
||||
+#endif
|
||||
if (conn->printACNames && conn->numPADOs) {
|
||||
break;
|
||||
}
|
||||
@@ -621,7 +623,9 @@
|
||||
sendPADR(conn);
|
||||
conn->discoveryState = STATE_SENT_PADR;
|
||||
waitForPADS(conn, timeout);
|
||||
+#if 0
|
||||
timeout *= 2;
|
||||
+#endif
|
||||
} while (conn->discoveryState == STATE_SENT_PADR);
|
||||
|
||||
/* We're done. */
|
@ -1,83 +0,0 @@
|
||||
Index: ppp-2.4.3/pppd/main.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/main.c 2007-06-04 13:22:13.340827168 +0200
|
||||
+++ ppp-2.4.3/pppd/main.c 2007-06-04 13:22:13.755764088 +0200
|
||||
@@ -90,6 +90,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
+#include <sys/sysinfo.h>
|
||||
|
||||
#include "pppd.h"
|
||||
#include "magic.h"
|
||||
@@ -227,6 +228,7 @@
|
||||
|
||||
/* Prototypes for procedures local to this file. */
|
||||
|
||||
+static void check_time(void);
|
||||
static void setup_signals __P((void));
|
||||
static void create_pidfile __P((int pid));
|
||||
static void create_linkpidfile __P((int pid));
|
||||
@@ -531,6 +533,7 @@
|
||||
info("Starting link");
|
||||
}
|
||||
|
||||
+ check_time();
|
||||
gettimeofday(&start_time, NULL);
|
||||
script_unsetenv("CONNECT_TIME");
|
||||
script_unsetenv("BYTES_SENT");
|
||||
@@ -1195,6 +1198,36 @@
|
||||
|
||||
static struct callout *callout = NULL; /* Callout list */
|
||||
static struct timeval timenow; /* Current time */
|
||||
+static long uptime_diff = 0;
|
||||
+static int uptime_diff_set = 0;
|
||||
+
|
||||
+static void check_time(void)
|
||||
+{
|
||||
+ long new_diff;
|
||||
+ struct timeval t;
|
||||
+ struct sysinfo i;
|
||||
+ struct callout *p;
|
||||
+
|
||||
+ gettimeofday(&t, NULL);
|
||||
+ sysinfo(&i);
|
||||
+ new_diff = t.tv_sec - i.uptime;
|
||||
+
|
||||
+ if (!uptime_diff_set) {
|
||||
+ uptime_diff = new_diff;
|
||||
+ uptime_diff_set = 1;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if ((new_diff - 5 > uptime_diff) || (new_diff + 5 < uptime_diff)) {
|
||||
+ /* system time has changed, update counters and timeouts */
|
||||
+ info("System time change detected.");
|
||||
+ start_time.tv_sec += new_diff - uptime_diff;
|
||||
+
|
||||
+ for (p = callout; p != NULL; p = p->c_next)
|
||||
+ p->c_time.tv_sec += new_diff - uptime_diff;
|
||||
+ }
|
||||
+ uptime_diff = new_diff;
|
||||
+}
|
||||
|
||||
/*
|
||||
* timeout - Schedule a timeout.
|
||||
@@ -1265,6 +1298,8 @@
|
||||
{
|
||||
struct callout *p;
|
||||
|
||||
+ check_time();
|
||||
+
|
||||
while (callout != NULL) {
|
||||
p = callout;
|
||||
|
||||
@@ -1292,6 +1327,8 @@
|
||||
{
|
||||
if (callout == NULL)
|
||||
return NULL;
|
||||
+
|
||||
+ check_time();
|
||||
|
||||
gettimeofday(&timenow, NULL);
|
||||
tvp->tv_sec = callout->c_time.tv_sec - timenow.tv_sec;
|
@ -1,19 +0,0 @@
|
||||
Index: ppp-2.4.3/pppd/lcp.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/lcp.c 2007-06-04 13:22:07.874658152 +0200
|
||||
+++ ppp-2.4.3/pppd/lcp.c 2007-06-04 13:22:13.945735208 +0200
|
||||
@@ -1891,12 +1891,12 @@
|
||||
* the interface MTU is set to the lowest of that, the
|
||||
* MTU we want to use, and our link MRU.
|
||||
*/
|
||||
- mtu = ho->neg_mru? ho->mru: PPP_MRU;
|
||||
+ mtu = MIN(ho->neg_mru? ho->mru: PPP_MRU, ao->mru);
|
||||
mru = go->neg_mru? MAX(wo->mru, go->mru): PPP_MRU;
|
||||
#ifdef HAVE_MULTILINK
|
||||
if (!(multilink && go->neg_mrru && ho->neg_mrru))
|
||||
#endif /* HAVE_MULTILINK */
|
||||
- netif_set_mtu(f->unit, MIN(MIN(mtu, mru), ao->mru));
|
||||
+ netif_set_mtu(f->unit, MIN(mtu, mru));
|
||||
ppp_send_config(f->unit, mtu,
|
||||
(ho->neg_asyncmap? ho->asyncmap: 0xffffffff),
|
||||
ho->neg_pcompression, ho->neg_accompression);
|
@ -1,8 +1,7 @@
|
||||
Index: ppp-2.4.3/pppd/Makefile.linux
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/Makefile.linux 2007-06-04 13:22:12.463960472 +0200
|
||||
+++ ppp-2.4.3/pppd/Makefile.linux 2007-06-04 13:22:14.133706632 +0200
|
||||
@@ -172,8 +172,8 @@
|
||||
diff -Naur ppp-2.4.4.orig/pppd/Makefile.linux ppp-2.4.4/pppd/Makefile.linux
|
||||
--- ppp-2.4.4.orig/pppd/Makefile.linux 2009-05-07 22:25:24.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/Makefile.linux 2009-05-07 22:28:44.000000000 -0400
|
||||
@@ -170,8 +170,8 @@
|
||||
|
||||
ifdef FILTER
|
||||
ifneq ($(wildcard /usr/include/pcap-bpf.h),)
|
||||
|
374
package/ppp/patches/310-precompile_filter.patch
Normal file
374
package/ppp/patches/310-precompile_filter.patch
Normal file
@ -0,0 +1,374 @@
|
||||
diff -Naur ppp-2.4.4.orig/pppd/Makefile.linux ppp-2.4.4/pppd/Makefile.linux
|
||||
--- ppp-2.4.4.orig/pppd/Makefile.linux 2009-05-07 22:31:54.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/Makefile.linux 2009-05-07 22:33:12.000000000 -0400
|
||||
@@ -50,6 +50,9 @@
|
||||
# and that the kernel driver support PPP packet filtering.
|
||||
#FILTER=y
|
||||
|
||||
+# Support for precompiled filters
|
||||
+PRECOMPILED_FILTER=y
|
||||
+
|
||||
# Uncomment the next line to enable multilink PPP (enabled by default)
|
||||
# Linux distributions: Please leave multilink ENABLED in your builds
|
||||
# of pppd!
|
||||
@@ -175,6 +178,14 @@
|
||||
endif
|
||||
endif
|
||||
|
||||
+ifdef PRECOMPILED_FILTER
|
||||
+PPPDSRCS += pcap_pcc.c
|
||||
+HEADERS += pcap_pcc.h
|
||||
+PPPDOBJS += pcap_pcc.o
|
||||
+LIBS += $(STAGING_DIR)/usr/lib/libpcap.a
|
||||
+CFLAGS += -DPPP_FILTER -DPPP_PRECOMPILED_FILTER -I$(STAGING_DIR)/usr/include
|
||||
+endif
|
||||
+
|
||||
ifdef HAVE_INET6
|
||||
PPPDSRCS += ipv6cp.c eui64.c
|
||||
HEADERS += ipv6cp.h eui64.h
|
||||
diff -Naur ppp-2.4.4.orig/pppd/options.c ppp-2.4.4/pppd/options.c
|
||||
--- ppp-2.4.4.orig/pppd/options.c 2009-05-07 22:25:24.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/options.c 2009-05-07 22:38:28.000000000 -0400
|
||||
@@ -57,6 +57,7 @@
|
||||
|
||||
#ifdef PPP_FILTER
|
||||
#include <pcap.h>
|
||||
+#include <pcap-bpf.h>
|
||||
/*
|
||||
* There have been 3 or 4 different names for this in libpcap CVS, but
|
||||
* this seems to be what they have settled on...
|
||||
@@ -160,6 +161,13 @@
|
||||
static int loadplugin __P((char **));
|
||||
#endif
|
||||
|
||||
+#ifdef PPP_PRECOMPILED_FILTER
|
||||
+#include "pcap_pcc.h"
|
||||
+static int setprecompiledpassfilter __P((char **));
|
||||
+static int setprecompiledactivefilter __P((char **));
|
||||
+#undef PPP_FILTER
|
||||
+#endif
|
||||
+
|
||||
#ifdef PPP_FILTER
|
||||
static int setpassfilter __P((char **));
|
||||
static int setactivefilter __P((char **));
|
||||
@@ -317,6 +325,14 @@
|
||||
"set filter for active pkts", OPT_PRIO },
|
||||
#endif
|
||||
|
||||
+#ifdef PPP_PRECOMPILED_FILTER
|
||||
+ { "precompiled-pass-filter", 1, setprecompiledpassfilter,
|
||||
+ "set precompiled filter for packets to pass", OPT_PRIO },
|
||||
+
|
||||
+ { "precompiled-active-filter", 1, setprecompiledactivefilter,
|
||||
+ "set precompiled filter for active pkts", OPT_PRIO },
|
||||
+#endif
|
||||
+
|
||||
#ifdef MAXOCTETS
|
||||
{ "maxoctets", o_int, &maxoctets,
|
||||
"Set connection traffic limit",
|
||||
@@ -1456,6 +1472,29 @@
|
||||
return ok;
|
||||
}
|
||||
|
||||
+#ifdef PPP_PRECOMPILED_FILTER
|
||||
+/*
|
||||
+ * setprecompiledpassfilter - Set the pass filter for packets using a
|
||||
+ * precompiled expression
|
||||
+ */
|
||||
+static int
|
||||
+setprecompiledpassfilter(argv)
|
||||
+ char **argv;
|
||||
+{
|
||||
+ return pcap_pre_compiled (*argv, &pass_filter);
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * setactivefilter - Set the active filter for packets
|
||||
+ */
|
||||
+static int
|
||||
+setprecompiledactivefilter(argv)
|
||||
+ char **argv;
|
||||
+{
|
||||
+ return pcap_pre_compiled (*argv, &active_filter);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
#ifdef PPP_FILTER
|
||||
/*
|
||||
* setpassfilter - Set the pass filter for packets
|
||||
diff -Naur ppp-2.4.4.orig/pppd/pcap_pcc.c ppp-2.4.4/pppd/pcap_pcc.c
|
||||
--- ppp-2.4.4.orig/pppd/pcap_pcc.c 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ ppp-2.4.4/pppd/pcap_pcc.c 2009-05-07 22:33:12.000000000 -0400
|
||||
@@ -0,0 +1,74 @@
|
||||
+#include <pcap.h>
|
||||
+#include <pcap-bpf.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <errno.h>
|
||||
+#include "pppd.h"
|
||||
+
|
||||
+int pcap_pre_compiled (char * fname, struct bpf_program *p)
|
||||
+{
|
||||
+ char buf[128];
|
||||
+ int line = 0, size = 0, index=0, ret=1;
|
||||
+ FILE *f = fopen (fname, "r");
|
||||
+ if (!f)
|
||||
+ {
|
||||
+ option_error("error opening precompiled active-filter '%s': %s",
|
||||
+ fname, strerror (errno));
|
||||
+ return 0;
|
||||
+ }
|
||||
+ while (fgets (buf, 127, f))
|
||||
+ {
|
||||
+ line++;
|
||||
+ if (*buf == '#')
|
||||
+ continue;
|
||||
+ if (size)
|
||||
+ {
|
||||
+ /*
|
||||
+ struct bpf_insn {
|
||||
+ u_short code;
|
||||
+ u_char jt;
|
||||
+ u_char jf;
|
||||
+ bpf_int32 k;
|
||||
+ }
|
||||
+ */
|
||||
+ struct bpf_insn * insn = & p->bf_insns[index];
|
||||
+ unsigned code, jt, jf, k;
|
||||
+ if (sscanf (buf, "%u %u %u %u", &code, &jt, &jf, &k) != 4)
|
||||
+ {
|
||||
+ goto err;
|
||||
+ }
|
||||
+ insn->code = code;
|
||||
+ insn->jt = jt;
|
||||
+ insn->jf = jf;
|
||||
+ insn->k = k;
|
||||
+ index++;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (sscanf (buf, "%u", &size) != 1)
|
||||
+ {
|
||||
+ goto err;
|
||||
+ }
|
||||
+ p->bf_len = size;
|
||||
+ p->bf_insns = (struct bpf_insn *)
|
||||
+ malloc (size * sizeof (struct bpf_insn));
|
||||
+ }
|
||||
+ }
|
||||
+ if (size != index)
|
||||
+ {
|
||||
+ option_error("error in precompiled active-filter,"
|
||||
+ " expected %d expressions, got %dn",
|
||||
+ size, index);
|
||||
+ ret = 0;
|
||||
+ }
|
||||
+ fclose(f);
|
||||
+ return ret;
|
||||
+
|
||||
+err:
|
||||
+ option_error("error in precompiled active-filter"
|
||||
+ " expression line %s:%d (wrong size)\n",
|
||||
+ fname, line);
|
||||
+ fclose (f);
|
||||
+ return 0;
|
||||
+}
|
||||
diff -Naur ppp-2.4.4.orig/pppd/pcap_pcc.h ppp-2.4.4/pppd/pcap_pcc.h
|
||||
--- ppp-2.4.4.orig/pppd/pcap_pcc.h 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ ppp-2.4.4/pppd/pcap_pcc.h 2009-05-07 22:33:12.000000000 -0400
|
||||
@@ -0,0 +1,7 @@
|
||||
+#ifndef PCAP_PCC_H
|
||||
+#define PCAP_PCC_H
|
||||
+
|
||||
+#include <pcap.h>
|
||||
+
|
||||
+int pcap_pre_compiled (char * fname, struct bpf_program *p);
|
||||
+#endif /* PCAP_PCC_H */
|
||||
diff -Naur ppp-2.4.4.orig/pppd/Makefile.linux ppp-2.4.4/pppd/Makefile.linux
|
||||
--- ppp-2.4.4.orig/pppd/Makefile.linux 2009-05-07 22:31:54.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/Makefile.linux 2009-05-07 22:33:12.000000000 -0400
|
||||
@@ -50,6 +50,9 @@
|
||||
# and that the kernel driver support PPP packet filtering.
|
||||
#FILTER=y
|
||||
|
||||
+# Support for precompiled filters
|
||||
+PRECOMPILED_FILTER=y
|
||||
+
|
||||
# Uncomment the next line to enable multilink PPP (enabled by default)
|
||||
# Linux distributions: Please leave multilink ENABLED in your builds
|
||||
# of pppd!
|
||||
@@ -175,6 +178,14 @@
|
||||
endif
|
||||
endif
|
||||
|
||||
+ifdef PRECOMPILED_FILTER
|
||||
+PPPDSRCS += pcap_pcc.c
|
||||
+HEADERS += pcap_pcc.h
|
||||
+PPPDOBJS += pcap_pcc.o
|
||||
+LIBS += $(STAGING_DIR)/usr/lib/libpcap.a
|
||||
+CFLAGS += -DPPP_FILTER -DPPP_PRECOMPILED_FILTER -I$(STAGING_DIR)/usr/include
|
||||
+endif
|
||||
+
|
||||
ifdef HAVE_INET6
|
||||
PPPDSRCS += ipv6cp.c eui64.c
|
||||
HEADERS += ipv6cp.h eui64.h
|
||||
diff -Naur ppp-2.4.4.orig/pppd/options.c ppp-2.4.4/pppd/options.c
|
||||
--- ppp-2.4.4.orig/pppd/options.c 2009-05-07 22:25:24.000000000 -0400
|
||||
+++ ppp-2.4.4/pppd/options.c 2009-05-07 22:38:28.000000000 -0400
|
||||
@@ -57,6 +57,7 @@
|
||||
|
||||
#ifdef PPP_FILTER
|
||||
#include <pcap.h>
|
||||
+#include <pcap-bpf.h>
|
||||
/*
|
||||
* There have been 3 or 4 different names for this in libpcap CVS, but
|
||||
* this seems to be what they have settled on...
|
||||
@@ -160,6 +161,13 @@
|
||||
static int loadplugin __P((char **));
|
||||
#endif
|
||||
|
||||
+#ifdef PPP_PRECOMPILED_FILTER
|
||||
+#include "pcap_pcc.h"
|
||||
+static int setprecompiledpassfilter __P((char **));
|
||||
+static int setprecompiledactivefilter __P((char **));
|
||||
+#undef PPP_FILTER
|
||||
+#endif
|
||||
+
|
||||
#ifdef PPP_FILTER
|
||||
static int setpassfilter __P((char **));
|
||||
static int setactivefilter __P((char **));
|
||||
@@ -317,6 +325,14 @@
|
||||
"set filter for active pkts", OPT_PRIO },
|
||||
#endif
|
||||
|
||||
+#ifdef PPP_PRECOMPILED_FILTER
|
||||
+ { "precompiled-pass-filter", 1, setprecompiledpassfilter,
|
||||
+ "set precompiled filter for packets to pass", OPT_PRIO },
|
||||
+
|
||||
+ { "precompiled-active-filter", 1, setprecompiledactivefilter,
|
||||
+ "set precompiled filter for active pkts", OPT_PRIO },
|
||||
+#endif
|
||||
+
|
||||
#ifdef MAXOCTETS
|
||||
{ "maxoctets", o_int, &maxoctets,
|
||||
"Set connection traffic limit",
|
||||
@@ -1456,6 +1472,29 @@
|
||||
return ok;
|
||||
}
|
||||
|
||||
+#ifdef PPP_PRECOMPILED_FILTER
|
||||
+/*
|
||||
+ * setprecompiledpassfilter - Set the pass filter for packets using a
|
||||
+ * precompiled expression
|
||||
+ */
|
||||
+static int
|
||||
+setprecompiledpassfilter(argv)
|
||||
+ char **argv;
|
||||
+{
|
||||
+ return pcap_pre_compiled (*argv, &pass_filter);
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * setactivefilter - Set the active filter for packets
|
||||
+ */
|
||||
+static int
|
||||
+setprecompiledactivefilter(argv)
|
||||
+ char **argv;
|
||||
+{
|
||||
+ return pcap_pre_compiled (*argv, &active_filter);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
#ifdef PPP_FILTER
|
||||
/*
|
||||
* setpassfilter - Set the pass filter for packets
|
||||
diff -Naur ppp-2.4.4.orig/pppd/pcap_pcc.c ppp-2.4.4/pppd/pcap_pcc.c
|
||||
--- ppp-2.4.4.orig/pppd/pcap_pcc.c 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ ppp-2.4.4/pppd/pcap_pcc.c 2009-05-07 22:33:12.000000000 -0400
|
||||
@@ -0,0 +1,74 @@
|
||||
+#include <pcap.h>
|
||||
+#include <pcap-bpf.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <errno.h>
|
||||
+#include "pppd.h"
|
||||
+
|
||||
+int pcap_pre_compiled (char * fname, struct bpf_program *p)
|
||||
+{
|
||||
+ char buf[128];
|
||||
+ int line = 0, size = 0, index=0, ret=1;
|
||||
+ FILE *f = fopen (fname, "r");
|
||||
+ if (!f)
|
||||
+ {
|
||||
+ option_error("error opening precompiled active-filter '%s': %s",
|
||||
+ fname, strerror (errno));
|
||||
+ return 0;
|
||||
+ }
|
||||
+ while (fgets (buf, 127, f))
|
||||
+ {
|
||||
+ line++;
|
||||
+ if (*buf == '#')
|
||||
+ continue;
|
||||
+ if (size)
|
||||
+ {
|
||||
+ /*
|
||||
+ struct bpf_insn {
|
||||
+ u_short code;
|
||||
+ u_char jt;
|
||||
+ u_char jf;
|
||||
+ bpf_int32 k;
|
||||
+ }
|
||||
+ */
|
||||
+ struct bpf_insn * insn = & p->bf_insns[index];
|
||||
+ unsigned code, jt, jf, k;
|
||||
+ if (sscanf (buf, "%u %u %u %u", &code, &jt, &jf, &k) != 4)
|
||||
+ {
|
||||
+ goto err;
|
||||
+ }
|
||||
+ insn->code = code;
|
||||
+ insn->jt = jt;
|
||||
+ insn->jf = jf;
|
||||
+ insn->k = k;
|
||||
+ index++;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (sscanf (buf, "%u", &size) != 1)
|
||||
+ {
|
||||
+ goto err;
|
||||
+ }
|
||||
+ p->bf_len = size;
|
||||
+ p->bf_insns = (struct bpf_insn *)
|
||||
+ malloc (size * sizeof (struct bpf_insn));
|
||||
+ }
|
||||
+ }
|
||||
+ if (size != index)
|
||||
+ {
|
||||
+ option_error("error in precompiled active-filter,"
|
||||
+ " expected %d expressions, got %dn",
|
||||
+ size, index);
|
||||
+ ret = 0;
|
||||
+ }
|
||||
+ fclose(f);
|
||||
+ return ret;
|
||||
+
|
||||
+err:
|
||||
+ option_error("error in precompiled active-filter"
|
||||
+ " expression line %s:%d (wrong size)\n",
|
||||
+ fname, line);
|
||||
+ fclose (f);
|
||||
+ return 0;
|
||||
+}
|
||||
diff -Naur ppp-2.4.4.orig/pppd/pcap_pcc.h ppp-2.4.4/pppd/pcap_pcc.h
|
||||
--- ppp-2.4.4.orig/pppd/pcap_pcc.h 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ ppp-2.4.4/pppd/pcap_pcc.h 2009-05-07 22:33:12.000000000 -0400
|
||||
@@ -0,0 +1,7 @@
|
||||
+#ifndef PCAP_PCC_H
|
||||
+#define PCAP_PCC_H
|
||||
+
|
||||
+#include <pcap.h>
|
||||
+
|
||||
+int pcap_pre_compiled (char * fname, struct bpf_program *p);
|
||||
+#endif /* PCAP_PCC_H */
|
@ -1,236 +0,0 @@
|
||||
Index: ppp-2.4.3/pppd/Makefile.linux
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/Makefile.linux 2007-06-04 13:22:14.133706632 +0200
|
||||
+++ ppp-2.4.3/pppd/Makefile.linux 2007-06-04 13:22:14.320678208 +0200
|
||||
@@ -50,6 +50,9 @@
|
||||
# and that the kernel driver support PPP packet filtering.
|
||||
#FILTER=y
|
||||
|
||||
+# Support for precompiled filters
|
||||
+PRECOMPILED_FILTER=y
|
||||
+
|
||||
# Uncomment the next line to enable multilink PPP (enabled by default)
|
||||
# Linux distributions: Please leave multilink ENABLED in your builds
|
||||
# of pppd!
|
||||
@@ -177,6 +180,14 @@
|
||||
endif
|
||||
endif
|
||||
|
||||
+ifdef PRECOMPILED_FILTER
|
||||
+PPPDSRCS += pcap_pcc.c
|
||||
+HEADERS += pcap_pcc.h
|
||||
+PPPDOBJS += pcap_pcc.o
|
||||
+LIBS += $(STAGING_DIR)/usr/lib/libpcap.a
|
||||
+CFLAGS += -DPPP_FILTER -DPPP_PRECOMPILED_FILTER -I$(STAGING_DIR)/usr/include
|
||||
+endif
|
||||
+
|
||||
ifdef HAVE_INET6
|
||||
PPPDSRCS += ipv6cp.c eui64.c
|
||||
HEADERS += ipv6cp.h eui64.h
|
||||
Index: ppp-2.4.3/pppd/demand.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/demand.c 2007-06-04 13:22:11.613089824 +0200
|
||||
+++ ppp-2.4.3/pppd/demand.c 2007-06-04 13:22:14.320678208 +0200
|
||||
@@ -438,12 +438,14 @@
|
||||
return 0;
|
||||
proto = PPP_PROTOCOL(p);
|
||||
#ifdef PPP_FILTER
|
||||
+ *p = 1; /* set outbound for the filter rule */
|
||||
if (pass_filter.bf_len != 0
|
||||
&& bpf_filter(pass_filter.bf_insns, p, len, len) == 0)
|
||||
return 0;
|
||||
if (active_filter.bf_len != 0
|
||||
&& bpf_filter(active_filter.bf_insns, p, len, len) == 0)
|
||||
return 0;
|
||||
+ *p = 0xff; /* restore original ppp header */
|
||||
#endif
|
||||
for (i = 0; (protp = protocols[i]) != NULL; ++i) {
|
||||
if (protp->protocol < 0xC000 && (protp->protocol & ~0x8000) == proto) {
|
||||
Index: ppp-2.4.3/pppd/options.c
|
||||
===================================================================
|
||||
--- ppp-2.4.3.orig/pppd/options.c 2007-06-04 13:22:09.005486240 +0200
|
||||
+++ ppp-2.4.3/pppd/options.c 2007-06-04 13:22:14.321678056 +0200
|
||||
@@ -57,14 +57,7 @@
|
||||
|
||||
#ifdef PPP_FILTER
|
||||
#include <pcap.h>
|
||||
-/*
|
||||
- * DLT_PPP_WITH_DIRECTION is in current libpcap cvs, and should be in
|
||||
- * libpcap-0.8.4. Until that is released, use DLT_PPP - but that means
|
||||
- * we lose the inbound and outbound qualifiers.
|
||||
- */
|
||||
-#ifndef DLT_PPP_WITH_DIRECTION
|
||||
-#define DLT_PPP_WITH_DIRECTION DLT_PPP
|
||||
-#endif
|
||||
+#include <pcap-bpf.h>
|
||||
#endif
|
||||
|
||||
#include "pppd.h"
|
||||
@@ -155,6 +148,13 @@
|
||||
static int loadplugin __P((char **));
|
||||
#endif
|
||||
|
||||
+#ifdef PPP_PRECOMPILED_FILTER
|
||||
+#include "pcap_pcc.h"
|
||||
+static int setprecompiledpassfilter __P((char **));
|
||||
+static int setprecompiledactivefilter __P((char **));
|
||||
+#undef PPP_FILTER
|
||||
+#endif
|
||||
+
|
||||
#ifdef PPP_FILTER
|
||||
static int setpassfilter __P((char **));
|
||||
static int setactivefilter __P((char **));
|
||||
@@ -312,6 +312,14 @@
|
||||
"set filter for active pkts", OPT_PRIO },
|
||||
#endif
|
||||
|
||||
+#ifdef PPP_PRECOMPILED_FILTER
|
||||
+ { "precompiled-pass-filter", 1, setprecompiledpassfilter,
|
||||
+ "set precompiled filter for packets to pass", OPT_PRIO },
|
||||
+
|
||||
+ { "precompiled-active-filter", 1, setprecompiledactivefilter,
|
||||
+ "set precompiled filter for active pkts", OPT_PRIO },
|
||||
+#endif
|
||||
+
|
||||
#ifdef MAXOCTETS
|
||||
{ "maxoctets", o_int, &maxoctets,
|
||||
"Set connection traffic limit",
|
||||
@@ -1447,6 +1455,29 @@
|
||||
return ok;
|
||||
}
|
||||
|
||||
+#ifdef PPP_PRECOMPILED_FILTER
|
||||
+/*
|
||||
+ * setprecompiledpassfilter - Set the pass filter for packets using a
|
||||
+ * precompiled expression
|
||||
+ */
|
||||
+static int
|
||||
+setprecompiledpassfilter(argv)
|
||||
+ char **argv;
|
||||
+{
|
||||
+ return pcap_pre_compiled (*argv, &pass_filter);
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * setactivefilter - Set the active filter for packets
|
||||
+ */
|
||||
+static int
|
||||
+setprecompiledactivefilter(argv)
|
||||
+ char **argv;
|
||||
+{
|
||||
+ return pcap_pre_compiled (*argv, &active_filter);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
#ifdef PPP_FILTER
|
||||
/*
|
||||
* setpassfilter - Set the pass filter for packets
|
||||
@@ -1458,7 +1489,7 @@
|
||||
pcap_t *pc;
|
||||
int ret = 0;
|
||||
|
||||
- pc = pcap_open_dead(DLT_PPP_WITH_DIRECTION, 65535);
|
||||
+ pc = pcap_open_dead(DLT_PPP_PPPD, 65535);
|
||||
if (pcap_compile(pc, &pass_filter, *argv, 1, netmask) == -1) {
|
||||
option_error("error in pass-filter expression: %s\n",
|
||||
pcap_geterr(pc));
|
||||
@@ -1479,7 +1510,7 @@
|
||||
pcap_t *pc;
|
||||
int ret = 0;
|
||||
|
||||
- pc = pcap_open_dead(DLT_PPP_WITH_DIRECTION, 65535);
|
||||
+ pc = pcap_open_dead(DLT_PPP_PPPD, 65535);
|
||||
if (pcap_compile(pc, &active_filter, *argv, 1, netmask) == -1) {
|
||||
option_error("error in active-filter expression: %s\n",
|
||||
pcap_geterr(pc));
|
||||
Index: ppp-2.4.3/pppd/pcap_pcc.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ ppp-2.4.3/pppd/pcap_pcc.c 2007-06-04 13:22:14.321678056 +0200
|
||||
@@ -0,0 +1,74 @@
|
||||
+#include <pcap.h>
|
||||
+#include <pcap-bpf.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <errno.h>
|
||||
+#include "pppd.h"
|
||||
+
|
||||
+int pcap_pre_compiled (char * fname, struct bpf_program *p)
|
||||
+{
|
||||
+ char buf[128];
|
||||
+ int line = 0, size = 0, index=0, ret=1;
|
||||
+ FILE *f = fopen (fname, "r");
|
||||
+ if (!f)
|
||||
+ {
|
||||
+ option_error("error opening precompiled active-filter '%s': %s",
|
||||
+ fname, strerror (errno));
|
||||
+ return 0;
|
||||
+ }
|
||||
+ while (fgets (buf, 127, f))
|
||||
+ {
|
||||
+ line++;
|
||||
+ if (*buf == '#')
|
||||
+ continue;
|
||||
+ if (size)
|
||||
+ {
|
||||
+ /*
|
||||
+ struct bpf_insn {
|
||||
+ u_short code;
|
||||
+ u_char jt;
|
||||
+ u_char jf;
|
||||
+ bpf_int32 k;
|
||||
+ }
|
||||
+ */
|
||||
+ struct bpf_insn * insn = & p->bf_insns[index];
|
||||
+ unsigned code, jt, jf, k;
|
||||
+ if (sscanf (buf, "%u %u %u %u", &code, &jt, &jf, &k) != 4)
|
||||
+ {
|
||||
+ goto err;
|
||||
+ }
|
||||
+ insn->code = code;
|
||||
+ insn->jt = jt;
|
||||
+ insn->jf = jf;
|
||||
+ insn->k = k;
|
||||
+ index++;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (sscanf (buf, "%u", &size) != 1)
|
||||
+ {
|
||||
+ goto err;
|
||||
+ }
|
||||
+ p->bf_len = size;
|
||||
+ p->bf_insns = (struct bpf_insn *)
|
||||
+ malloc (size * sizeof (struct bpf_insn));
|
||||
+ }
|
||||
+ }
|
||||
+ if (size != index)
|
||||
+ {
|
||||
+ option_error("error in precompiled active-filter,"
|
||||
+ " expected %d expressions, got %dn",
|
||||
+ size, index);
|
||||
+ ret = 0;
|
||||
+ }
|
||||
+ fclose(f);
|
||||
+ return ret;
|
||||
+
|
||||
+err:
|
||||
+ option_error("error in precompiled active-filter"
|
||||
+ " expression line %s:%d (wrong size)\n",
|
||||
+ fname, line);
|
||||
+ fclose (f);
|
||||
+ return 0;
|
||||
+}
|
||||
Index: ppp-2.4.3/pppd/pcap_pcc.h
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ ppp-2.4.3/pppd/pcap_pcc.h 2007-06-04 13:22:14.321678056 +0200
|
||||
@@ -0,0 +1,7 @@
|
||||
+#ifndef PCAP_PCC_H
|
||||
+#define PCAP_PCC_H
|
||||
+
|
||||
+#include <pcap.h>
|
||||
+
|
||||
+int pcap_pre_compiled (char * fname, struct bpf_program *p);
|
||||
+#endif /* PCAP_PCC_H */
|
Loading…
Reference in New Issue
Block a user