int u_rangeempty(struct u_range *range) { return u_addrempty(&range->addr); }
static void IpcpLayerUp(Fsm fp) { Bund b = (Bund)fp->arg; IpcpState const ipcp = &b->ipcp; char ipbuf[20]; #ifdef USE_NG_VJC char path[NG_PATHSIZ]; struct ngm_vjc_config vjc; #endif struct u_addr tmp; /* Determine actual address we'll use for ourselves */ in_addrtou_addr(&ipcp->want_addr, &tmp); if (!IpAddrInRange(&ipcp->self_allow, &tmp)) { Log(LG_IPCP, ("[%s] Note: ignoring negotiated %s IP %s,", b->name, "self", inet_ntoa(ipcp->want_addr))); u_addrtoin_addr(&ipcp->self_allow.addr, &ipcp->want_addr); Log(LG_IPCP, ("[%s] using %s instead.", b->name, inet_ntoa(ipcp->want_addr))); } /* Determine actual address we'll use for peer */ in_addrtou_addr(&ipcp->peer_addr, &tmp); if (!IpAddrInRange(&ipcp->peer_allow, &tmp) && !u_addrempty(&ipcp->peer_allow.addr)) { Log(LG_IPCP, ("[%s] Note: ignoring negotiated %s IP %s,", b->name, "peer", inet_ntoa(ipcp->peer_addr))); u_addrtoin_addr(&ipcp->peer_allow.addr, &ipcp->peer_addr); Log(LG_IPCP, ("[%s] using %s instead.", b->name, inet_ntoa(ipcp->peer_addr))); } /* Report */ strlcpy(ipbuf, inet_ntoa(ipcp->peer_addr), sizeof(ipbuf)); Log(LG_IPCP, ("[%s] %s -> %s", b->name, inet_ntoa(ipcp->want_addr), ipbuf)); #ifdef USE_NG_VJC memset(&vjc, 0, sizeof(vjc)); if (ntohs(ipcp->peer_comp.proto) == PROTO_VJCOMP || ntohs(ipcp->want_comp.proto) == PROTO_VJCOMP) { IpcpNgInitVJ(b); /* Configure VJ compression node */ vjc.enableComp = ntohs(ipcp->peer_comp.proto) == PROTO_VJCOMP; vjc.enableDecomp = ntohs(ipcp->want_comp.proto) == PROTO_VJCOMP; vjc.maxChannel = ipcp->peer_comp.maxchan; vjc.compressCID = ipcp->peer_comp.compcid; snprintf(path, sizeof(path), "[%x]:%s", b->nodeID, NG_PPP_HOOK_VJC_IP); if (NgSendMsg(gLinksCsock, path, NGM_VJC_COOKIE, NGM_VJC_SET_CONFIG, &vjc, sizeof(vjc)) < 0) { Perror("[%s] can't config %s node", b->name, NG_VJC_NODE_TYPE); } } #endif /* USE_NG_VJC */ /* Enable IP packets in the PPP node */ b->pppConfig.bund.enableIP = 1; #ifdef USE_NG_VJC b->pppConfig.bund.enableVJCompression = vjc.enableComp; b->pppConfig.bund.enableVJDecompression = vjc.enableDecomp; #endif NgFuncSetConfig(b); BundNcpsJoin(b, NCP_IPCP); }