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);