aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Somers <brian@FreeBSD.org>2001-08-18 19:07:13 +0000
committerBrian Somers <brian@FreeBSD.org>2001-08-18 19:07:13 +0000
commit1136c6ac64148317a4496e6f447bc81640bcbb82 (patch)
tree7970bc01f669a62400f33174cd77c70f50ce85a9
parentbe30ee31a5379b9ed90e71b43c8242709913b853 (diff)
Notes
-rw-r--r--usr.sbin/ppp/bundle.c2
-rw-r--r--usr.sbin/ppp/command.c29
-rw-r--r--usr.sbin/ppp/fsm.c3
-rw-r--r--usr.sbin/ppp/ip.c3
-rw-r--r--usr.sbin/ppp/ipv6cp.c23
-rw-r--r--usr.sbin/ppp/ncp.c53
6 files changed, 44 insertions, 69 deletions
diff --git a/usr.sbin/ppp/bundle.c b/usr.sbin/ppp/bundle.c
index 8f0863fea153..adf5257db26f 100644
--- a/usr.sbin/ppp/bundle.c
+++ b/usr.sbin/ppp/bundle.c
@@ -555,7 +555,7 @@ bundle_DescriptorRead(struct fdescriptor *d, struct bundle *bundle,
}
af = ntohl(tun.header.family);
#ifndef NOINET6
- if (af != AF_INET && (!probe.ipv6_available || af != AF_INET6))
+ if (af != AF_INET && af != AF_INET6)
#else
if (af != AF_INET)
#endif
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c
index d8515c0e55f5..2c79b8906255 100644
--- a/usr.sbin/ppp/command.c
+++ b/usr.sbin/ppp/command.c
@@ -460,17 +460,15 @@ command_Expand(char **nargv, int argc, char const *const *oargv,
nargv[arg] = subst(nargv[arg], "HISADDR",
inet_ntoa(bundle->ncp.ipcp.peer_ip));
#ifndef NOINET6
- if (probe.ipv6_available)
- nargv[arg] = subst(nargv[arg], "HISADDR6",
- ncpaddr_ntoa(&bundle->ncp.ipv6cp.hisaddr));
+ nargv[arg] = subst(nargv[arg], "HISADDR6",
+ ncpaddr_ntoa(&bundle->ncp.ipv6cp.hisaddr));
#endif
nargv[arg] = subst(nargv[arg], "AUTHNAME", bundle->cfg.auth.name);
nargv[arg] = subst(nargv[arg], "INTERFACE", bundle->iface->name);
nargv[arg] = subst(nargv[arg], "MYADDR", inet_ntoa(bundle->ncp.ipcp.my_ip));
#ifndef NOINET6
- if (probe.ipv6_available)
- nargv[arg] = subst(nargv[arg], "MYADDR6",
- ncpaddr_ntoa(&bundle->ncp.ipv6cp.myaddr));
+ nargv[arg] = subst(nargv[arg], "MYADDR6",
+ ncpaddr_ntoa(&bundle->ncp.ipv6cp.myaddr));
#endif
nargv[arg] = subst(nargv[arg], "USER", bundle->ncp.mp.peer.authname);
nargv[arg] = subst(nargv[arg], "PEER_ENDDISC",
@@ -2342,8 +2340,7 @@ AddCommand(struct cmdargs const *arg)
ncpaddr_setip4(&gw, arg->bundle->ncp.ipcp.peer_ip);
addrs |= ROUTE_GWHISADDR;
#ifndef NOINET6
- } else if (probe.ipv6_available &&
- strcasecmp(arg->argv[arg->argn + gw_arg], "HISADDR6") == 0) {
+ } else if (strcasecmp(arg->argv[arg->argn + gw_arg], "HISADDR6") == 0) {
ncpaddr_copy(&gw, &arg->bundle->ncp.ipv6cp.hisaddr);
addrs |= ROUTE_GWHISADDR6;
#endif
@@ -2382,8 +2379,7 @@ DeleteCommand(struct cmdargs const *arg)
ncprange_setip4host(&dest, arg->bundle->ncp.ipcp.my_ip);
addrs = ROUTE_DSTMYADDR;
#ifndef NOINET6
- } else if (probe.ipv6_available &&
- strcasecmp(arg->argv[arg->argn], "MYADDR6") == 0) {
+ } else if (strcasecmp(arg->argv[arg->argn], "MYADDR6") == 0) {
ncprange_sethost(&dest, &arg->bundle->ncp.ipv6cp.myaddr);
addrs = ROUTE_DSTMYADDR6;
#endif
@@ -2391,8 +2387,7 @@ DeleteCommand(struct cmdargs const *arg)
ncprange_setip4host(&dest, arg->bundle->ncp.ipcp.peer_ip);
addrs = ROUTE_DSTHISADDR;
#ifndef NOINET6
- } else if (probe.ipv6_available &&
- strcasecmp(arg->argv[arg->argn], "HISADDR6") == 0) {
+ } else if (strcasecmp(arg->argv[arg->argn], "HISADDR6") == 0) {
ncprange_sethost(&dest, &arg->bundle->ncp.ipv6cp.hisaddr);
addrs = ROUTE_DSTHISADDR6;
#endif
@@ -2877,11 +2872,8 @@ ClearCommand(struct cmdargs const *arg)
} else if (strcasecmp(arg->argv[arg->argn], "ipcp") == 0)
t = &arg->bundle->ncp.ipcp.throughput;
#ifndef NOINET6
- else if (strcasecmp(arg->argv[arg->argn], "ipv6cp") == 0) {
- if (!probe.ipv6_available)
- return 0;
+ else if (strcasecmp(arg->argv[arg->argn], "ipv6cp") == 0)
t = &arg->bundle->ncp.ipv6cp.throughput;
- }
#endif
else
return -1;
@@ -3027,11 +3019,8 @@ IfaceClearCommand(struct cmdargs const *arg)
if (strcasecmp(arg->argv[arg->argn], "inet") == 0)
family = AF_INET;
#ifndef NOINET6
- else if (strcasecmp(arg->argv[arg->argn], "inet6") == 0) {
- if (!probe.ipv6_available)
- return 0;
+ else if (strcasecmp(arg->argv[arg->argn], "inet6") == 0)
family = AF_INET6;
- }
#endif
else
return -1;
diff --git a/usr.sbin/ppp/fsm.c b/usr.sbin/ppp/fsm.c
index 9f4cc0cfe175..47bcd68483f7 100644
--- a/usr.sbin/ppp/fsm.c
+++ b/usr.sbin/ppp/fsm.c
@@ -68,7 +68,6 @@
#include "async.h"
#include "physical.h"
#include "proto.h"
-#include "probe.h"
static void FsmSendConfigReq(struct fsm *);
static void FsmSendTerminateReq(struct fsm *);
@@ -897,7 +896,7 @@ FsmRecvProtoRej(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
break;
#ifndef NOINET6
case PROTO_IPV6CP:
- if (probe.ipv6_available && fp->proto == PROTO_LCP) {
+ if (fp->proto == PROTO_LCP) {
log_Printf(LogPHASE, "%s: IPV6CP protocol reject closes IPV6CP !\n",
fp->link->name);
fsm_Close(&fp->bundle->ncp.ipv6cp.fsm);
diff --git a/usr.sbin/ppp/ip.c b/usr.sbin/ppp/ip.c
index 38f5ed232933..30b6cb6f668b 100644
--- a/usr.sbin/ppp/ip.c
+++ b/usr.sbin/ppp/ip.c
@@ -79,7 +79,6 @@
#include "ncp.h"
#include "bundle.h"
#include "tun.h"
-#include "probe.h"
#define OPCODE_QUERY 0
@@ -942,7 +941,7 @@ ipv6_Input(struct bundle *bundle, struct link *l, struct mbuf *bp)
{
int nb;
- if (!probe.ipv6_available || bundle->ncp.ipv6cp.fsm.state != ST_OPENED) {
+ if (bundle->ncp.ipv6cp.fsm.state != ST_OPENED) {
log_Printf(LogWARN, "ipv6_Input: IPV6CP not open - packet dropped\n");
m_freem(bp);
return NULL;
diff --git a/usr.sbin/ppp/ipv6cp.c b/usr.sbin/ppp/ipv6cp.c
index 5067997c6e4a..9a8c2e831c5f 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,
diff --git a/usr.sbin/ppp/ncp.c b/usr.sbin/ppp/ncp.c
index 8a88800b70d7..a68c91f1e0f8 100644
--- a/usr.sbin/ppp/ncp.c
+++ b/usr.sbin/ppp/ncp.c
@@ -90,7 +90,6 @@
#include "pap.h"
#include "cbcp.h"
#include "datalink.h"
-#include "probe.h"
static u_short default_urgent_tcp_ports[] = {
@@ -134,9 +133,8 @@ ncp_Init(struct ncp *ncp, struct bundle *bundle)
ipcp_Init(&ncp->ipcp, bundle, &bundle->links->physical->link,
&bundle->fsm);
#ifndef NOINET6
- if (probe.ipv6_available)
- ipv6cp_Init(&ncp->ipv6cp, bundle, &bundle->links->physical->link,
- &bundle->fsm);
+ ipv6cp_Init(&ncp->ipv6cp, bundle, &bundle->links->physical->link,
+ &bundle->fsm);
#endif
}
@@ -145,8 +143,7 @@ ncp_Destroy(struct ncp *ncp)
{
ipcp_Destroy(&ncp->ipcp);
#ifndef NOINET6
- if (probe.ipv6_available)
- ipv6cp_Destroy(&ncp->ipv6cp);
+ ipv6cp_Destroy(&ncp->ipv6cp);
#endif
if (ncp->cfg.urgent.tcp.maxports) {
@@ -175,7 +172,7 @@ ncp_fsmStart(struct ncp *ncp, struct bundle *bundle)
#ifndef NOINET6
}
- if (probe.ipv6_available && Enabled(bundle, OPT_IPV6CP)) {
+ if (Enabled(bundle, OPT_IPV6CP)) {
fsm_Up(&ncp->ipv6cp.fsm);
fsm_Open(&ncp->ipv6cp.fsm);
res++;
@@ -212,8 +209,7 @@ ncp_SetLink(struct ncp *ncp, struct link *l)
{
ipcp_SetLink(&ncp->ipcp, l);
#ifndef NOINET6
- if (probe.ipv6_available)
- ipv6cp_SetLink(&ncp->ipv6cp, l);
+ ipv6cp_SetLink(&ncp->ipv6cp, l);
#endif
}
@@ -281,8 +277,7 @@ ncp_QueueLen(struct ncp *ncp)
result = ipcp_QueueLen(&ncp->ipcp);
#ifndef NOINET6
- if (probe.ipv6_available)
- result += ipv6cp_QueueLen(&ncp->ipv6cp);
+ result += ipv6cp_QueueLen(&ncp->ipv6cp);
#endif
result += mp_QueueLen(&ncp->mp); /* Usually empty */
@@ -309,10 +304,9 @@ ncp_DeleteQueues(struct ncp *ncp)
m_freem(m_dequeue(q));
#ifndef NOINET6
- if (probe.ipv6_available)
- for (q = ipv6cp->Queue; q < ipv6cp->Queue + IPV6CP_QUEUES(ipv6cp); q++)
- while (q->top)
- m_freem(m_dequeue(q));
+ 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 */
@@ -358,9 +352,7 @@ ncp_PushPacket(struct ncp *ncp, int *af, struct link *l)
int res;
#ifndef NOINET6
- if (!probe.ipv6_available)
- res = ipcp_PushPacket(&bundle->ncp.ipcp, l);
- else if (*af == AF_INET) {
+ if (*af == AF_INET) {
if ((res = ipcp_PushPacket(&bundle->ncp.ipcp, l)))
*af = AF_INET6;
else
@@ -456,9 +448,8 @@ ncp_Show(struct cmdargs const *arg)
int p;
#ifndef NOINET6
- if (probe.ipv6_available)
- prompt_Printf(arg->prompt, "Next queued AF: %s\n",
- ncp->afq == AF_INET6 ? "inet6" : "inet");
+ prompt_Printf(arg->prompt, "Next queued AF: %s\n",
+ ncp->afq == AF_INET6 ? "inet6" : "inet");
#endif
if (ncp->route) {
@@ -511,8 +502,7 @@ ncp_LayersOpen(struct ncp *ncp)
n = !!(ncp->ipcp.fsm.state == ST_OPENED);
#ifndef NOINET6
- if (probe.ipv6_available)
- n += !!(ncp->ipv6cp.fsm.state == ST_OPENED);
+ n += !!(ncp->ipv6cp.fsm.state == ST_OPENED);
#endif
return n;
@@ -528,10 +518,9 @@ ncp_LayersUnfinished(struct ncp *ncp)
n++;
#ifndef NOINET6
- if (probe.ipv6_available)
- if (ncp->ipv6cp.fsm.state > ST_CLOSED ||
- ncp->ipv6cp.fsm.state == ST_STARTING)
- n++;
+ if (ncp->ipv6cp.fsm.state > ST_CLOSED ||
+ ncp->ipv6cp.fsm.state == ST_STARTING)
+ n++;
#endif
return n;
@@ -545,10 +534,9 @@ ncp_Close(struct ncp *ncp)
fsm_Close(&ncp->ipcp.fsm);
#ifndef NOINET6
- if (probe.ipv6_available)
- if (ncp->ipv6cp.fsm.state > ST_CLOSED ||
- ncp->ipv6cp.fsm.state == ST_STARTING)
- fsm_Close(&ncp->ipv6cp.fsm);
+ if (ncp->ipv6cp.fsm.state > ST_CLOSED ||
+ ncp->ipv6cp.fsm.state == ST_STARTING)
+ fsm_Close(&ncp->ipv6cp.fsm);
#endif
}
@@ -557,7 +545,6 @@ ncp2initial(struct ncp *ncp)
{
fsm2initial(&ncp->ipcp.fsm);
#ifndef NOINET6
- if (probe.ipv6_available)
- fsm2initial(&ncp->ipv6cp.fsm);
+ fsm2initial(&ncp->ipv6cp.fsm);
#endif
}