X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fipcp.c;h=7357ac8ea546323f3ba178db99f0e77639beef3f;hb=2e8848d5c5a7951acf84c66fbb3417c535fce47f;hp=80a18f8c80c6f47b82b632c43f8f2856d8de3929;hpb=5ece6e68baaf9fdbd6e73daa7b27335f8852d85b;p=ppp.git diff --git a/pppd/ipcp.c b/pppd/ipcp.c index 80a18f8..7357ac8 100644 --- a/pppd/ipcp.c +++ b/pppd/ipcp.c @@ -53,6 +53,7 @@ #include #include #include +#include #include "pppd.h" #include "fsm.h" @@ -1741,6 +1742,7 @@ ipcp_up(fsm *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")); @@ -1854,9 +1856,18 @@ ipcp_up(fsm *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)