ipv6cp
&arg->bundle->ncp.ipv6cp.cfg.fsm.timeout,
&arg->bundle->ncp.ipv6cp.cfg.fsm.maxreq,
&arg->bundle->ncp.ipv6cp.cfg.fsm.maxtrm, DEF_FSMTRIES);
if (!ncpaddr_getip6(&arg->bundle->ncp.ipv6cp.hisaddr, &host6))
ncprange_sethost(&dest, &arg->bundle->ncp.ipv6cp.myaddr);
ncprange_sethost(&dest, &arg->bundle->ncp.ipv6cp.hisaddr);
t = &arg->bundle->ncp.ipv6cp.throughput;
oin += bundle->ncp.ipv6cp.throughput.OctetsIn;
oout += bundle->ncp.ipv6cp.throughput.OctetsOut;
pin += bundle->ncp.ipv6cp.throughput.PacketsIn;
pout += bundle->ncp.ipv6cp.throughput.PacketsOut;
nargv[arg] = substipv6(nargv[arg], "HISADDR6", &bundle->ncp.ipv6cp.hisaddr);
bundle->ncp.ipv6cp.throughput.OctetsIn);
bundle->ncp.ipv6cp.throughput.OctetsOut);
bundle->ncp.ipv6cp.throughput.PacketsIn);
bundle->ncp.ipv6cp.throughput.PacketsOut);
nargv[arg] = substipv6(nargv[arg], "MYADDR6", &bundle->ncp.ipv6cp.myaddr);
fsm_Close(&fp->bundle->ncp.ipv6cp.fsm);
if (bundle->ncp.ipv6cp.fsm.state != ST_OPENED) {
ipv6cp_AddInOctets(&bundle->ncp.ipv6cp, nb);
ipcp_SetIPv6address(struct ipv6cp *ipv6cp, u_char *myifid, u_char *hisifid)
struct bundle *bundle = ipv6cp->fsm.bundle;
ncpaddr_setip6(&ipv6cp->myaddr, &myaddr);
ncpaddr_setip6(&ipv6cp->hisaddr, &hisaddr);
ncprange_set(&myrange, &ipv6cp->myaddr, 64);
if (!iface_Add(bundle->iface, &bundle->ncp, &myrange, &ipv6cp->hisaddr,
rt_Set(bundle, RTM_ADD, &range, &ipv6cp->myaddr, 1, 0);
if (ncpaddr_isset(&ipv6cp->hisaddr))
ncpaddr_getsa(&ipv6cp->hisaddr, &ssdst);
route_Change(bundle, bundle->ncp.route, &ipv6cp->myaddr, &ipv6cp->hisaddr);
route_Change(bundle, bundle->radius.ipv6routes, &ipv6cp->myaddr,
&ipv6cp->hisaddr);
ipv6cp_Init(struct ipv6cp *ipv6cp, struct bundle *bundle, struct link *l,
fsm_Init(&ipv6cp->fsm, "IPV6CP", PROTO_IPV6CP, 1, IPV6CP_MAXCODE, LogIPV6CP,
ipv6cp->cfg.fsm.timeout = DEF_FSMRETRY;
ipv6cp->cfg.fsm.maxreq = DEF_FSMTRIES;
ipv6cp->cfg.fsm.maxtrm = DEF_FSMTRIES;
SetInterfaceID(ipv6cp->my_ifid, 0);
SetInterfaceID(ipv6cp->his_ifid, 1);
} while (memcmp(ipv6cp->his_ifid, ipv6cp->my_ifid, IPV6CP_IFIDLEN) == 0);
!ipcp_SetIPv6address(ipv6cp, ipv6cp->my_ifid, ipv6cp->his_ifid)) {
SetInterfaceID(ipv6cp->my_ifid, 1);
&& memcmp(ipv6cp->his_ifid, ipv6cp->my_ifid, IPV6CP_IFIDLEN) == 0);
throughput_init(&ipv6cp->throughput, SAMPLE_PERIOD);
memset(ipv6cp->Queue, '\0', sizeof ipv6cp->Queue);
ipv6cp_Setup(ipv6cp);
ipv6cp_Destroy(struct ipv6cp *ipv6cp)
throughput_destroy(&ipv6cp->throughput);
ipv6cp_Setup(struct ipv6cp *ipv6cp)
ncpaddr_init(&ipv6cp->myaddr);
ncpaddr_init(&ipv6cp->hisaddr);
ipv6cp->his_reject = 0;
ipv6cp->my_reject = 0;
ipv6cp_SetLink(struct ipv6cp *ipv6cp, struct link *l)
ipv6cp->fsm.link = l;
struct ipv6cp *ipv6cp = &arg->bundle->ncp.ipv6cp;
prompt_Printf(arg->prompt, "%s [%s]\n", ipv6cp->fsm.name,
State2Nam(ipv6cp->fsm.state));
if (ipv6cp->fsm.state == ST_OPENED) {
ncpaddr_ntoa(&ipv6cp->hisaddr));
ncpaddr_ntoa(&ipv6cp->myaddr));
(unsigned long)ipv6cp_QueueLen(ipv6cp));
" REQ%s, %u Term REQ%s\n\n", ipv6cp->cfg.fsm.timeout,
ipv6cp->cfg.fsm.maxreq, ipv6cp->cfg.fsm.maxreq == 1 ? "" : "s",
ipv6cp->cfg.fsm.maxtrm, ipv6cp->cfg.fsm.maxtrm == 1 ? "" : "s");
throughput_disp(&ipv6cp->throughput, arg->prompt);
fsm_Input(&bundle->ncp.ipv6cp.fsm, bp);
ipv6cp_AddInOctets(struct ipv6cp *ipv6cp, int n)
throughput_addin(&ipv6cp->throughput, n);
ipv6cp_AddOutOctets(struct ipv6cp *ipv6cp, int n)
throughput_addout(&ipv6cp->throughput, n);
ipv6cp_IfaceAddrAdded(struct ipv6cp *ipv6cp __unused,
ipv6cp_IfaceAddrDeleted(struct ipv6cp *ipv6cp __unused,
ipv6cp_InterfaceUp(struct ipv6cp *ipv6cp)
if (!ipcp_SetIPv6address(ipv6cp, ipv6cp->my_ifid, ipv6cp->his_ifid)) {
if (!iface_SetFlags(ipv6cp->fsm.bundle->iface->name, IFF_UP)) {
" flag on %s\n", ipv6cp->fsm.bundle->iface->name);
ipv6cp_QueueLen(struct ipv6cp *ipv6cp)
for (q = ipv6cp->Queue; q < ipv6cp->Queue + IPV6CP_QUEUES(ipv6cp); q++)
ipv6cp_PushPacket(struct ipv6cp *ipv6cp, struct link *l)
struct bundle *bundle = ipv6cp->fsm.bundle;
if (ipv6cp->fsm.state != ST_OPENED)
queue = ipv6cp->Queue + IPV6CP_QUEUES(ipv6cp) - 1;
ipv6cp_AddOutOctets(ipv6cp, m_len);
} while (queue-- != ipv6cp->Queue);
struct ipv6cp *ipv6cp = fsm2ipv6cp(fp);
if (!ipv6cp_InterfaceUp(ipv6cp))
snprintf(tbuff, sizeof tbuff, "%s", ncpaddr_ntoa(&ipv6cp->myaddr));
tbuff, ncpaddr_ntoa(&ipv6cp->hisaddr));
radius_Account_Set_Ipv6(&fp->bundle->radacct6, ipv6cp->his_ifid);
fp->bundle->links, RAD_START, &ipv6cp->throughput);
fp->more.reqs = fp->more.naks = fp->more.rejs = ipv6cp->cfg.fsm.maxreq * 3;
struct ipv6cp *ipv6cp = fsm2ipv6cp(fp);
snprintf(addr, sizeof addr, "%s", ncpaddr_ntoa(&ipv6cp->myaddr));
fp->bundle->links, RAD_STOP, &ipv6cp->throughput);
ipv6cp_Setup(ipv6cp);
struct ipv6cp *ipv6cp = fsm2ipv6cp(fp);
throughput_start(&ipv6cp->throughput, "IPV6CP throughput",
fp->more.reqs = fp->more.naks = fp->more.rejs = ipv6cp->cfg.fsm.maxreq * 3;
ipv6cp->peer_tokenreq = 0;
struct ipv6cp *ipv6cp = fsm2ipv6cp(fp);
throughput_stop(&ipv6cp->throughput);
throughput_log(&ipv6cp->throughput, LogIPV6CP, NULL);
struct ipv6cp *ipv6cp = fsm2ipv6cp(fp);
fp->FsmTimer.load = ipv6cp->cfg.fsm.timeout * SECTICKS;
fp->restart = ipv6cp->cfg.fsm.maxreq;
fp->restart = ipv6cp->cfg.fsm.maxtrm;
struct ipv6cp *ipv6cp = fsm2ipv6cp(fp);
if ((p && !physical_IsSync(p)) || !REJECTED(ipv6cp, TY_TOKEN)) {
memcpy(o->data, ipv6cp->my_ifid, IPV6CP_IFIDLEN);
ipv6cp_ValidateInterfaceID(struct ipv6cp *ipv6cp, u_char *ifid,
&& memcmp(ifid, ipv6cp->my_ifid, IPV6CP_IFIDLEN) != 0)
memcpy(ipv6cp->his_ifid, ifid, IPV6CP_IFIDLEN);
memcpy(opt.data, &ipv6cp->his_ifid, IPV6CP_IFIDLEN);
if (memcmp(ifid, ipv6cp->his_ifid, IPV6CP_IFIDLEN) == 0)
struct ipv6cp *ipv6cp = fsm2ipv6cp(fp);
ipv6cp->peer_tokenreq = 1;
ipv6cp_ValidateInterfaceID(ipv6cp, ifid, dec);
fsm_Close(&ipv6cp->fsm);
} else if (memcmp(ifid, ipv6cp->his_ifid, IPV6CP_IFIDLEN) == 0) {
} else if (memcmp(ifid, ipv6cp->my_ifid, IPV6CP_IFIDLEN) != 0) {
while (n && !ipcp_SetIPv6address(ipv6cp, ifid, ipv6cp->his_ifid)) {
} while (n && memcmp(ifid, ipv6cp->his_ifid, IPV6CP_IFIDLEN) == 0);
fsm_Close(&ipv6cp->fsm);
ipv6cp->my_ifid[0], ipv6cp->my_ifid[1],
ipv6cp->my_ifid[2], ipv6cp->my_ifid[3],
ipv6cp->my_ifid[4], ipv6cp->my_ifid[5],
ipv6cp->my_ifid[6], ipv6cp->my_ifid[7],
memcpy(ipv6cp->my_ifid, ifid, IPV6CP_IFIDLEN);
bundle_AdjustFilters(fp->bundle, &ipv6cp->myaddr, NULL);
ipv6cp->his_reject |= (1 << opt->hdr.id);
ipv6cp->my_reject |= (1 << opt->hdr.id);
if (mode_type == MODE_REQ && !ipv6cp->peer_tokenreq) {
ipv6cp->peer_tokenreq = 1;
ipv6cp_ValidateInterfaceID(ipv6cp, ifid, dec);
#define fsm2ipv6cp(fp) (fp->proto == PROTO_IPV6CP ? (struct ipv6cp *)fp : NULL)
#define IPV6CP_QUEUES(ipv6cp) (sizeof ipv6cp->Queue / sizeof ipv6cp->Queue[0])
extern void ipv6cp_Init(struct ipv6cp *, struct bundle *, struct link *,
extern void ipv6cp_Destroy(struct ipv6cp *);
extern void ipv6cp_Setup(struct ipv6cp *);
extern void ipv6cp_SetLink(struct ipv6cp *, struct link *);
extern void ipv6cp_AddInOctets(struct ipv6cp *, int);
extern void ipv6cp_AddOutOctets(struct ipv6cp *, int);
extern void ipv6cp_IfaceAddrAdded(struct ipv6cp *, const struct iface_addr *);
extern void ipv6cp_IfaceAddrDeleted(struct ipv6cp *, const struct iface_addr *);
extern int ipv6cp_InterfaceUp(struct ipv6cp *);
extern size_t ipv6cp_QueueLen(struct ipv6cp *);
extern int ipv6cp_PushPacket(struct ipv6cp *, struct link *);
ipv6cp_Init(&ncp->ipv6cp, bundle, &bundle->links->physical->link,
ipv6cp_Destroy(&ncp->ipv6cp);
fsm_Up(&ncp->ipv6cp.fsm);
fsm_Open(&ncp->ipv6cp.fsm);
ipv6cp_IfaceAddrAdded(&ncp->ipv6cp, addr);
ipv6cp_SetLink(&ncp->ipv6cp, l);
struct ipv6cp *ipv6cp = &ncp->ipv6cp;
m_enqueue(ipv6cp->Queue + pri, bp);
result += ipv6cp_QueueLen(&ncp->ipv6cp);
struct ipv6cp *ipv6cp = &ncp->ipv6cp;
for (q = ipv6cp->Queue; q < ipv6cp->Queue + IPV6CP_QUEUES(ipv6cp); q++)
res = ipv6cp_PushPacket(&bundle->ncp.ipv6cp, l);
if ((res = ipv6cp_PushPacket(&bundle->ncp.ipv6cp, l)))
n += !!(ncp->ipv6cp.fsm.state == ST_OPENED);
if (ncp->ipv6cp.fsm.state > ST_CLOSED ||
ncp->ipv6cp.fsm.state == ST_STARTING)
if (ncp->ipv6cp.fsm.state > ST_CLOSED ||
ncp->ipv6cp.fsm.state == ST_STARTING)
fsm_Close(&ncp->ipv6cp.fsm);
fsm2initial(&ncp->ipv6cp.fsm);
struct ipv6cp ipv6cp; /* Our IPV6CP FSM */
range->ncprange_ip6addr = ncp->ipv6cp.hisaddr.ncpaddr_ip6addr;
range->ncprange_ip6addr = ncp->ipv6cp.myaddr.ncpaddr_ip6addr;
p->bundle->ncp.ipv6cp.fsm.state == ST_OPENED)
ncpaddr_copy(&gw, &bundle->ncp.ipv6cp.hisaddr);