| diff -rupN ppp-2.4.6/pppd/ipcp.c ppp-2.4.6.patched/pppd/ipcp.c |
| --- ppp-2.4.6/pppd/ipcp.c 2014-01-01 20:42:08.000000000 -0800 |
| +++ ppp-2.4.6.patched/pppd/ipcp.c 2014-08-09 18:02:07.955608522 -0700 |
| @@ -90,6 +90,7 @@ struct notifier *ip_down_notifier = NULL |
| /* local vars */ |
| static int default_route_set[NUM_PPP]; /* Have set up a default route */ |
| static int proxy_arp_set[NUM_PPP]; /* Have created proxy arp entry */ |
| +static bool neg_systemconfig; /* Skip system configuration */ |
| static bool usepeerdns; /* Ask peer for DNS addrs */ |
| static int ipcp_is_up; /* have called np_up() */ |
| static int ipcp_is_open; /* haven't called np_finished() */ |
| @@ -210,6 +211,9 @@ static option_t ipcp_option_list[] = { |
| { "usepeerdns", o_bool, &usepeerdns, |
| "Ask peer for DNS address(es)", 1 }, |
| |
| + { "nosystemconfig", o_bool, &neg_systemconfig, |
| + "Avoid IP and route configuration of ppp device", 1 }, |
| + |
| { "netmask", o_special, (void *)setnetmask, |
| "set netmask", OPT_PRIO | OPT_A2STRVAL | OPT_STATIC, netmask_str }, |
| |
| @@ -1827,7 +1831,8 @@ ipcp_up(f) |
| script_setenv("DNS2", ip_ntoa(go->dnsaddr[1]), 0); |
| if (usepeerdns && (go->dnsaddr[0] || go->dnsaddr[1])) { |
| script_setenv("USEPEERDNS", "1", 0); |
| - create_resolv(go->dnsaddr[0], go->dnsaddr[1]); |
| + if (!neg_systemconfig) |
| + create_resolv(go->dnsaddr[0], go->dnsaddr[1]); |
| } |
| |
| /* |
| @@ -1892,8 +1897,12 @@ ipcp_up(f) |
| */ |
| mask = GetMask(go->ouraddr); |
| |
| + if (neg_systemconfig && debug) |
| + warn("Avoiding system configuration by request"); |
| + |
| #if !(defined(SVR4) && (defined(SNI) || defined(__USLC__))) |
| - if (!sifaddr(f->unit, go->ouraddr, ho->hisaddr, mask)) { |
| + if (!neg_systemconfig && |
| + !sifaddr(f->unit, go->ouraddr, ho->hisaddr, mask)) { |
| if (debug) |
| warn("Interface configuration failed"); |
| ipcp_close(f->unit, "Interface configuration failed"); |
| @@ -1905,7 +1914,7 @@ ipcp_up(f) |
| ipcp_script(_PATH_IPPREUP, 1); |
| |
| /* bring the interface up for IP */ |
| - if (!sifup(f->unit)) { |
| + if (!neg_systemconfig && !sifup(f->unit)) { |
| if (debug) |
| warn("Interface failed to come up"); |
| ipcp_close(f->unit, "Interface configuration failed"); |
| @@ -1913,7 +1922,8 @@ ipcp_up(f) |
| } |
| |
| #if (defined(SVR4) && (defined(SNI) || defined(__USLC__))) |
| - if (!sifaddr(f->unit, go->ouraddr, ho->hisaddr, mask)) { |
| + if (!neg_systemconfig && |
| + !sifaddr(f->unit, go->ouraddr, ho->hisaddr, mask)) { |
| if (debug) |
| warn("Interface configuration failed"); |
| ipcp_close(f->unit, "Interface configuration failed"); |
| @@ -1923,12 +1933,13 @@ 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 (!neg_systemconfig && ipcp_wantoptions[f->unit].default_route) |
| if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr)) |
| default_route_set[f->unit] = 1; |
| |
| /* Make a proxy ARP entry if requested. */ |
| - if (ho->hisaddr != 0 && ipcp_wantoptions[f->unit].proxy_arp) |
| + if (!neg_systemconfig && |
| + ho->hisaddr != 0 && ipcp_wantoptions[f->unit].proxy_arp) |
| if (sifproxyarp(f->unit, ho->hisaddr)) |
| proxy_arp_set[f->unit] = 1; |
| |
| @@ -2000,7 +2011,8 @@ ipcp_down(f) |
| sifnpmode(f->unit, PPP_IP, NPMODE_QUEUE); |
| } else { |
| sifnpmode(f->unit, PPP_IP, NPMODE_DROP); |
| - sifdown(f->unit); |
| + if (!neg_systemconfig) |
| + sifdown(f->unit); |
| ipcp_clear_addrs(f->unit, ipcp_gotoptions[f->unit].ouraddr, |
| ipcp_hisoptions[f->unit].hisaddr); |
| } |
| @@ -2031,7 +2043,8 @@ ipcp_clear_addrs(unit, ouraddr, hisaddr) |
| cifdefaultroute(unit, ouraddr, hisaddr); |
| default_route_set[unit] = 0; |
| } |
| - cifaddr(unit, ouraddr, hisaddr); |
| + if (!neg_systemconfig) |
| + cifaddr(unit, ouraddr, hisaddr); |
| } |
| |
| |