Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37564530
en ru br
ALT Linux repos
S:2.5.0-alt1
5.0: 2.4.4-alt11
4.1: 2.4.4-alt10.M41.1
4.0: 2.4.4-alt10
+updates:2.4.4-alt10
3.0: 2.4.2-alt6
+updates:2.4.2-alt6.M30.1

Group :: Networking/Other
RPM: ppp

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: ppp-20031003-alt-cleardefaultroute.patch
Download


diff -uprk.orig ppp-20031003.orig/pppd/ipcp.c ppp-20031003/pppd/ipcp.c
--- ppp-20031003.orig/pppd/ipcp.c	2003-12-03 12:46:43 +0300
+++ ppp-20031003/pppd/ipcp.c	2003-12-04 17:06:10 +0300
@@ -202,6 +202,15 @@ static option_t ipcp_option_list[] = {
       "disable defaultroute option", OPT_ALIAS | OPT_A2CLR,
       &ipcp_wantoptions[0].default_route },
 
+    { "cleardefaultroute", o_bool, &ipcp_wantoptions[0].clear_default_route,
+      "Clear default route before assignment", OPT_ENABLE|1, &ipcp_allowoptions[0].clear_default_route },
+    { "nocleardefaultroute", o_bool, &ipcp_allowoptions[0].clear_default_route,
+      "disable cleardefaultroute option", OPT_A2CLR,
+      &ipcp_wantoptions[0].clear_default_route },
+    { "-cleardefaultroute", o_bool, &ipcp_allowoptions[0].clear_default_route,
+      "disable cleardefaultroute option", OPT_ALIAS | OPT_A2CLR,
+      &ipcp_wantoptions[0].clear_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,
@@ -600,6 +609,7 @@ ipcp_init(unit)
      */
     ao->proxy_arp = 1;
     ao->default_route = 1;
+    ao->clear_default_route = 1;
 }
 
 
@@ -1798,9 +1808,12 @@ ipcp_up(f)
 	sifnpmode(f->unit, PPP_IP, NPMODE_PASS);
 
 	/* assign a default route through the interface if required */
-	if (ipcp_wantoptions[f->unit].default_route) 
+	if (ipcp_wantoptions[f->unit].default_route) {
+	    if (ipcp_wantoptions[f->unit].clear_default_route) 
+		cifdefaultroute(f->unit, 0, 0);
 	    if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr))
 		default_route_set[f->unit] = 1;
+	}
 
 	/* Make a proxy ARP entry if requested. */
 	if (ipcp_wantoptions[f->unit].proxy_arp)
diff -uprk.orig ppp-20031003.orig/pppd/ipcp.h ppp-20031003/pppd/ipcp.h
--- ppp-20031003.orig/pppd/ipcp.h	2002-12-05 02:05:09 +0300
+++ ppp-20031003/pppd/ipcp.h	2003-12-04 17:04:20 +0300
@@ -70,6 +70,7 @@ typedef struct ipcp_options {
     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 clear_default_route;	/* Clear default route through interface before assignment? */
     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 -uprk.orig ppp-20031003.orig/pppd/sys-linux.c ppp-20031003/pppd/sys-linux.c
--- ppp-20031003.orig/pppd/sys-linux.c	2003-05-01 16:45:13 +0400
+++ ppp-20031003/pppd/sys-linux.c	2003-12-04 17:04:20 +0300
@@ -1628,6 +1628,13 @@ int cifdefaultroute (int unit, u_int32_t
 
     default_route_gateway = 0;
 
+    if (!gateway) {
+	if (defaultroute_exists(&rt))
+	    gateway = SIN_ADDR(rt.rt_gateway);
+	else
+	    return 0;
+    }
+
     memset (&rt, '\0', sizeof (rt));
     SET_SA_FAMILY (rt.rt_dst,     AF_INET);
     SET_SA_FAMILY (rt.rt_gateway, AF_INET);
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin