#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <net/if.h>
#include "pppd.h"
#include "fsm.h"
f->callbacks = &ipcp_callbacks;
fsm_init(&ipcp_fsm[unit]);
+ /*
+ * Some 3G modems use repeated IPCP NAKs as a way of stalling
+ * until they can contact a server on the network, so we increase
+ * the default number of NAKs we accept before we start treating
+ * them as rejects.
+ */
+ f->maxnakloops = 100;
+
memset(wo, 0, sizeof(*wo));
memset(ao, 0, sizeof(*ao));
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);
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.
*/
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"));
}
#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)