X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fipcp.c;h=48d7095f58ad3fa517a9763d7e566c76e2e3ced5;hb=31db94f4f74809b687ef25e369b449b02964c6f8;hp=12bcc61be737f9d50b3ac3a6292f6c3c74d93b71;hpb=29bdd4bcc2f9e92f7d880d03240b49d2a25870f7;p=ppp.git diff --git a/pppd/ipcp.c b/pppd/ipcp.c index 12bcc61..48d7095 100644 --- a/pppd/ipcp.c +++ b/pppd/ipcp.c @@ -55,6 +55,7 @@ #include #include #include +#include #include "pppd.h" #include "fsm.h" @@ -962,6 +963,21 @@ ipcp_ackci(f, p, len) goto bad; \ } +#define ACKCIWINS(opt, addr) \ + if (addr) { \ + u_int32_t l; \ + if ((len -= CILEN_ADDR) < 0) \ + goto bad; \ + GETCHAR(citype, p); \ + GETCHAR(cilen, p); \ + if (cilen != CILEN_ADDR || citype != opt) \ + goto bad; \ + GETLONG(l, p); \ + cilong = htonl(l); \ + if (addr != cilong) \ + goto bad; \ + } + ACKCIADDRS(CI_ADDRS, !go->neg_addr && go->old_addrs, go->ouraddr, go->hisaddr); @@ -974,6 +990,10 @@ ipcp_ackci(f, p, len) ACKCIDNS(CI_MS_DNS2, go->req_dns2, go->dnsaddr[1]); + ACKCIWINS(CI_MS_WINS1, go->winsaddr[0]); + + ACKCIWINS(CI_MS_WINS2, go->winsaddr[1]); + /* * If there are any remaining CIs, then this packet is bad. */ @@ -1769,6 +1789,7 @@ ipcp_up(f) ipcp_options *ho = &ipcp_hisoptions[f->unit]; ipcp_options *go = &ipcp_gotoptions[f->unit]; ipcp_options *wo = &ipcp_wantoptions[f->unit]; + int ifindex; IPCPDEBUG(("ipcp: up")); @@ -1882,9 +1903,18 @@ ipcp_up(f) } #endif + ifindex = if_nametoindex(ifname); + /* run the pre-up script, if any, and wait for it to finish */ ipcp_script(_PATH_IPPREUP, 1); + /* check if preup script renamed the interface */ + if (!if_indextoname(ifindex, ifname)) { + error("Interface index %d failed to get renamed by a pre-up script", ifindex); + ipcp_close(f->unit, "Interface configuration failed"); + return; + } + /* bring the interface up for IP */ if (!sifup(f->unit)) { if (debug)