The patch originated from the Debian project.
-Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
+Signed-off-by: Jo-Philipp Wich <jo@mein.io>
--- a/pppd/ipcp.c
+++ b/pppd/ipcp.c
static void ipcp_script __P((char *, int)); /* Run an up/down script */
static void ipcp_script_done __P((void *));
-@@ -1742,7 +1750,8 @@ ip_demand_conf(u)
+@@ -1761,7 +1769,8 @@ ip_demand_conf(u)
if (!sifnpmode(u, PPP_IP, NPMODE_QUEUE))
return 0;
if (wo->default_route)
default_route_set[u] = 1;
if (wo->proxy_arp)
if (sifproxyarp(u, wo->hisaddr))
-@@ -1830,7 +1839,8 @@ ipcp_up(f)
+@@ -1849,7 +1858,8 @@ ipcp_up(f)
*/
if (demand) {
if (go->ouraddr != wo->ouraddr || ho->hisaddr != wo->hisaddr) {
if (go->ouraddr != wo->ouraddr) {
warn("Local IP address changed to %I", go->ouraddr);
script_setenv("OLDIPLOCAL", ip_ntoa(wo->ouraddr), 0);
-@@ -1855,7 +1865,8 @@ ipcp_up(f)
+@@ -1874,7 +1884,8 @@ ipcp_up(f)
/* assign a default route through the interface if required */
if (ipcp_wantoptions[f->unit].default_route)
default_route_set[f->unit] = 1;
/* Make a proxy ARP entry if requested. */
-@@ -1905,7 +1916,8 @@ ipcp_up(f)
+@@ -1924,7 +1935,8 @@ ipcp_up(f)
/* assign a default route through the interface if required */
if (ipcp_wantoptions[f->unit].default_route)
default_route_set[f->unit] = 1;
/* Make a proxy ARP entry if requested. */
-@@ -1983,7 +1995,7 @@ ipcp_down(f)
+@@ -2002,7 +2014,7 @@ ipcp_down(f)
sifnpmode(f->unit, PPP_IP, NPMODE_DROP);
sifdown(f->unit);
ipcp_clear_addrs(f->unit, ipcp_gotoptions[f->unit].ouraddr,
}
/* Execute the ip-down script */
-@@ -1999,16 +2011,25 @@ ipcp_down(f)
+@@ -2018,16 +2030,25 @@ ipcp_down(f)
* proxy arp entries, etc.
*/
static void
.B disconnect \fIscript
Execute the command specified by \fIscript\fR, by passing it to a
shell, after
-@@ -717,7 +722,12 @@ disable both forms of hardware flow cont
+@@ -734,7 +739,12 @@ disable both forms of hardware flow cont
.TP
.B nodefaultroute
Disable the \fIdefaultroute\fR option. The system administrator who
.B nodeflate
--- a/pppd/pppd.h
+++ b/pppd/pppd.h
-@@ -645,7 +645,7 @@ int sif6addr __P((int, eui64_t, eui64_t
+@@ -667,7 +667,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
-@@ -206,6 +206,8 @@ static unsigned char inbuf[512]; /* buff
-
+@@ -207,6 +207,8 @@ static unsigned char inbuf[512]; /* buff
static int if_is_up; /* Interface has been marked up */
+ 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 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 */
-@@ -1544,6 +1546,9 @@ static int read_route_table(struct rtent
+@@ -1552,6 +1554,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);
-@@ -1613,20 +1618,51 @@ int have_route_to(u_int32_t addr)
+@@ -1621,20 +1626,51 @@ int have_route_to(u_int32_t addr)
/********************************************************************
*
* sifdefaultroute - assign a default route through the address given.
}
memset (&rt, 0, sizeof (rt));
-@@ -1641,10 +1677,16 @@ int sifdefaultroute (int unit, u_int32_t
+@@ -1649,10 +1685,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;
-@@ -1675,11 +1717,21 @@ int cifdefaultroute (int unit, u_int32_t
+@@ -1683,11 +1725,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
-@@ -2036,12 +2036,18 @@ cifaddr(u, o, h)
+@@ -2039,12 +2039,18 @@ cifaddr(u, o, h)
* sifdefaultroute - assign a default route through the address given.
*/
int