X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fipcp.c;h=4957ac59c2f106a35f746af249afa2b84d399be4;hb=aa4802d0c505513b38999a2502457f685f74af31;hp=c2a7f27337fa0c1874c01d68439a42dcce88b6e2;hpb=96a47326d0073d66e287fb05fa34d119f46744ed;p=ppp.git diff --git a/pppd/ipcp.c b/pppd/ipcp.c index c2a7f27..4957ac5 100644 --- a/pppd/ipcp.c +++ b/pppd/ipcp.c @@ -40,7 +40,7 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: ipcp.c,v 1.64 2003/07/28 12:25:41 carlsonj Exp $" +#define RCSID "$Id: ipcp.c,v 1.66 2004/10/28 00:32:32 paulus Exp $" /* * TODO: @@ -1687,12 +1687,12 @@ ipcp_up(f) script_setenv("IPLOCAL", ip_ntoa(go->ouraddr), 0); script_setenv("IPREMOTE", ip_ntoa(ho->hisaddr), 1); + if (go->dnsaddr[0]) + script_setenv("DNS1", ip_ntoa(go->dnsaddr[0]), 0); + if (go->dnsaddr[1]) + script_setenv("DNS2", ip_ntoa(go->dnsaddr[1]), 0); if (usepeerdns && (go->dnsaddr[0] || go->dnsaddr[1])) { script_setenv("USEPEERDNS", "1", 0); - if (go->dnsaddr[0]) - script_setenv("DNS1", ip_ntoa(go->dnsaddr[0]), 0); - if (go->dnsaddr[1]) - script_setenv("DNS2", ip_ntoa(go->dnsaddr[1]), 0); create_resolv(go->dnsaddr[0], go->dnsaddr[1]); } @@ -1805,6 +1805,8 @@ ipcp_up(f) notice("secondary DNS address %I", go->dnsaddr[1]); } + reset_link_stats(f->unit); + np_up(f->unit, PPP_IP); ipcp_is_up = 1; @@ -1836,6 +1838,8 @@ ipcp_down(f) IPCPDEBUG(("ipcp: down")); /* XXX a bit IPv4-centric here, we only need to get the stats * before the interface is marked down. */ + /* XXX more correct: we must get the stats before running the notifiers, + * at least for the radius plugin */ update_link_stats(f->unit); notify(ip_down_notifier, 0); if (ip_down_hook) @@ -1846,6 +1850,10 @@ ipcp_down(f) } sifvjcomp(f->unit, 0, 0, 0); + print_link_stats(); /* _after_ running the notifiers and ip_down_hook(), + * because print_link_stats() sets link_stats_valid + * to 0 (zero) */ + /* * If we are doing dial-on-demand, set the interface * to queue up outgoing packets (for now).