include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=ppp
-PKG_RELEASE:=2
+PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/paulusmack/ppp
-PKG_SOURCE_DATE:=2019-10-04
-PKG_SOURCE_VERSION:=0d004db25edd42f6720f48eedc51f68a781278db
-PKG_MIRROR_HASH:=93f66ee06d58c447288c88ac1c17453c2b12a8af7f16ef132b31529b1955b7a2
+PKG_SOURCE_VERSION:=78cd384ce0f48bb5edb84e4fe9a574eab4a4ad14
+PKG_MIRROR_HASH:=cf284c312b0c90974d11f8aeece173bcac8475f5b810911f4feb2c5a4db263fe
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=BSD-4-Clause
PKG_CPE_ID:=cpe:/a:samba:ppp
-PKG_RELEASE_VERSION:=2.4.7
-PKG_VERSION:=$(PKG_RELEASE_VERSION).git-$(PKG_SOURCE_DATE)
+PKG_RELEASE_VERSION:=2.4.8
+PKG_VERSION:=$(PKG_RELEASE_VERSION)
PKG_BUILD_DEPENDS:=libpcap
"Enable multilink operation", OPT_PRIO | 1 },
--- a/pppd/pppd.h
+++ b/pppd/pppd.h
-@@ -332,6 +332,8 @@ extern int connect_delay; /* Time to del
+@@ -334,6 +334,8 @@ extern int connect_delay; /* Time to del
extern int max_data_rate; /* max bytes/sec through charshunt */
extern int req_unit; /* interface unit number to use */
extern char req_ifname[MAXIFNAMELEN]; /* interface name to use */
--- a/pppd/sys-linux.c
+++ b/pppd/sys-linux.c
-@@ -460,6 +460,13 @@ int generic_establish_ppp (int fd)
+@@ -467,6 +467,13 @@ int generic_establish_ppp (int fd)
if (new_style_driver) {
int flags;
--- a/pppd/main.c
+++ b/pppd/main.c
-@@ -776,8 +776,7 @@ detach()
+@@ -780,8 +780,7 @@ detach()
/* update pid files if they have been written already */
if (pidfilename[0])
create_pidfile(pid);
} else {
--- a/pppd/ipv6cp.c
+++ b/pppd/ipv6cp.c
-@@ -1231,7 +1231,7 @@ ipv6cp_up(f)
- }
-
+@@ -1252,7 +1252,7 @@ ipv6cp_up(f)
+ if (sif6defaultroute(f->unit, go->ourid, ho->hisid))
+ default_route_set[f->unit] = 1;
}
- demand_rexmit(PPP_IPV6);
+ demand_rexmit(PPP_IPV6,0);
} else {
--- a/pppd/pppd.h
+++ b/pppd/pppd.h
-@@ -599,7 +599,7 @@ void demand_conf __P((void)); /* config
+@@ -601,7 +601,7 @@ void demand_conf __P((void)); /* config
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 */
bool old_vj; /* use old (short) form of VJ option? */
--- a/pppd/pppd.8
+++ b/pppd/pppd.8
-@@ -127,6 +127,11 @@ is no other default route with the same
- value of -1, the route is only added if there is no default route at
- all.
+@@ -133,6 +133,11 @@ the gateway, when IPv6CP negotiation is
+ This entry is removed when the PPP connection is broken. This option
+ is privileged if the \fInodefaultroute6\fR option has been specified.
.TP
+.B replacedefaultroute
+This option is a flag to the defaultroute option. If defaultroute is
.B disconnect \fIscript
Execute the command specified by \fIscript\fR, by passing it to a
shell, after
-@@ -740,7 +745,12 @@ disable both forms of hardware flow cont
+@@ -746,7 +751,12 @@ disable both forms of hardware flow cont
.TP
.B nodefaultroute
Disable the \fIdefaultroute\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
+ .B nodefaultroute6
--- a/pppd/pppd.h
+++ b/pppd/pppd.h
-@@ -681,7 +681,7 @@ int sif6addr __P((int, eui64_t, eui64_t
+@@ -683,7 +683,7 @@ int sif6addr __P((int, eui64_t, eui64_t
int cif6addr __P((int, eui64_t, eui64_t));
/* Remove an IPv6 address from i/f */
#endif
/* Delete default route through i/f */
--- a/pppd/sys-linux.c
+++ b/pppd/sys-linux.c
-@@ -207,6 +207,8 @@ static unsigned char inbuf[512]; /* buff
- static int if_is_up; /* Interface has been marked up */
+@@ -209,6 +209,8 @@ static int if_is_up; /* Interface has be
static int if6_is_up; /* Interface has been marked up for IPv6, to help differentiate */
static int have_default_route; /* Gateway for default route added */
+ static int have_default_route6; /* Gateway for default IPv6 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 */
-@@ -1570,6 +1572,9 @@ static int read_route_table(struct rtent
+@@ -1577,6 +1579,9 @@ static int read_route_table(struct rtent
p = NULL;
}
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);
-@@ -1642,20 +1647,52 @@ int have_route_to(u_int32_t addr)
+@@ -1649,20 +1654,52 @@ int have_route_to(u_int32_t addr)
/********************************************************************
*
* sifdefaultroute - assign a default route through the address given.
}
memset (&rt, 0, sizeof (rt));
-@@ -1671,10 +1708,16 @@ int sifdefaultroute (int unit, u_int32_t
+@@ -1678,10 +1715,16 @@ int sifdefaultroute (int unit, u_int32_t
rt.rt_flags = RTF_UP;
if (ioctl(sock_fd, SIOCADDRT, &rt) < 0) {
have_default_route = 1;
return 1;
-@@ -1708,11 +1751,21 @@ int cifdefaultroute (int unit, u_int32_t
+@@ -1715,11 +1758,21 @@ int cifdefaultroute (int unit, u_int32_t
rt.rt_flags = RTF_UP;
if (ioctl(sock_fd, SIOCDELRT, &rt) < 0 && errno != ESRCH) {
if (still_ppp()) {
}
--- a/pppd/sys-solaris.c
+++ b/pppd/sys-solaris.c
-@@ -2038,12 +2038,18 @@ cifaddr(u, o, h)
+@@ -2119,12 +2119,18 @@ cifaddr(u, o, h)
* sifdefaultroute - assign a default route through the address given.
*/
int
"Enable multilink operation", OPT_PRIO | 1 },
--- a/pppd/ipv6cp.c
+++ b/pppd/ipv6cp.c
-@@ -1268,7 +1268,7 @@ ipv6cp_up(f)
+@@ -1294,7 +1294,7 @@ ipv6cp_up(f)
*/
if (ipv6cp_script_state == s_down && ipv6cp_script_pid == 0) {
ipv6cp_script_state = s_up;
}
}
-@@ -1320,7 +1320,7 @@ ipv6cp_down(f)
+@@ -1346,7 +1346,7 @@ ipv6cp_down(f)
/* Execute the ipv6-down script */
if (ipv6cp_script_state == s_up && ipv6cp_script_pid == 0) {
ipv6cp_script_state = s_down;
}
}
-@@ -1363,13 +1363,13 @@ ipv6cp_script_done(arg)
+@@ -1389,13 +1389,13 @@ ipv6cp_script_done(arg)
case s_up:
if (ipv6cp_fsm[0].state != OPENED) {
ipv6cp_script_state = s_down;
}
--- a/pppd/pppd.h
+++ b/pppd/pppd.h
-@@ -334,6 +334,8 @@ extern int req_unit; /* interface unit n
+@@ -336,6 +336,8 @@ extern int req_unit; /* interface unit n
extern char req_ifname[MAXIFNAMELEN]; /* interface name to use */
extern char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */
extern char path_ipdown[MAXPATHLEN]; /* pathname of ip-down script */
*/
--- a/pppd/pppd.8
+++ b/pppd/pppd.8
-@@ -569,6 +569,11 @@ to 1) if the \fIproxyarp\fR option is us
+@@ -575,6 +575,11 @@ to 1) if the \fIproxyarp\fR option is us
dynamic IP address option (i.e. set /proc/sys/net/ipv4/ip_dynaddr to
1) in demand mode if the local address changes.
.TP
--- a/pppd/sha1.c
+++ b/pppd/sha1.c
-@@ -18,7 +18,7 @@
-
+@@ -19,7 +19,7 @@
#include <string.h>
+ #include <time.h>
#include <netinet/in.h> /* htonl() */
-#include <net/ppp_defs.h>
+#include "pppd.h"
#LIBS += -lshadow $(LIBS)
endif
--ifneq ($(wildcard $(shell $CC --print-sysroot)/usr/include/crypt.h),)
-+#ifneq ($(wildcard $(shell $CC --print-sysroot)/usr/include/crypt.h),)
+-ifneq ($(wildcard $(shell $(CC) --print-sysroot)/usr/include/crypt.h),)
++#ifneq ($(wildcard $(shell $(CC) --print-sysroot)/usr/include/crypt.h),)
CFLAGS += -DHAVE_CRYPT_H=1
LIBS += -lcrypt
-endif
gettimeofday(&start_time, NULL);
script_unsetenv("CONNECT_TIME");
script_unsetenv("BYTES_SENT");
-@@ -1270,6 +1273,36 @@ struct callout {
+@@ -1274,6 +1277,36 @@ struct callout {
static struct callout *callout = NULL; /* Callout list */
static struct timeval timenow; /* Current time */
/*
* timeout - Schedule a timeout.
-@@ -1340,6 +1373,8 @@ calltimeout()
+@@ -1344,6 +1377,8 @@ calltimeout()
{
struct callout *p;
while (callout != NULL) {
p = callout;
-@@ -1367,6 +1402,8 @@ timeleft(tvp)
+@@ -1371,6 +1406,8 @@ timeleft(tvp)
{
if (callout == NULL)
return NULL;
--- a/pppd/main.c
+++ b/pppd/main.c
-@@ -1051,7 +1051,8 @@ get_input()
+@@ -1055,7 +1055,8 @@ get_input()
}
notice("Modem hangup");
hungup = 1;
#ifdef MAXOCTETS
{ "maxoctets", o_int, &maxoctets,
"Set connection traffic limit",
-@@ -1510,6 +1526,29 @@ callfile(argv)
+@@ -1511,6 +1527,29 @@ callfile(argv)
return ok;
}
/* make sure the string is null-terminated */
rec.dptr[rec.dsize-1] = 0;
- /* parse the interface number */
-- parse_num(rec.dptr, "IFNAME=ppp", &unit);
+- parse_num(rec.dptr, "UNIT=", &unit);
+
/* check the pid value */
if (!parse_num(rec.dptr, "PPPD_PID=", &pppd_pid)
TDB_DATA kd, vd;
int ret = 0;
-- slprintf(ifkey, sizeof(ifkey), "IFNAME=ppp%d", unit);
+- slprintf(ifkey, sizeof(ifkey), "UNIT=%d", unit);
+ slprintf(ifkey, sizeof(ifkey), "IFNAME=%s", ifname);
+
kd.dptr = ifkey;
&& memcmp(vd.dptr, key.dptr, vd.dsize) == 0;
--- a/pppd/sys-linux.c
+++ b/pppd/sys-linux.c
-@@ -693,6 +693,16 @@ void cfg_bundle(int mrru, int mtru, int
+@@ -700,6 +700,16 @@ void cfg_bundle(int mrru, int mtru, int
add_fd(ppp_dev_fd);
}
/*
* make_new_bundle - create a new PPP unit (i.e. a bundle)
* and connect our channel to it. This should only get called
-@@ -711,6 +721,8 @@ void make_new_bundle(int mrru, int mtru,
+@@ -718,6 +728,8 @@ void make_new_bundle(int mrru, int mtru,
/* set the mrru and flags */
cfg_bundle(mrru, mtru, rssn, tssn);
--- a/pppd/sys-linux.c
+++ b/pppd/sys-linux.c
-@@ -1760,6 +1760,7 @@ int cifdefaultroute (int unit, u_int32_t
+@@ -1767,6 +1767,7 @@ int cifdefaultroute (int unit, u_int32_t
SIN_ADDR(rt.rt_genmask) = 0L;
}
--- a/pppd/sys-linux.c
+++ b/pppd/sys-linux.c
-@@ -1710,6 +1710,9 @@ int sifdefaultroute (int unit, u_int32_t
+@@ -1717,6 +1717,9 @@ int sifdefaultroute (int unit, u_int32_t
memset (&rt, 0, sizeof (rt));
SET_SA_FAMILY (rt.rt_dst, AF_INET);
rt.rt_dev = ifname;
rt.rt_metric = dfl_route_metric + 1; /* +1 for binary compatibility */
-@@ -1718,7 +1721,7 @@ int sifdefaultroute (int unit, u_int32_t
+@@ -1725,7 +1728,7 @@ int sifdefaultroute (int unit, u_int32_t
SIN_ADDR(rt.rt_genmask) = 0L;
}
--- a/pppd/sys-linux.c
+++ b/pppd/sys-linux.c
-@@ -199,7 +199,7 @@ static int driver_is_old = 0;
+@@ -200,7 +200,7 @@ static int driver_is_old = 0;
static int restore_term = 0; /* 1 => we've munged the terminal */
static struct termios inittermios; /* Initial TTY termios */
static char loop_name[20];
static unsigned char inbuf[512]; /* buffer for chars read from loopback */
-@@ -217,8 +217,8 @@ static int looped; /* 1 if using loop
+@@ -219,8 +219,8 @@ static int looped; /* 1 if using loop
static int link_mtu; /* mtu for the link (not bundle) */
static struct utsname utsname; /* for the kernel version */
#define MAX_IFS 100
-@@ -1446,11 +1446,12 @@ int ccp_fatal_error (int unit)
+@@ -1453,11 +1453,12 @@ int ccp_fatal_error (int unit)
*
* path_to_procfs - find the path to the proc file system mount point
*/
struct mntent *mntent;
FILE *fp;
-@@ -1472,6 +1473,7 @@ static char *path_to_procfs(const char *
+@@ -1479,6 +1480,7 @@ static char *path_to_procfs(const char *
fclose (fp);
}
}
strlcpy(proc_path + proc_path_len, tail,
sizeof(proc_path) - proc_path_len);
-@@ -2133,15 +2135,19 @@ int ppp_available(void)
+@@ -2332,15 +2334,19 @@ int ppp_available(void)
int my_version, my_modification, my_patch;
int osmaj, osmin, ospatch;
/* XXX should get from driver */
driver_version = 2;
-@@ -2201,6 +2207,7 @@ int ppp_available(void)
+@@ -2400,6 +2406,7 @@ int ppp_available(void)
if (ok && ((ifr.ifr_hwaddr.sa_family & ~0xFF) != ARPHRD_PPP))
ok = 0;
/*
* This is the PPP device. Validate the version of the driver at this
-@@ -2737,6 +2744,7 @@ get_pty(master_fdp, slave_fdp, slave_nam
+@@ -2936,6 +2943,7 @@ get_pty(master_fdp, slave_fdp, slave_nam
}
#endif /* TIOCGPTN */
if (sfd < 0) {
/* the old way - scan through the pty name space */
for (i = 0; i < 64; ++i) {
-@@ -2755,6 +2763,7 @@ get_pty(master_fdp, slave_fdp, slave_nam
+@@ -2954,6 +2962,7 @@ get_pty(master_fdp, slave_fdp, slave_nam
}
}
}
char *pppd_pppoe_service = NULL;
static char *acName = NULL;
static char *existingSession = NULL;
-@@ -392,10 +389,6 @@ PPPoEDevnameHook(char *cmd, char **argv,
+@@ -394,10 +391,6 @@ PPPoEDevnameHook(char *cmd, char **argv,
void
plugin_init(void)
{
--- a/pppd/pppd.h
+++ b/pppd/pppd.h
-@@ -323,7 +323,6 @@ extern int holdoff; /* Dead time before
+@@ -325,7 +325,6 @@ extern int holdoff; /* Dead time before
extern bool holdoff_specified; /* true if user gave a holdoff value */
extern bool notty; /* Stdin/out is not a tty */
extern char *pty_socket; /* Socket to connect to pty */
--- a/pppd/sys-linux.c
+++ b/pppd/sys-linux.c
-@@ -2271,6 +2271,7 @@ int ppp_available(void)
+@@ -2470,6 +2470,7 @@ int ppp_available(void)
void logwtmp (const char *line, const char *name, const char *host)
{
struct utmp ut, *utp;
pid_t mypid = getpid();
#if __GLIBC__ < 2
-@@ -2336,6 +2337,7 @@ void logwtmp (const char *line, const ch
+@@ -2535,6 +2536,7 @@ void logwtmp (const char *line, const ch
close (wtmp);
}
#endif
--- a/pppd/main.c
+++ b/pppd/main.c
-@@ -882,14 +882,17 @@ struct protocol_list {
+@@ -886,14 +886,17 @@ struct protocol_list {
const char *name;
} protocol_list[] = {
{ 0x21, "IP" },
{ 0x33, "Stream Protocol ST-II" },
{ 0x35, "Banyan Vines" },
{ 0x39, "AppleTalk EDDP" },
-@@ -903,8 +906,11 @@ struct protocol_list {
+@@ -907,8 +910,11 @@ struct protocol_list {
{ 0x49, "Serial Data Transport Protocol (PPP-SDTP)" },
{ 0x4b, "SNA over 802.2" },
{ 0x4d, "SNA" },
{ 0x53, "Encryption" },
{ 0x55, "Individual Link Encryption" },
{ 0x57, "IPv6" },
-@@ -915,12 +921,15 @@ struct protocol_list {
+@@ -919,12 +925,15 @@ struct protocol_list {
{ 0x65, "RTP IPHC Compressed non-TCP" },
{ 0x67, "RTP IPHC Compressed UDP 8" },
{ 0x69, "RTP IPHC Compressed RTP 8" },
{ 0x0203, "IBM Source Routing BPDU" },
{ 0x0205, "DEC LANBridge100 Spanning Tree" },
{ 0x0207, "Cisco Discovery Protocol" },
-@@ -932,15 +941,19 @@ struct protocol_list {
+@@ -936,15 +945,19 @@ struct protocol_list {
{ 0x0231, "Luxcom" },
{ 0x0233, "Sigma Network Systems" },
{ 0x0235, "Apple Client Server Protocol" },
{ 0x4001, "Cray Communications Control Protocol" },
{ 0x4003, "CDPD Mobile Network Registration Protocol" },
{ 0x4005, "Expand accelerator protocol" },
-@@ -951,8 +964,10 @@ struct protocol_list {
+@@ -955,8 +968,10 @@ struct protocol_list {
{ 0x4023, "RefTek Protocol" },
{ 0x4025, "Fibre Channel" },
{ 0x4027, "EMIT Protocols" },
{ 0x8023, "OSI Network Layer Control Protocol" },
{ 0x8025, "Xerox NS IDP Control Protocol" },
{ 0x8027, "DECnet Phase IV Control Protocol" },
-@@ -961,7 +976,9 @@ struct protocol_list {
+@@ -965,7 +980,9 @@ struct protocol_list {
{ 0x8031, "Bridging NCP" },
{ 0x8033, "Stream Protocol Control Protocol" },
{ 0x8035, "Banyan Vines Control Protocol" },
{ 0x803f, "NETBIOS Framing Control Protocol" },
{ 0x8041, "Cisco Systems Control Protocol" },
{ 0x8043, "Ascom Timeplex" },
-@@ -970,18 +987,24 @@ struct protocol_list {
+@@ -974,18 +991,24 @@ struct protocol_list {
{ 0x8049, "Serial Data Control Protocol (PPP-SDCP)" },
{ 0x804b, "SNA over 802.2 Control Protocol" },
{ 0x804d, "SNA Control Protocol" },
{ 0x8207, "Cisco Discovery Protocol Control" },
{ 0x8209, "Netcs Twin Routing" },
{ 0x820b, "STP - Control Protocol" },
-@@ -990,24 +1013,29 @@ struct protocol_list {
+@@ -994,24 +1017,29 @@ struct protocol_list {
{ 0x8281, "MPLSCP" },
{ 0x8285, "IEEE p1284.4 standard - Protocol Control" },
{ 0x8287, "ETSI TETRA TNP1 Control Protocol" },
ifdef NEEDDES
ifndef USE_CRYPT
--CFLAGS += -I$(shell $CC --print-sysroot)/usr/include/openssl
+-CFLAGS += -I$(shell $(CC) --print-sysroot)/usr/include/openssl
-LIBS += -lcrypto
+LIBS += -ldes $(LIBS)
else