diff options
author | brian <brian@FreeBSD.org> | 2001-08-18 13:04:52 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2001-08-18 13:04:52 +0000 |
commit | cfa5d0ff529c7c68582be2d05f344e470d61c5df (patch) | |
tree | a0dbd40d60699c490ea869291dd1aa069e6a2682 /usr.sbin/ppp/ncp.c | |
parent | fb43a54a68c52f79dc2f14a17ce4618c023e958e (diff) | |
download | FreeBSD-src-cfa5d0ff529c7c68582be2d05f344e470d61c5df.zip FreeBSD-src-cfa5d0ff529c7c68582be2d05f344e470d61c5df.tar.gz |
Run correctly on a machine built without AF_INET6 support
Diffstat (limited to 'usr.sbin/ppp/ncp.c')
-rw-r--r-- | usr.sbin/ppp/ncp.c | 53 |
1 files changed, 33 insertions, 20 deletions
diff --git a/usr.sbin/ppp/ncp.c b/usr.sbin/ppp/ncp.c index a68c91f..8a88800 100644 --- a/usr.sbin/ppp/ncp.c +++ b/usr.sbin/ppp/ncp.c @@ -90,6 +90,7 @@ #include "pap.h" #include "cbcp.h" #include "datalink.h" +#include "probe.h" static u_short default_urgent_tcp_ports[] = { @@ -133,8 +134,9 @@ ncp_Init(struct ncp *ncp, struct bundle *bundle) ipcp_Init(&ncp->ipcp, bundle, &bundle->links->physical->link, &bundle->fsm); #ifndef NOINET6 - ipv6cp_Init(&ncp->ipv6cp, bundle, &bundle->links->physical->link, - &bundle->fsm); + if (probe.ipv6_available) + ipv6cp_Init(&ncp->ipv6cp, bundle, &bundle->links->physical->link, + &bundle->fsm); #endif } @@ -143,7 +145,8 @@ ncp_Destroy(struct ncp *ncp) { ipcp_Destroy(&ncp->ipcp); #ifndef NOINET6 - ipv6cp_Destroy(&ncp->ipv6cp); + if (probe.ipv6_available) + ipv6cp_Destroy(&ncp->ipv6cp); #endif if (ncp->cfg.urgent.tcp.maxports) { @@ -172,7 +175,7 @@ ncp_fsmStart(struct ncp *ncp, struct bundle *bundle) #ifndef NOINET6 } - if (Enabled(bundle, OPT_IPV6CP)) { + if (probe.ipv6_available && Enabled(bundle, OPT_IPV6CP)) { fsm_Up(&ncp->ipv6cp.fsm); fsm_Open(&ncp->ipv6cp.fsm); res++; @@ -209,7 +212,8 @@ ncp_SetLink(struct ncp *ncp, struct link *l) { ipcp_SetLink(&ncp->ipcp, l); #ifndef NOINET6 - ipv6cp_SetLink(&ncp->ipv6cp, l); + if (probe.ipv6_available) + ipv6cp_SetLink(&ncp->ipv6cp, l); #endif } @@ -277,7 +281,8 @@ ncp_QueueLen(struct ncp *ncp) result = ipcp_QueueLen(&ncp->ipcp); #ifndef NOINET6 - result += ipv6cp_QueueLen(&ncp->ipv6cp); + if (probe.ipv6_available) + result += ipv6cp_QueueLen(&ncp->ipv6cp); #endif result += mp_QueueLen(&ncp->mp); /* Usually empty */ @@ -304,9 +309,10 @@ ncp_DeleteQueues(struct ncp *ncp) m_freem(m_dequeue(q)); #ifndef NOINET6 - for (q = ipv6cp->Queue; q < ipv6cp->Queue + IPV6CP_QUEUES(ipv6cp); q++) - while (q->top) - m_freem(m_dequeue(q)); + if (probe.ipv6_available) + for (q = ipv6cp->Queue; q < ipv6cp->Queue + IPV6CP_QUEUES(ipv6cp); q++) + while (q->top) + m_freem(m_dequeue(q)); #endif link_DeleteQueue(&mp->link); /* Usually empty anyway */ @@ -352,7 +358,9 @@ ncp_PushPacket(struct ncp *ncp, int *af, struct link *l) int res; #ifndef NOINET6 - if (*af == AF_INET) { + if (!probe.ipv6_available) + res = ipcp_PushPacket(&bundle->ncp.ipcp, l); + else if (*af == AF_INET) { if ((res = ipcp_PushPacket(&bundle->ncp.ipcp, l))) *af = AF_INET6; else @@ -448,8 +456,9 @@ ncp_Show(struct cmdargs const *arg) int p; #ifndef NOINET6 - prompt_Printf(arg->prompt, "Next queued AF: %s\n", - ncp->afq == AF_INET6 ? "inet6" : "inet"); + if (probe.ipv6_available) + prompt_Printf(arg->prompt, "Next queued AF: %s\n", + ncp->afq == AF_INET6 ? "inet6" : "inet"); #endif if (ncp->route) { @@ -502,7 +511,8 @@ ncp_LayersOpen(struct ncp *ncp) n = !!(ncp->ipcp.fsm.state == ST_OPENED); #ifndef NOINET6 - n += !!(ncp->ipv6cp.fsm.state == ST_OPENED); + if (probe.ipv6_available) + n += !!(ncp->ipv6cp.fsm.state == ST_OPENED); #endif return n; @@ -518,9 +528,10 @@ ncp_LayersUnfinished(struct ncp *ncp) n++; #ifndef NOINET6 - if (ncp->ipv6cp.fsm.state > ST_CLOSED || - ncp->ipv6cp.fsm.state == ST_STARTING) - n++; + if (probe.ipv6_available) + if (ncp->ipv6cp.fsm.state > ST_CLOSED || + ncp->ipv6cp.fsm.state == ST_STARTING) + n++; #endif return n; @@ -534,9 +545,10 @@ ncp_Close(struct ncp *ncp) fsm_Close(&ncp->ipcp.fsm); #ifndef NOINET6 - if (ncp->ipv6cp.fsm.state > ST_CLOSED || - ncp->ipv6cp.fsm.state == ST_STARTING) - fsm_Close(&ncp->ipv6cp.fsm); + if (probe.ipv6_available) + if (ncp->ipv6cp.fsm.state > ST_CLOSED || + ncp->ipv6cp.fsm.state == ST_STARTING) + fsm_Close(&ncp->ipv6cp.fsm); #endif } @@ -545,6 +557,7 @@ ncp2initial(struct ncp *ncp) { fsm2initial(&ncp->ipcp.fsm); #ifndef NOINET6 - fsm2initial(&ncp->ipv6cp.fsm); + if (probe.ipv6_available) + fsm2initial(&ncp->ipv6cp.fsm); #endif } |