static void Ipv6cpLayerUp(Fsm fp) { Bund b = (Bund) fp->arg; Ipv6cpState const ipv6cp = &b->ipv6cp; /* Report */ Log(fp->log, ("[%s] %02x%02x:%02x%02x:%02x%02x:%02x%02x -> %02x%02x:%02x%02x:%02x%02x:%02x%02x", b->name, ipv6cp->myintid[0], ipv6cp->myintid[1], ipv6cp->myintid[2], ipv6cp->myintid[3], ipv6cp->myintid[4], ipv6cp->myintid[5], ipv6cp->myintid[6], ipv6cp->myintid[7], ipv6cp->hisintid[0], ipv6cp->hisintid[1], ipv6cp->hisintid[2], ipv6cp->hisintid[3], ipv6cp->hisintid[4], ipv6cp->hisintid[5], ipv6cp->hisintid[6], ipv6cp->hisintid[7])); /* Enable IP packets in the PPP node */ b->pppConfig.bund.enableIPv6 = 1; NgFuncSetConfig(b); BundNcpsJoin(b, NCP_IPV6CP); }
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); }