summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/ipv6cp.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2001-08-18 19:07:13 +0000
committerbrian <brian@FreeBSD.org>2001-08-18 19:07:13 +0000
commitbf052a75557ab676fa35cf9c1ec4003794999685 (patch)
tree7970bc01f669a62400f33174cd77c70f50ce85a9 /usr.sbin/ppp/ipv6cp.c
parent4a1bf71cd83111e13e0b6d30625186949667544d (diff)
downloadFreeBSD-src-bf052a75557ab676fa35cf9c1ec4003794999685.zip
FreeBSD-src-bf052a75557ab676fa35cf9c1ec4003794999685.tar.gz
Back out the previous fix to deal with kernels that don't support IPv6,
and implement a far more subtle and correct fix. The reason behind the infinite loop was that ppp was trying to make up initial IPv6 numbers and wasn't giving up when it failed unexpectedly to assign the addresses it just fabricated to it's interface (thinking that the reason was because another interface was using the same address). It now attempts this up to 100 times before just failing and trying to muddle along (in reality, this should never happen more than a couple of times unless our random number generator doesn't work). Also, when IPv6 is not available, don't even try to assign the IPv6 interface address in the first place...
Diffstat (limited to 'usr.sbin/ppp/ipv6cp.c')
-rw-r--r--usr.sbin/ppp/ipv6cp.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/usr.sbin/ppp/ipv6cp.c b/usr.sbin/ppp/ipv6cp.c
index 5067997..9a8c2e8 100644
--- a/usr.sbin/ppp/ipv6cp.c
+++ b/usr.sbin/ppp/ipv6cp.c
@@ -187,11 +187,15 @@ ipv6cp_Init(struct ipv6cp *ipv6cp, struct bundle *bundle, struct link *l,
while ((ipv6cp->peer_token = GenerateToken()) == ipv6cp->my_token)
;
- n = 100;
- while (n &&
- !ipcp_SetIPv6address(ipv6cp, ipv6cp->my_token, ipv6cp->peer_token))
- while (n && (ipv6cp->my_token = GenerateToken()) == ipv6cp->peer_token)
+ if (probe.ipv6_available) {
+ n = 100;
+ while (n &&
+ !ipcp_SetIPv6address(ipv6cp, ipv6cp->my_token, ipv6cp->peer_token)) {
n--;
+ while (n && (ipv6cp->my_token = GenerateToken()) == ipv6cp->peer_token)
+ n--;
+ }
+ }
throughput_init(&ipv6cp->throughput, SAMPLE_PERIOD);
memset(ipv6cp->Queue, '\0', sizeof ipv6cp->Queue);
@@ -225,11 +229,6 @@ ipv6cp_Show(struct cmdargs const *arg)
{
struct ipv6cp *ipv6cp = &arg->bundle->ncp.ipv6cp;
- if (!probe.ipv6_available) {
- prompt_Printf(arg->prompt, "ipv6 not available\n");
- return 0;
- }
-
prompt_Printf(arg->prompt, "%s [%s]\n", ipv6cp->fsm.name,
State2Nam(ipv6cp->fsm.state));
if (ipv6cp->fsm.state == ST_OPENED) {
@@ -257,7 +256,7 @@ ipv6cp_Input(struct bundle *bundle, struct link *l, struct mbuf *bp)
{
/* Got PROTO_IPV6CP from link */
m_settype(bp, MB_IPV6CPIN);
- if (bundle_Phase(bundle) == PHASE_NETWORK && probe.ipv6_available)
+ if (bundle_Phase(bundle) == PHASE_NETWORK)
fsm_Input(&bundle->ncp.ipv6cp.fsm, bp);
else {
if (bundle_Phase(bundle) < PHASE_NETWORK)
@@ -555,9 +554,11 @@ ipv6cp_DecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
"0x08lx: Unacceptable token!\n", (unsigned long)token);
else if (token != ipv6cp->my_token) {
n = 100;
- while (n && !ipcp_SetIPv6address(ipv6cp, token, ipv6cp->peer_token))
+ while (n && !ipcp_SetIPv6address(ipv6cp, token, ipv6cp->peer_token)) {
+ n--;
while (n && (token = GenerateToken()) == ipv6cp->peer_token)
n--;
+ }
if (n == 0) {
log_Printf(log_IsKept(LogIPV6CP) ? LogIPV6CP : LogPHASE,
OpenPOWER on IntegriCloud