summaryrefslogtreecommitdiff
path: root/user/ppp/10_all_defaultgateway.patch
diff options
context:
space:
mode:
Diffstat (limited to 'user/ppp/10_all_defaultgateway.patch')
-rw-r--r--user/ppp/10_all_defaultgateway.patch90
1 files changed, 90 insertions, 0 deletions
diff --git a/user/ppp/10_all_defaultgateway.patch b/user/ppp/10_all_defaultgateway.patch
new file mode 100644
index 000000000..1b7ae6396
--- /dev/null
+++ b/user/ppp/10_all_defaultgateway.patch
@@ -0,0 +1,90 @@
+This patch reverses revision 1.114 of the pppd/sys-linux.c file.
+The default gateway is needed by the openswan's %defaultroute.
+
+--- ppp-2.4.7/pppd/sys-linux.c
++++ ppp-2.4.7/pppd/sys-linux.c
+@@ -206,7 +206,7 @@
+
+ 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 u_int32_t default_route_gateway; /* Gateway for default route added */
+ 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 */
+@@ -346,8 +346,8 @@
+ /*
+ * Delete any routes through the device.
+ */
+- if (have_default_route)
+- cifdefaultroute(0, 0, 0);
++ if (default_route_gateway != 0)
++ cifdefaultroute(0, 0, default_route_gateway);
+
+ if (has_proxy_arp)
+ cifproxyarp(0, proxy_arp_addr);
+@@ -1621,17 +1621,17 @@
+ 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
+- error("not replacing existing default route through %s",
+- rt.rt_dev);
++ 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;
+ }
+
+- memset (&rt, 0, sizeof (rt));
+- SET_SA_FAMILY (rt.rt_dst, AF_INET);
++ memset (&rt, '\0', sizeof (rt));
++ SET_SA_FAMILY (rt.rt_dst, AF_INET);
++ SET_SA_FAMILY (rt.rt_gateway, AF_INET);
+
+ rt.rt_dev = ifname;
+
+@@ -1640,14 +1640,16 @@
+ SIN_ADDR(rt.rt_genmask) = 0L;
+ }
+
+- rt.rt_flags = RTF_UP;
++ SIN_ADDR(rt.rt_gateway) = gateway;
++
++ rt.rt_flags = RTF_UP | RTF_GATEWAY;
+ if (ioctl(sock_fd, SIOCADDRT, &rt) < 0) {
+ if ( ! ok_error ( errno ))
+ error("default route ioctl(SIOCADDRT): %m");
+ return 0;
+ }
+
+- have_default_route = 1;
++ default_route_gateway = gateway;
+ return 1;
+ }
+
+@@ -1660,7 +1662,7 @@
+ {
+ struct rtentry rt;
+
+- have_default_route = 0;
++ default_route_gateway = 0;
+
+ memset (&rt, '\0', sizeof (rt));
+ SET_SA_FAMILY (rt.rt_dst, AF_INET);
+@@ -1673,7 +1675,9 @@
+ SIN_ADDR(rt.rt_genmask) = 0L;
+ }
+
+- rt.rt_flags = RTF_UP;
++ SIN_ADDR(rt.rt_gateway) = gateway;
++
++ rt.rt_flags = RTF_UP | RTF_GATEWAY;
+ if (ioctl(sock_fd, SIOCDELRT, &rt) < 0 && errno != ESRCH) {
+ if (still_ppp()) {
+ if ( ! ok_error ( errno ))