Patch for ppp

This commit is contained in:
Paul Wouters
2019-03-20 11:46:49 +01:00
parent 82bf0232f3
commit cd191c0146
+115
View File
@@ -0,0 +1,115 @@
diff -Naur ppp-2.4.7-orig/pppd/auth.c ppp-2.4.7/pppd/auth.c
--- ppp-2.4.7-orig/pppd/auth.c 2019-03-20 11:42:28.592600096 +0100
+++ ppp-2.4.7/pppd/auth.c 2019-03-20 11:44:20.838152905 +0100
@@ -2071,10 +2071,6 @@
{
int ok;
- /* don't allow loopback or multicast address */
- if (bad_ip_adrs(addr))
- return 0;
-
if (allowed_address_hook) {
ok = allowed_address_hook(addr);
if (ok >= 0) return ok;
@@ -2102,20 +2098,6 @@
}
/*
- * bad_ip_adrs - return 1 if the IP address is one we don't want
- * to use, such as an address in the loopback net or a multicast address.
- * addr is in network byte order.
- */
-int
-bad_ip_adrs(addr)
- u_int32_t addr;
-{
- addr = ntohl(addr);
- return (addr >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET
- || IN_MULTICAST(addr) || IN_BADCLASS(addr);
-}
-
-/*
* some_ip_ok - check a wordlist to see if it authorizes any
* IP address(es).
*/
diff -Naur ppp-2.4.7-orig/pppd/ipcp.c ppp-2.4.7/pppd/ipcp.c
--- ppp-2.4.7-orig/pppd/ipcp.c 2014-08-09 14:31:39.000000000 +0200
+++ ppp-2.4.7/pppd/ipcp.c 2019-03-20 11:45:00.529475366 +0100
@@ -444,10 +444,6 @@
}
local = *(u_int32_t *)hp->h_addr;
}
- if (bad_ip_adrs(local)) {
- option_error("bad local IP address %s", ip_ntoa(local));
- return 0;
- }
if (local != 0)
wo->ouraddr = local;
*colon = ':';
@@ -467,10 +463,6 @@
if (remote_name[0] == 0)
strlcpy(remote_name, colon, sizeof(remote_name));
}
- if (bad_ip_adrs(remote)) {
- option_error("bad remote IP address %s", ip_ntoa(remote));
- return 0;
- }
if (remote != 0)
wo->hisaddr = remote;
prio_remote = option_priority;
@@ -1724,7 +1716,7 @@
wo->accept_local = 1; /* don't insist on this default value */
if ((hp = gethostbyname(hostname)) != NULL) {
local = *(u_int32_t *)hp->h_addr;
- if (local != 0 && !bad_ip_adrs(local))
+ if (local != 0)
wo->ouraddr = local;
}
}
diff -Naur ppp-2.4.7-orig/pppd/multilink.c ppp-2.4.7/pppd/multilink.c
--- ppp-2.4.7-orig/pppd/multilink.c 2019-03-20 11:42:28.593600091 +0100
+++ ppp-2.4.7/pppd/multilink.c 2019-03-20 11:45:27.802685492 +0100
@@ -456,7 +456,7 @@
hp = gethostbyname(hostname);
if (hp != NULL) {
addr = *(u_int32_t *)hp->h_addr;
- if (!bad_ip_adrs(addr)) {
+ {
addr = ntohl(addr);
if (!LOCAL_IP_ADDR(addr)) {
ep->class = EPD_IP;
diff -Naur ppp-2.4.7-orig/pppd/pppd.h ppp-2.4.7/pppd/pppd.h
--- ppp-2.4.7-orig/pppd/pppd.h 2019-03-20 11:42:28.587600118 +0100
+++ ppp-2.4.7/pppd/pppd.h 2019-03-20 11:45:32.180719223 +0100
@@ -580,8 +580,6 @@
int auth_ip_addr __P((int, u_int32_t));
/* check if IP address is authorized */
int auth_number __P((void)); /* check if remote number is authorized */
-int bad_ip_adrs __P((u_int32_t));
- /* check if IP address is unreasonable */
/* Procedures exported from demand.c */
void demand_conf __P((void)); /* config interface(s) for demand-dial */
diff -Naur ppp-2.4.7-orig/pppd/sys-linux.c ppp-2.4.7/pppd/sys-linux.c
--- ppp-2.4.7-orig/pppd/sys-linux.c 2019-03-20 11:42:28.594600087 +0100
+++ ppp-2.4.7/pppd/sys-linux.c 2019-03-20 11:45:35.681746196 +0100
@@ -2007,7 +2007,6 @@
else
nmask = IN_CLASSC_NET;
- /* class D nets are disallowed by bad_ip_adrs */
mask = netmask | htonl(nmask);
/*
* Scan through the system's network interfaces.
diff -Naur ppp-2.4.7-orig/pppd/sys-solaris.c ppp-2.4.7/pppd/sys-solaris.c
--- ppp-2.4.7-orig/pppd/sys-solaris.c 2014-08-09 14:31:39.000000000 +0200
+++ ppp-2.4.7/pppd/sys-solaris.c 2019-03-20 11:45:38.623768863 +0100
@@ -2406,7 +2406,6 @@
nmask = IN_CLASSB_NET;
else
nmask = IN_CLASSC_NET;
- /* class D nets are disallowed by bad_ip_adrs */
mask = netmask | htonl(nmask);
/*