Move the IPCP into struct bundle.
This commit is contained in:
parent
a611cad61d
commit
5828db6d2d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/cvs2svn/branches/MP/; revision=34557
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: arp.c,v 1.27.2.4 1998/02/21 01:44:55 brian Exp $
|
||||
* $Id: arp.c,v 1.27.2.5 1998/02/27 01:22:15 brian Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -53,10 +53,11 @@
|
||||
#include "route.h"
|
||||
#include "timer.h"
|
||||
#include "fsm.h"
|
||||
#include "bundle.h"
|
||||
#include "throughput.h"
|
||||
#include "defs.h"
|
||||
#include "iplist.h"
|
||||
#include "throughput.h"
|
||||
#include "ipcp.h"
|
||||
#include "bundle.h"
|
||||
#include "arp.h"
|
||||
|
||||
static int get_ether_addr(int, struct in_addr, struct sockaddr_dl *);
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: auth.c,v 1.27.2.11 1998/03/09 19:25:33 brian Exp $
|
||||
* $Id: auth.c,v 1.27.2.12 1998/03/13 00:43:51 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o Implement check against with registered IP addresses.
|
||||
@ -53,6 +53,7 @@
|
||||
#include "physical.h"
|
||||
#include "chat.h"
|
||||
#include "lcpproto.h"
|
||||
#include "bundle.h"
|
||||
|
||||
const char *
|
||||
Auth2Nam(u_short auth)
|
||||
@ -169,7 +170,7 @@ AuthValidate(struct bundle *bundle, const char *fname, const char *system,
|
||||
if (n > 2 && !UseHisaddr(bundle, vector[2], 1))
|
||||
return (0);
|
||||
/* XXX This should be deferred - we may join an existing bundle ! */
|
||||
ipcp_Setup(&IpcpInfo);
|
||||
ipcp_Setup(&bundle->ncp.ipcp);
|
||||
if (n > 3)
|
||||
SetLabel(vector[3]);
|
||||
return 1; /* Valid */
|
||||
@ -214,11 +215,12 @@ AuthGetSecret(struct bundle *bundle, const char *fname, const char *system,
|
||||
continue;
|
||||
if (strlen(vector[0]) == len && strncmp(vector[0], system, len) == 0) {
|
||||
if (setaddr)
|
||||
memset(&IpcpInfo.cfg.peer_range, '\0', sizeof IpcpInfo.cfg.peer_range);
|
||||
memset(&bundle->ncp.ipcp.cfg.peer_range, '\0',
|
||||
sizeof bundle->ncp.ipcp.cfg.peer_range);
|
||||
if (n > 2 && setaddr)
|
||||
if (UseHisaddr(bundle, vector[2], 1))
|
||||
/* XXX This should be deferred - we may join an existing bundle ! */
|
||||
ipcp_Setup(&IpcpInfo);
|
||||
ipcp_Setup(&bundle->ncp.ipcp);
|
||||
else
|
||||
return NULL;
|
||||
if (n > 3)
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: bundle.c,v 1.1.2.23 1998/03/13 00:44:38 brian Exp $
|
||||
* $Id: bundle.c,v 1.1.2.24 1998/03/13 21:06:59 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -114,9 +114,9 @@ bundle_NewPhase(struct bundle *bundle, u_int new)
|
||||
break;
|
||||
|
||||
case PHASE_NETWORK:
|
||||
ipcp_Setup(&IpcpInfo);
|
||||
FsmUp(&IpcpInfo.fsm);
|
||||
FsmOpen(&IpcpInfo.fsm);
|
||||
ipcp_Setup(&bundle->ncp.ipcp);
|
||||
FsmUp(&bundle->ncp.ipcp.fsm);
|
||||
FsmOpen(&bundle->ncp.ipcp.fsm);
|
||||
/* Fall through */
|
||||
|
||||
case PHASE_TERMINATE:
|
||||
@ -198,7 +198,7 @@ bundle_LayerUp(void *v, struct fsm *fp)
|
||||
bundle_NewPhase(bundle, PHASE_NETWORK);
|
||||
}
|
||||
|
||||
if (fp == &IpcpInfo.fsm) {
|
||||
if (fp->proto == PROTO_IPCP) {
|
||||
bundle_StartIdleTimer(bundle);
|
||||
if (mode & MODE_BACKGROUND && BGFiledes[1] != -1) {
|
||||
char c = EX_NORMAL;
|
||||
@ -248,14 +248,14 @@ bundle_LayerFinish(void *v, struct fsm *fp)
|
||||
}
|
||||
|
||||
/* when either the LCP or IPCP is down, drop IPCP */
|
||||
FsmDown(&IpcpInfo.fsm);
|
||||
FsmClose(&IpcpInfo.fsm); /* ST_INITIAL please */
|
||||
FsmDown(&bundle->ncp.ipcp.fsm);
|
||||
FsmClose(&bundle->ncp.ipcp.fsm); /* ST_INITIAL please */
|
||||
}
|
||||
|
||||
int
|
||||
bundle_LinkIsUp(const struct bundle *bundle)
|
||||
{
|
||||
return IpcpInfo.fsm.state == ST_OPENED;
|
||||
return bundle->ncp.ipcp.fsm.state == ST_OPENED;
|
||||
}
|
||||
|
||||
void
|
||||
@ -275,16 +275,17 @@ bundle_Close(struct bundle *bundle, const char *name, int staydown)
|
||||
|
||||
struct datalink *dl;
|
||||
|
||||
if (IpcpInfo.fsm.state > ST_CLOSED || IpcpInfo.fsm.state == ST_STARTING) {
|
||||
if (bundle->ncp.ipcp.fsm.state > ST_CLOSED ||
|
||||
bundle->ncp.ipcp.fsm.state == ST_STARTING) {
|
||||
bundle_NewPhase(bundle, PHASE_TERMINATE);
|
||||
FsmClose(&IpcpInfo.fsm);
|
||||
FsmClose(&bundle->ncp.ipcp.fsm);
|
||||
if (staydown)
|
||||
for (dl = bundle->links; dl; dl = dl->next)
|
||||
datalink_StayDown(dl);
|
||||
} else {
|
||||
if (IpcpInfo.fsm.state > ST_INITIAL) {
|
||||
FsmClose(&IpcpInfo.fsm);
|
||||
FsmDown(&IpcpInfo.fsm);
|
||||
if (bundle->ncp.ipcp.fsm.state > ST_INITIAL) {
|
||||
FsmClose(&bundle->ncp.ipcp.fsm);
|
||||
FsmDown(&bundle->ncp.ipcp.fsm);
|
||||
}
|
||||
for (dl = bundle->links; dl; dl = dl->next)
|
||||
datalink_Close(dl, staydown);
|
||||
@ -407,7 +408,8 @@ bundle_Create(const char *prefix)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ipcp_Init(&IpcpInfo, &bundle, &bundle.links->physical->link, &bundle.fsm);
|
||||
ipcp_Init(&bundle.ncp.ipcp, &bundle, &bundle.links->physical->link,
|
||||
&bundle.fsm);
|
||||
|
||||
/* Clean out any leftover crud */
|
||||
bundle_CleanInterface(&bundle);
|
||||
@ -454,7 +456,7 @@ bundle_Destroy(struct bundle *bundle)
|
||||
struct datalink *dl;
|
||||
|
||||
if (mode & MODE_AUTO) {
|
||||
IpcpCleanInterface(&IpcpInfo.fsm);
|
||||
IpcpCleanInterface(&bundle->ncp.ipcp.fsm);
|
||||
bundle_DownInterface(bundle);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: bundle.h,v 1.1.2.14 1998/03/13 00:43:53 brian Exp $
|
||||
* $Id: bundle.h,v 1.1.2.15 1998/03/13 00:44:33 brian Exp $
|
||||
*/
|
||||
|
||||
#define PHASE_DEAD 0 /* Link is dead */
|
||||
@ -52,6 +52,10 @@ struct bundle {
|
||||
int idle_timeout; /* NCP Idle timeout value */
|
||||
} cfg;
|
||||
|
||||
struct {
|
||||
struct ipcp ipcp; /* Our IPCP FSM */
|
||||
} ncp;
|
||||
|
||||
struct pppTimer IdleTimer; /* timeout after cfg.idle_timeout */
|
||||
};
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: ccp.c,v 1.30.2.18 1998/03/13 00:43:54 brian Exp $
|
||||
* $Id: ccp.c,v 1.30.2.19 1998/03/13 00:44:39 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o Support other compression protocols
|
||||
@ -42,12 +42,14 @@
|
||||
#include "vars.h"
|
||||
#include "pred.h"
|
||||
#include "deflate.h"
|
||||
#include "throughput.h"
|
||||
#include "iplist.h"
|
||||
#include "ipcp.h"
|
||||
#include "bundle.h"
|
||||
#include "descriptor.h"
|
||||
#include "prompt.h"
|
||||
#include "lqr.h"
|
||||
#include "hdlc.h"
|
||||
#include "throughput.h"
|
||||
#include "link.h"
|
||||
#include "chat.h"
|
||||
#include "auth.h"
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: chap.c,v 1.28.2.14 1998/03/13 00:43:54 brian Exp $
|
||||
* $Id: chap.c,v 1.28.2.15 1998/03/13 21:07:00 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -61,6 +61,8 @@
|
||||
#include "link.h"
|
||||
#include "descriptor.h"
|
||||
#include "physical.h"
|
||||
#include "iplist.h"
|
||||
#include "ipcp.h"
|
||||
#include "bundle.h"
|
||||
#include "ccp.h"
|
||||
#include "chat.h"
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: command.c,v 1.131.2.35 1998/03/13 00:44:41 brian Exp $
|
||||
* $Id: command.c,v 1.131.2.36 1998/03/13 21:07:01 brian Exp $
|
||||
*
|
||||
*/
|
||||
#include <sys/param.h>
|
||||
@ -274,11 +274,11 @@ ShellCommand(struct cmdargs const *arg, int bg)
|
||||
argv[0] = strdup(arg->argv[0]);
|
||||
for (argc = 1; argc < arg->argc; argc++) {
|
||||
if (strcasecmp(arg->argv[argc], "HISADDR") == 0)
|
||||
argv[argc] = strdup(inet_ntoa(IpcpInfo.peer_ip));
|
||||
argv[argc] = strdup(inet_ntoa(arg->bundle->ncp.ipcp.peer_ip));
|
||||
else if (strcasecmp(arg->argv[argc], "INTERFACE") == 0)
|
||||
argv[argc] = strdup(arg->bundle->ifname);
|
||||
else if (strcasecmp(arg->argv[argc], "MYADDR") == 0)
|
||||
argv[argc] = strdup(inet_ntoa(IpcpInfo.my_ip));
|
||||
argv[argc] = strdup(inet_ntoa(arg->bundle->ncp.ipcp.my_ip));
|
||||
else
|
||||
argv[argc] = strdup(arg->argv[argc]);
|
||||
}
|
||||
@ -545,13 +545,13 @@ ShowMSExt(struct cmdargs const *arg)
|
||||
{
|
||||
prompt_Printf(&prompt, " MS PPP extention values \n");
|
||||
prompt_Printf(&prompt, " Primary NS : %s\n",
|
||||
inet_ntoa(IpcpInfo.cfg.ns_entries[0]));
|
||||
inet_ntoa(arg->bundle->ncp.ipcp.cfg.ns_entries[0]));
|
||||
prompt_Printf(&prompt, " Secondary NS : %s\n",
|
||||
inet_ntoa(IpcpInfo.cfg.ns_entries[1]));
|
||||
inet_ntoa(arg->bundle->ncp.ipcp.cfg.ns_entries[1]));
|
||||
prompt_Printf(&prompt, " Primary NBNS : %s\n",
|
||||
inet_ntoa(IpcpInfo.cfg.nbns_entries[0]));
|
||||
inet_ntoa(arg->bundle->ncp.ipcp.cfg.nbns_entries[0]));
|
||||
prompt_Printf(&prompt, " Secondary NBNS : %s\n",
|
||||
inet_ntoa(IpcpInfo.cfg.nbns_entries[1]));
|
||||
inet_ntoa(arg->bundle->ncp.ipcp.cfg.nbns_entries[1]));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1181,30 +1181,31 @@ GetIpAddr(const char *cp)
|
||||
static int
|
||||
SetInterfaceAddr(struct cmdargs const *arg)
|
||||
{
|
||||
struct ipcp *ipcp = &arg->bundle->ncp.ipcp;
|
||||
const char *hisaddr;
|
||||
|
||||
hisaddr = NULL;
|
||||
IpcpInfo.cfg.my_range.ipaddr.s_addr = INADDR_ANY;
|
||||
IpcpInfo.cfg.peer_range.ipaddr.s_addr = INADDR_ANY;
|
||||
ipcp->cfg.my_range.ipaddr.s_addr = INADDR_ANY;
|
||||
ipcp->cfg.peer_range.ipaddr.s_addr = INADDR_ANY;
|
||||
|
||||
if (arg->argc > 4)
|
||||
return -1;
|
||||
|
||||
IpcpInfo.cfg.HaveTriggerAddress = 0;
|
||||
ipcp->cfg.HaveTriggerAddress = 0;
|
||||
ifnetmask.s_addr = 0;
|
||||
iplist_reset(&IpcpInfo.cfg.peer_list);
|
||||
iplist_reset(&ipcp->cfg.peer_list);
|
||||
|
||||
if (arg->argc > 0) {
|
||||
if (!ParseAddr(arg->argc, arg->argv, &IpcpInfo.cfg.my_range.ipaddr,
|
||||
&IpcpInfo.cfg.my_range.mask, &IpcpInfo.cfg.my_range.width))
|
||||
if (!ParseAddr(ipcp, arg->argc, arg->argv, &ipcp->cfg.my_range.ipaddr,
|
||||
&ipcp->cfg.my_range.mask, &ipcp->cfg.my_range.width))
|
||||
return 1;
|
||||
if (arg->argc > 1) {
|
||||
hisaddr = arg->argv[1];
|
||||
if (arg->argc > 2) {
|
||||
ifnetmask = GetIpAddr(arg->argv[2]);
|
||||
if (arg->argc > 3) {
|
||||
IpcpInfo.cfg.TriggerAddress = GetIpAddr(arg->argv[3]);
|
||||
IpcpInfo.cfg.HaveTriggerAddress = 1;
|
||||
ipcp->cfg.TriggerAddress = GetIpAddr(arg->argv[3]);
|
||||
ipcp->cfg.HaveTriggerAddress = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1213,15 +1214,15 @@ SetInterfaceAddr(struct cmdargs const *arg)
|
||||
/*
|
||||
* For backwards compatibility, 0.0.0.0 means any address.
|
||||
*/
|
||||
if (IpcpInfo.cfg.my_range.ipaddr.s_addr == INADDR_ANY) {
|
||||
IpcpInfo.cfg.my_range.mask.s_addr = INADDR_ANY;
|
||||
IpcpInfo.cfg.my_range.width = 0;
|
||||
if (ipcp->cfg.my_range.ipaddr.s_addr == INADDR_ANY) {
|
||||
ipcp->cfg.my_range.mask.s_addr = INADDR_ANY;
|
||||
ipcp->cfg.my_range.width = 0;
|
||||
}
|
||||
IpcpInfo.my_ip.s_addr = IpcpInfo.cfg.my_range.ipaddr.s_addr;
|
||||
ipcp->my_ip.s_addr = ipcp->cfg.my_range.ipaddr.s_addr;
|
||||
|
||||
if (IpcpInfo.cfg.peer_range.ipaddr.s_addr == INADDR_ANY) {
|
||||
IpcpInfo.cfg.peer_range.mask.s_addr = INADDR_ANY;
|
||||
IpcpInfo.cfg.peer_range.width = 0;
|
||||
if (ipcp->cfg.peer_range.ipaddr.s_addr == INADDR_ANY) {
|
||||
ipcp->cfg.peer_range.mask.s_addr = INADDR_ANY;
|
||||
ipcp->cfg.peer_range.width = 0;
|
||||
}
|
||||
|
||||
if (hisaddr && !UseHisaddr(arg->bundle, hisaddr, mode & MODE_AUTO))
|
||||
@ -1233,10 +1234,8 @@ SetInterfaceAddr(struct cmdargs const *arg)
|
||||
#ifndef NOMSEXT
|
||||
|
||||
static void
|
||||
SetMSEXT(struct in_addr * pri_addr,
|
||||
struct in_addr * sec_addr,
|
||||
int argc,
|
||||
char const *const *argv)
|
||||
SetMSEXT(struct ipcp *ipcp, struct in_addr * pri_addr,
|
||||
struct in_addr * sec_addr, int argc, char const *const *argv)
|
||||
{
|
||||
int dummyint;
|
||||
struct in_addr dummyaddr;
|
||||
@ -1244,9 +1243,9 @@ SetMSEXT(struct in_addr * pri_addr,
|
||||
pri_addr->s_addr = sec_addr->s_addr = 0L;
|
||||
|
||||
if (argc > 0) {
|
||||
ParseAddr(argc, argv++, pri_addr, &dummyaddr, &dummyint);
|
||||
ParseAddr(ipcp, argc, argv++, pri_addr, &dummyaddr, &dummyint);
|
||||
if (--argc > 0)
|
||||
ParseAddr(argc, argv++, sec_addr, &dummyaddr, &dummyint);
|
||||
ParseAddr(ipcp, argc, argv++, sec_addr, &dummyaddr, &dummyint);
|
||||
else
|
||||
sec_addr->s_addr = pri_addr->s_addr;
|
||||
}
|
||||
@ -1263,16 +1262,16 @@ SetMSEXT(struct in_addr * pri_addr,
|
||||
static int
|
||||
SetNS(struct cmdargs const *arg)
|
||||
{
|
||||
SetMSEXT(&IpcpInfo.cfg.ns_entries[0], &IpcpInfo.cfg.ns_entries[1],
|
||||
arg->argc, arg->argv);
|
||||
SetMSEXT(&arg->bundle->ncp.ipcp, &arg->bundle->ncp.ipcp.cfg.ns_entries[0],
|
||||
&arg->bundle->ncp.ipcp.cfg.ns_entries[1], arg->argc, arg->argv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
SetNBNS(struct cmdargs const *arg)
|
||||
{
|
||||
SetMSEXT(&IpcpInfo.cfg.nbns_entries[0], &IpcpInfo.cfg.nbns_entries[1],
|
||||
arg->argc, arg->argv);
|
||||
SetMSEXT(&arg->bundle->ncp.ipcp, &arg->bundle->ncp.ipcp.cfg.nbns_entries[0],
|
||||
&arg->bundle->ncp.ipcp.cfg.nbns_entries[1], arg->argc, arg->argv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1490,16 +1489,16 @@ AddCommand(struct cmdargs const *arg)
|
||||
}
|
||||
else {
|
||||
if (strcasecmp(arg->argv[0], "MYADDR") == 0)
|
||||
dest = IpcpInfo.my_ip;
|
||||
dest = arg->bundle->ncp.ipcp.my_ip;
|
||||
else if (strcasecmp(arg->argv[0], "HISADDR") == 0)
|
||||
dest = IpcpInfo.peer_ip;
|
||||
dest = arg->bundle->ncp.ipcp.peer_ip;
|
||||
else
|
||||
dest = GetIpAddr(arg->argv[0]);
|
||||
netmask = GetIpAddr(arg->argv[1]);
|
||||
gw = 2;
|
||||
}
|
||||
if (strcasecmp(arg->argv[gw], "HISADDR") == 0)
|
||||
gateway = IpcpInfo.peer_ip;
|
||||
gateway = arg->bundle->ncp.ipcp.peer_ip;
|
||||
else if (strcasecmp(arg->argv[gw], "INTERFACE") == 0)
|
||||
gateway.s_addr = INADDR_ANY;
|
||||
else
|
||||
@ -1519,7 +1518,7 @@ DeleteCommand(struct cmdargs const *arg)
|
||||
DeleteIfRoutes(arg->bundle, 0);
|
||||
else {
|
||||
if (strcasecmp(arg->argv[0], "MYADDR") == 0)
|
||||
dest = IpcpInfo.my_ip;
|
||||
dest = arg->bundle->ncp.ipcp.my_ip;
|
||||
else if (strcasecmp(arg->argv[0], "default") == 0)
|
||||
dest.s_addr = INADDR_ANY;
|
||||
else
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: datalink.c,v 1.1.2.20 1998/03/13 00:44:42 brian Exp $
|
||||
* $Id: datalink.c,v 1.1.2.21 1998/03/13 21:07:03 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -51,14 +51,14 @@
|
||||
#include "throughput.h"
|
||||
#include "link.h"
|
||||
#include "physical.h"
|
||||
#include "iplist.h"
|
||||
#include "ipcp.h"
|
||||
#include "bundle.h"
|
||||
#include "chat.h"
|
||||
#include "ccp.h"
|
||||
#include "auth.h"
|
||||
#include "main.h"
|
||||
#include "modem.h"
|
||||
#include "iplist.h"
|
||||
#include "ipcp.h"
|
||||
#include "prompt.h"
|
||||
#include "lcpproto.h"
|
||||
#include "pap.h"
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: filter.c,v 1.22.2.5 1998/02/21 01:45:06 brian Exp $
|
||||
* $Id: filter.c,v 1.22.2.6 1998/03/13 00:44:01 brian Exp $
|
||||
*
|
||||
* TODO: Shoud send ICMP error message when we discard packets.
|
||||
*/
|
||||
@ -49,6 +49,7 @@
|
||||
#include "filter.h"
|
||||
#include "descriptor.h"
|
||||
#include "prompt.h"
|
||||
#include "bundle.h"
|
||||
|
||||
struct filterent ifilters[MAXFILTERS]; /* incoming packet filter */
|
||||
struct filterent ofilters[MAXFILTERS]; /* outgoing packet filter */
|
||||
@ -70,11 +71,8 @@ static u_long netmasks[33] = {
|
||||
};
|
||||
|
||||
int
|
||||
ParseAddr(int argc,
|
||||
char const *const *argv,
|
||||
struct in_addr * paddr,
|
||||
struct in_addr * pmask,
|
||||
int *pwidth)
|
||||
ParseAddr(struct ipcp *ipcp, int argc, char const *const *argv,
|
||||
struct in_addr *paddr, struct in_addr *pmask, int *pwidth)
|
||||
{
|
||||
int bits, len;
|
||||
char *wp;
|
||||
@ -92,9 +90,9 @@ ParseAddr(int argc,
|
||||
len = cp ? cp - *argv : strlen(*argv);
|
||||
|
||||
if (strncasecmp(*argv, "HISADDR", len) == 0)
|
||||
*paddr = IpcpInfo.peer_ip;
|
||||
*paddr = ipcp->peer_ip;
|
||||
else if (strncasecmp(*argv, "MYADDR", len) == 0)
|
||||
*paddr = IpcpInfo.my_ip;
|
||||
*paddr = ipcp->my_ip;
|
||||
else if (len > 15)
|
||||
LogPrintf(LogWARN, "ParseAddr: %s: Bad address\n", *argv);
|
||||
else {
|
||||
@ -281,7 +279,8 @@ ParseUdpOrTcp(int argc, char const *const *argv, int proto)
|
||||
static const char *opname[] = {"none", "eq", "gt", NULL, "lt"};
|
||||
|
||||
static int
|
||||
Parse(int argc, char const *const *argv, struct filterent * ofp)
|
||||
Parse(struct ipcp *ipcp, int argc, char const *const *argv,
|
||||
struct filterent * ofp)
|
||||
{
|
||||
int action, proto;
|
||||
int val;
|
||||
@ -341,12 +340,12 @@ Parse(int argc, char const *const *argv, struct filterent * ofp)
|
||||
}
|
||||
proto = ParseProto(argc, argv);
|
||||
if (proto == P_NONE) {
|
||||
if (ParseAddr(argc, argv, &fp->saddr, &fp->smask, &fp->swidth)) {
|
||||
if (ParseAddr(ipcp, argc, argv, &fp->saddr, &fp->smask, &fp->swidth)) {
|
||||
argc--;
|
||||
argv++;
|
||||
proto = ParseProto(argc, argv);
|
||||
if (proto == P_NONE) {
|
||||
if (ParseAddr(argc, argv, &fp->daddr, &fp->dmask, &fp->dwidth)) {
|
||||
if (ParseAddr(ipcp, argc, argv, &fp->daddr, &fp->dmask, &fp->dwidth)) {
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
@ -404,7 +403,7 @@ int
|
||||
SetIfilter(struct cmdargs const *arg)
|
||||
{
|
||||
if (arg->argc > 0) {
|
||||
Parse(arg->argc, arg->argv, ifilters);
|
||||
Parse(&arg->bundle->ncp.ipcp, arg->argc, arg->argv, ifilters);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
@ -414,7 +413,7 @@ int
|
||||
SetOfilter(struct cmdargs const *arg)
|
||||
{
|
||||
if (arg->argc > 0) {
|
||||
(void) Parse(arg->argc, arg->argv, ofilters);
|
||||
Parse(&arg->bundle->ncp.ipcp, arg->argc, arg->argv, ofilters);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
@ -424,7 +423,7 @@ int
|
||||
SetDfilter(struct cmdargs const *arg)
|
||||
{
|
||||
if (arg->argc > 0) {
|
||||
(void) Parse(arg->argc, arg->argv, dfilters);
|
||||
Parse(&arg->bundle->ncp.ipcp, arg->argc, arg->argv, dfilters);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
@ -434,7 +433,7 @@ int
|
||||
SetAfilter(struct cmdargs const *arg)
|
||||
{
|
||||
if (arg->argc > 0) {
|
||||
(void) Parse(arg->argc, arg->argv, afilters);
|
||||
Parse(&arg->bundle->ncp.ipcp, arg->argc, arg->argv, afilters);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
|
@ -15,7 +15,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: filter.h,v 1.10 1997/10/26 01:02:35 brian Exp $
|
||||
* $Id: filter.h,v 1.11 1997/11/22 03:37:30 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -76,7 +76,8 @@ extern struct filterent ofilters[MAXFILTERS]; /* outgoing packet filter */
|
||||
extern struct filterent dfilters[MAXFILTERS]; /* dial-out packet filter */
|
||||
extern struct filterent afilters[MAXFILTERS]; /* keep-alive packet filter */
|
||||
|
||||
extern int ParseAddr(int, char const *const *, struct in_addr *, struct in_addr *, int *);
|
||||
extern int ParseAddr(struct ipcp *, int, char const *const *, struct in_addr *,
|
||||
struct in_addr *, int *);
|
||||
extern int ShowIfilter(struct cmdargs const *);
|
||||
extern int ShowOfilter(struct cmdargs const *);
|
||||
extern int ShowDfilter(struct cmdargs const *);
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: fsm.c,v 1.27.2.17 1998/03/13 00:44:02 brian Exp $
|
||||
* $Id: fsm.c,v 1.27.2.18 1998/03/13 00:44:43 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o Refer loglevel for log output
|
||||
@ -49,6 +49,8 @@
|
||||
#include "link.h"
|
||||
#include "descriptor.h"
|
||||
#include "physical.h"
|
||||
#include "iplist.h"
|
||||
#include "ipcp.h"
|
||||
#include "bundle.h"
|
||||
#include "auth.h"
|
||||
#include "chat.h"
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: hdlc.c,v 1.28.2.17 1998/03/13 00:44:44 brian Exp $
|
||||
* $Id: hdlc.c,v 1.28.2.18 1998/03/13 21:07:04 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -417,7 +417,7 @@ DecodePacket(struct bundle *bundle, u_short proto, struct mbuf * bp,
|
||||
IpInput(bundle, bp);
|
||||
break;
|
||||
case PROTO_IPCP:
|
||||
IpcpInput(bp);
|
||||
IpcpInput(&bundle->ncp.ipcp, bp);
|
||||
break;
|
||||
case PROTO_CCP:
|
||||
CcpInput(&dl->ccp, bundle, bp);
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: ip.c,v 1.38.2.10 1998/03/09 19:26:37 brian Exp $
|
||||
* $Id: ip.c,v 1.38.2.11 1998/03/13 00:44:04 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o Return ICMP message for filterd packet
|
||||
@ -57,11 +57,11 @@
|
||||
#include "hdlc.h"
|
||||
#include "loadalias.h"
|
||||
#include "vars.h"
|
||||
#include "throughput.h"
|
||||
#include "iplist.h"
|
||||
#include "ipcp.h"
|
||||
#include "filter.h"
|
||||
#include "bundle.h"
|
||||
#include "iplist.h"
|
||||
#include "throughput.h"
|
||||
#include "ipcp.h"
|
||||
#include "vjcomp.h"
|
||||
#include "lcp.h"
|
||||
#include "modem.h"
|
||||
@ -201,7 +201,7 @@ IcmpError(struct ip * pip, int code)
|
||||
SendPppFrame(bp);
|
||||
if (ipKeepAlive)
|
||||
bundle_StartIdleTimer(bundle);
|
||||
IpcpAddOutOctets(cnt);
|
||||
ipcp_AddOutOctets(cnt);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -363,7 +363,7 @@ IpInput(struct bundle *bundle, struct mbuf * bp)
|
||||
pfree(bp);
|
||||
return;
|
||||
}
|
||||
IpcpAddInOctets(nb);
|
||||
ipcp_AddInOctets(&bundle->ncp.ipcp, nb);
|
||||
|
||||
nb = ntohs(((struct ip *) tun.data)->ip_len);
|
||||
nb += sizeof tun - sizeof tun.data;
|
||||
@ -411,7 +411,7 @@ IpInput(struct bundle *bundle, struct mbuf * bp)
|
||||
pfree(bp);
|
||||
return;
|
||||
}
|
||||
IpcpAddInOctets(nb);
|
||||
ipcp_AddInOctets(&bundle->ncp.ipcp, nb);
|
||||
nb += sizeof tun - sizeof tun.data;
|
||||
nw = write(bundle->tun_fd, &tun, nb);
|
||||
if (nw != nb)
|
||||
@ -457,7 +457,7 @@ IpStartOutput(struct link *l, struct bundle *bundle)
|
||||
struct mbuf *bp;
|
||||
int cnt;
|
||||
|
||||
if (IpcpInfo.fsm.state != ST_OPENED)
|
||||
if (bundle->ncp.ipcp.fsm.state != ST_OPENED)
|
||||
return;
|
||||
for (queue = &IpOutputQueues[PRI_FAST]; queue >= IpOutputQueues; queue--) {
|
||||
if (queue->top) {
|
||||
@ -467,7 +467,7 @@ IpStartOutput(struct link *l, struct bundle *bundle)
|
||||
SendPppFrame(l, bp, bundle);
|
||||
if (ipKeepAlive)
|
||||
bundle_StartIdleTimer(bundle);
|
||||
IpcpAddOutOctets(cnt);
|
||||
ipcp_AddOutOctets(&bundle->ncp.ipcp, cnt);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: ipcp.c,v 1.50.2.19 1998/03/09 19:26:38 brian Exp $
|
||||
* $Id: ipcp.c,v 1.50.2.20 1998/03/13 00:44:05 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o More RFC1772 backwoard compatibility
|
||||
@ -103,8 +103,6 @@ static struct fsm_callbacks ipcp_Callbacks = {
|
||||
NullRecvResetAck
|
||||
};
|
||||
|
||||
struct ipcp IpcpInfo;
|
||||
|
||||
static const char *cftypes[] = {
|
||||
/* Check out the latest ``Assigned numbers'' rfc (rfc1700.txt) */
|
||||
"???",
|
||||
@ -127,73 +125,76 @@ static const char *cftypes128[] = {
|
||||
#define NCFTYPES128 (sizeof cftypes128/sizeof cftypes128[0])
|
||||
|
||||
void
|
||||
IpcpAddInOctets(int n)
|
||||
ipcp_AddInOctets(struct ipcp *ipcp, int n)
|
||||
{
|
||||
throughput_addin(&IpcpInfo.throughput, n);
|
||||
throughput_addin(&ipcp->throughput, n);
|
||||
}
|
||||
|
||||
void
|
||||
IpcpAddOutOctets(int n)
|
||||
ipcp_AddOutOctets(struct ipcp *ipcp, int n)
|
||||
{
|
||||
throughput_addout(&IpcpInfo.throughput, n);
|
||||
throughput_addout(&ipcp->throughput, n);
|
||||
}
|
||||
|
||||
int
|
||||
ReportIpcpStatus(struct cmdargs const *arg)
|
||||
{
|
||||
prompt_Printf(&prompt, "%s [%s]\n", IpcpInfo.fsm.name,
|
||||
StateNames[IpcpInfo.fsm.state]);
|
||||
if (IpcpInfo.fsm.state == ST_OPENED) {
|
||||
prompt_Printf(&prompt, "%s [%s]\n", arg->bundle->ncp.ipcp.fsm.name,
|
||||
StateNames[arg->bundle->ncp.ipcp.fsm.state]);
|
||||
if (arg->bundle->ncp.ipcp.fsm.state == ST_OPENED) {
|
||||
prompt_Printf(&prompt, " His side: %s, %s\n",
|
||||
inet_ntoa(IpcpInfo.peer_ip), vj2asc(IpcpInfo.peer_compproto));
|
||||
inet_ntoa(arg->bundle->ncp.ipcp.peer_ip),
|
||||
vj2asc(arg->bundle->ncp.ipcp.peer_compproto));
|
||||
prompt_Printf(&prompt, " My side: %s, %s\n",
|
||||
inet_ntoa(IpcpInfo.my_ip), vj2asc(IpcpInfo.my_compproto));
|
||||
inet_ntoa(arg->bundle->ncp.ipcp.my_ip),
|
||||
vj2asc(arg->bundle->ncp.ipcp.my_compproto));
|
||||
}
|
||||
|
||||
prompt_Printf(&prompt, "\nDefaults:\n");
|
||||
prompt_Printf(&prompt, " My Address: %s/%d\n",
|
||||
inet_ntoa(IpcpInfo.cfg.my_range.ipaddr), IpcpInfo.cfg.my_range.width);
|
||||
if (iplist_isvalid(&IpcpInfo.cfg.peer_list))
|
||||
inet_ntoa(arg->bundle->ncp.ipcp.cfg.my_range.ipaddr),
|
||||
arg->bundle->ncp.ipcp.cfg.my_range.width);
|
||||
if (iplist_isvalid(&arg->bundle->ncp.ipcp.cfg.peer_list))
|
||||
prompt_Printf(&prompt, " His Address: %s\n",
|
||||
IpcpInfo.cfg.peer_list.src);
|
||||
arg->bundle->ncp.ipcp.cfg.peer_list.src);
|
||||
else
|
||||
prompt_Printf(&prompt, " His Address: %s/%d\n",
|
||||
inet_ntoa(IpcpInfo.cfg.peer_range.ipaddr),
|
||||
IpcpInfo.cfg.peer_range.width);
|
||||
if (IpcpInfo.cfg.HaveTriggerAddress)
|
||||
inet_ntoa(arg->bundle->ncp.ipcp.cfg.peer_range.ipaddr),
|
||||
arg->bundle->ncp.ipcp.cfg.peer_range.width);
|
||||
if (arg->bundle->ncp.ipcp.cfg.HaveTriggerAddress)
|
||||
prompt_Printf(&prompt, " Negotiation(trigger): %s\n",
|
||||
inet_ntoa(IpcpInfo.cfg.TriggerAddress));
|
||||
inet_ntoa(arg->bundle->ncp.ipcp.cfg.TriggerAddress));
|
||||
else
|
||||
prompt_Printf(&prompt, " Negotiation(trigger): MYADDR\n");
|
||||
prompt_Printf(&prompt, " Initial VJ slots: %d\n",
|
||||
IpcpInfo.cfg.VJInitSlots);
|
||||
arg->bundle->ncp.ipcp.cfg.VJInitSlots);
|
||||
prompt_Printf(&prompt, " Initial VJ compression: %s\n",
|
||||
IpcpInfo.cfg.VJInitComp ? "on" : "off");
|
||||
arg->bundle->ncp.ipcp.cfg.VJInitComp ? "on" : "off");
|
||||
|
||||
prompt_Printf(&prompt, "\n");
|
||||
throughput_disp(&IpcpInfo.throughput);
|
||||
throughput_disp(&arg->bundle->ncp.ipcp.throughput);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
SetInitVJ(struct cmdargs const *args)
|
||||
SetInitVJ(struct cmdargs const *arg)
|
||||
{
|
||||
if (args->argc != 2)
|
||||
if (arg->argc != 2)
|
||||
return -1;
|
||||
if (!strcasecmp(args->argv[0], "slots")) {
|
||||
if (!strcasecmp(arg->argv[0], "slots")) {
|
||||
int slots;
|
||||
|
||||
slots = atoi(args->argv[1]);
|
||||
slots = atoi(arg->argv[1]);
|
||||
if (slots < 4 || slots > 16)
|
||||
return 1;
|
||||
IpcpInfo.cfg.VJInitSlots = slots;
|
||||
arg->bundle->ncp.ipcp.cfg.VJInitSlots = slots;
|
||||
return 0;
|
||||
} else if (!strcasecmp(args->argv[0], "slotcomp")) {
|
||||
if (!strcasecmp(args->argv[1], "on"))
|
||||
IpcpInfo.cfg.VJInitComp = 1;
|
||||
else if (!strcasecmp(args->argv[1], "off"))
|
||||
IpcpInfo.cfg.VJInitComp = 0;
|
||||
} else if (!strcasecmp(arg->argv[0], "slotcomp")) {
|
||||
if (!strcasecmp(arg->argv[1], "on"))
|
||||
arg->bundle->ncp.ipcp.cfg.VJInitComp = 1;
|
||||
else if (!strcasecmp(arg->argv[1], "off"))
|
||||
arg->bundle->ncp.ipcp.cfg.VJInitComp = 0;
|
||||
else
|
||||
return 2;
|
||||
return 0;
|
||||
@ -367,8 +368,8 @@ ChooseHisAddr(struct bundle *bundle, struct ipcp *ipcp,
|
||||
struct in_addr try;
|
||||
int f;
|
||||
|
||||
for (f = 0; f < IpcpInfo.cfg.peer_list.nItems; f++) {
|
||||
try = iplist_next(&IpcpInfo.cfg.peer_list);
|
||||
for (f = 0; f < bundle->ncp.ipcp.cfg.peer_list.nItems; f++) {
|
||||
try = iplist_next(&bundle->ncp.ipcp.cfg.peer_list);
|
||||
LogPrintf(LogDEBUG, "ChooseHisAddr: Check item %d (%s)\n",
|
||||
f, inet_ntoa(try));
|
||||
if (ipcp_SetIPaddress(bundle, ipcp, gw, try, ifnetmask, 1) == 0) {
|
||||
@ -378,7 +379,7 @@ ChooseHisAddr(struct bundle *bundle, struct ipcp *ipcp,
|
||||
}
|
||||
}
|
||||
|
||||
if (f == IpcpInfo.cfg.peer_list.nItems) {
|
||||
if (f == bundle->ncp.ipcp.cfg.peer_list.nItems) {
|
||||
LogPrintf(LogDEBUG, "ChooseHisAddr: All addresses in use !\n");
|
||||
try.s_addr = INADDR_ANY;
|
||||
}
|
||||
@ -865,46 +866,48 @@ IpcpDecodeConfig(struct fsm *fp, u_char * cp, int plen, int mode_type)
|
||||
}
|
||||
|
||||
void
|
||||
IpcpInput(struct mbuf * bp)
|
||||
IpcpInput(struct ipcp *ipcp, struct mbuf * bp)
|
||||
{
|
||||
/* Got PROTO_IPCP from link */
|
||||
FsmInput(&IpcpInfo.fsm, bp);
|
||||
FsmInput(&ipcp->fsm, bp);
|
||||
}
|
||||
|
||||
int
|
||||
UseHisaddr(struct bundle *bundle, const char *hisaddr, int setaddr)
|
||||
{
|
||||
struct ipcp *ipcp = &bundle->ncp.ipcp;
|
||||
|
||||
/* Use `hisaddr' for the peers address (set iface if `setaddr') */
|
||||
memset(&IpcpInfo.cfg.peer_range, '\0', sizeof IpcpInfo.cfg.peer_range);
|
||||
iplist_reset(&IpcpInfo.cfg.peer_list);
|
||||
memset(&ipcp->cfg.peer_range, '\0', sizeof ipcp->cfg.peer_range);
|
||||
iplist_reset(&ipcp->cfg.peer_list);
|
||||
if (strpbrk(hisaddr, ",-")) {
|
||||
iplist_setsrc(&IpcpInfo.cfg.peer_list, hisaddr);
|
||||
if (iplist_isvalid(&IpcpInfo.cfg.peer_list)) {
|
||||
iplist_setrandpos(&IpcpInfo.cfg.peer_list);
|
||||
IpcpInfo.peer_ip = ChooseHisAddr
|
||||
(bundle, &IpcpInfo, IpcpInfo.my_ip);
|
||||
if (IpcpInfo.peer_ip.s_addr == INADDR_ANY) {
|
||||
LogPrintf(LogWARN, "%s: None available !\n", IpcpInfo.cfg.peer_list.src);
|
||||
iplist_setsrc(&ipcp->cfg.peer_list, hisaddr);
|
||||
if (iplist_isvalid(&ipcp->cfg.peer_list)) {
|
||||
iplist_setrandpos(&ipcp->cfg.peer_list);
|
||||
ipcp->peer_ip = ChooseHisAddr(bundle, ipcp, ipcp->my_ip);
|
||||
if (ipcp->peer_ip.s_addr == INADDR_ANY) {
|
||||
LogPrintf(LogWARN, "%s: None available !\n",
|
||||
ipcp->cfg.peer_list.src);
|
||||
return(0);
|
||||
}
|
||||
IpcpInfo.cfg.peer_range.ipaddr.s_addr = IpcpInfo.peer_ip.s_addr;
|
||||
IpcpInfo.cfg.peer_range.mask.s_addr = INADDR_BROADCAST;
|
||||
IpcpInfo.cfg.peer_range.width = 32;
|
||||
ipcp->cfg.peer_range.ipaddr.s_addr = ipcp->peer_ip.s_addr;
|
||||
ipcp->cfg.peer_range.mask.s_addr = INADDR_BROADCAST;
|
||||
ipcp->cfg.peer_range.width = 32;
|
||||
} else {
|
||||
LogPrintf(LogWARN, "%s: Invalid range !\n", hisaddr);
|
||||
return 0;
|
||||
}
|
||||
} else if (ParseAddr(1, &hisaddr, &IpcpInfo.cfg.peer_range.ipaddr,
|
||||
&IpcpInfo.cfg.peer_range.mask,
|
||||
&IpcpInfo.cfg.peer_range.width) != 0) {
|
||||
IpcpInfo.peer_ip.s_addr = IpcpInfo.cfg.peer_range.ipaddr.s_addr;
|
||||
} else if (ParseAddr(ipcp, 1, &hisaddr, &ipcp->cfg.peer_range.ipaddr,
|
||||
&ipcp->cfg.peer_range.mask,
|
||||
&ipcp->cfg.peer_range.width) != 0) {
|
||||
ipcp->peer_ip.s_addr = ipcp->cfg.peer_range.ipaddr.s_addr;
|
||||
|
||||
if (setaddr && ipcp_SetIPaddress(bundle, &IpcpInfo,
|
||||
IpcpInfo.cfg.my_range.ipaddr,
|
||||
IpcpInfo.cfg.peer_range.ipaddr, ifnetmask,
|
||||
0) < 0) {
|
||||
IpcpInfo.cfg.my_range.ipaddr.s_addr = INADDR_ANY;
|
||||
IpcpInfo.cfg.peer_range.ipaddr.s_addr = INADDR_ANY;
|
||||
if (setaddr && ipcp_SetIPaddress(bundle, ipcp,
|
||||
ipcp->cfg.my_range.ipaddr,
|
||||
ipcp->cfg.peer_range.ipaddr,
|
||||
ifnetmask, 0) < 0) {
|
||||
ipcp->cfg.my_range.ipaddr.s_addr = INADDR_ANY;
|
||||
ipcp->cfg.peer_range.ipaddr.s_addr = INADDR_ANY;
|
||||
return 0;
|
||||
}
|
||||
} else
|
||||
|
@ -15,7 +15,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: ipcp.h,v 1.18.2.13 1998/02/21 01:45:12 brian Exp $
|
||||
* $Id: ipcp.h,v 1.18.2.14 1998/02/27 01:22:27 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -76,8 +76,6 @@ struct ipcp {
|
||||
struct pppThroughput throughput; /* throughput statistics */
|
||||
};
|
||||
|
||||
extern struct ipcp IpcpInfo;
|
||||
|
||||
#define fsm2ipcp(fp) (fp->proto == PROTO_IPCP ? (struct ipcp *)fp : NULL)
|
||||
|
||||
extern void ipcp_Init(struct ipcp *, struct bundle *, struct link *l,
|
||||
@ -85,9 +83,9 @@ extern void ipcp_Init(struct ipcp *, struct bundle *, struct link *l,
|
||||
extern void ipcp_Setup(struct ipcp *);
|
||||
|
||||
extern int ReportIpcpStatus(struct cmdargs const *);
|
||||
extern void IpcpInput(struct mbuf *);
|
||||
extern void IpcpAddInOctets(int);
|
||||
extern void IpcpAddOutOctets(int);
|
||||
extern void IpcpInput(struct ipcp *, struct mbuf *);
|
||||
extern void ipcp_AddInOctets(struct ipcp *, int);
|
||||
extern void ipcp_AddOutOctets(struct ipcp *, int);
|
||||
extern int UseHisaddr(struct bundle *, const char *, int);
|
||||
extern int SetInitVJ(struct cmdargs const *);
|
||||
extern void IpcpCleanInterface(struct fsm *);
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: link.c,v 1.1.2.9 1998/02/27 01:22:36 brian Exp $
|
||||
* $Id: link.c,v 1.1.2.10 1998/03/13 00:44:09 brian Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -46,6 +46,8 @@
|
||||
#include "vars.h"
|
||||
#include "link.h"
|
||||
#include "fsm.h"
|
||||
#include "iplist.h"
|
||||
#include "ipcp.h"
|
||||
#include "bundle.h"
|
||||
#include "descriptor.h"
|
||||
#include "prompt.h"
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: lqr.c,v 1.22.2.10 1998/03/13 00:44:56 brian Exp $
|
||||
* $Id: lqr.c,v 1.22.2.11 1998/03/13 21:07:08 brian Exp $
|
||||
*
|
||||
* o LQR based on RFC1333
|
||||
*
|
||||
@ -48,6 +48,8 @@
|
||||
#include "link.h"
|
||||
#include "descriptor.h"
|
||||
#include "physical.h"
|
||||
#include "iplist.h"
|
||||
#include "ipcp.h"
|
||||
#include "bundle.h"
|
||||
#include "loadalias.h"
|
||||
#include "vars.h"
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: main.c,v 1.121.2.30 1998/03/13 00:44:13 brian Exp $
|
||||
* $Id: main.c,v 1.121.2.31 1998/03/13 21:07:09 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o Add commands for traffic summary, version display, etc.
|
||||
@ -54,7 +54,6 @@
|
||||
#include "timer.h"
|
||||
#include "fsm.h"
|
||||
#include "modem.h"
|
||||
#include "bundle.h"
|
||||
#include "lqr.h"
|
||||
#include "hdlc.h"
|
||||
#include "lcp.h"
|
||||
@ -62,6 +61,7 @@
|
||||
#include "iplist.h"
|
||||
#include "throughput.h"
|
||||
#include "ipcp.h"
|
||||
#include "bundle.h"
|
||||
#include "loadalias.h"
|
||||
#include "vars.h"
|
||||
#include "auth.h"
|
||||
@ -409,7 +409,7 @@ main(int argc, char **argv)
|
||||
*/
|
||||
SetLabel(label);
|
||||
if (mode & MODE_AUTO &&
|
||||
IpcpInfo.cfg.peer_range.ipaddr.s_addr == INADDR_ANY) {
|
||||
bundle->ncp.ipcp.cfg.peer_range.ipaddr.s_addr == INADDR_ANY) {
|
||||
LogPrintf(LogWARN, "You must \"set ifaddr\" in label %s for auto mode.\n",
|
||||
label);
|
||||
Cleanup(EX_START);
|
||||
@ -583,7 +583,8 @@ DoLoop(struct bundle *bundle)
|
||||
}
|
||||
if (!tun_check_header(tun, AF_INET))
|
||||
continue;
|
||||
if (((struct ip *)tun.data)->ip_dst.s_addr == IpcpInfo.my_ip.s_addr) {
|
||||
if (((struct ip *)tun.data)->ip_dst.s_addr ==
|
||||
bundle->ncp.ipcp.my_ip.s_addr) {
|
||||
/* we've been asked to send something addressed *to* us :( */
|
||||
if (VarLoopback) {
|
||||
pri = PacketCheck(tun.data, n, FL_IN);
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: modem.c,v 1.77.2.33 1998/03/13 00:44:46 brian Exp $
|
||||
* $Id: modem.c,v 1.77.2.34 1998/03/13 21:07:11 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -59,6 +59,8 @@
|
||||
#include "main.h"
|
||||
#include "throughput.h"
|
||||
#include "async.h"
|
||||
#include "iplist.h"
|
||||
#include "ipcp.h"
|
||||
#include "bundle.h"
|
||||
#include "link.h"
|
||||
#include "descriptor.h"
|
||||
|
@ -18,7 +18,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: pap.c,v 1.20.2.15 1998/03/13 00:44:19 brian Exp $
|
||||
* $Id: pap.c,v 1.20.2.16 1998/03/13 21:07:14 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -56,6 +56,8 @@
|
||||
#include "link.h"
|
||||
#include "descriptor.h"
|
||||
#include "physical.h"
|
||||
#include "iplist.h"
|
||||
#include "ipcp.h"
|
||||
#include "bundle.h"
|
||||
#include "chat.h"
|
||||
#include "ccp.h"
|
||||
|
@ -16,7 +16,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: physical.c,v 1.1.2.14 1998/03/10 03:05:54 brian Exp $
|
||||
* $Id: physical.c,v 1.1.2.15 1998/03/13 00:44:20 brian Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -57,6 +57,8 @@
|
||||
#include "physical.h"
|
||||
|
||||
#include "vars.h"
|
||||
#include "iplist.h"
|
||||
#include "ipcp.h"
|
||||
#include "bundle.h"
|
||||
#include "log.h"
|
||||
#include "id.h"
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: prompt.c,v 1.1.2.10 1998/03/01 01:07:49 brian Exp $
|
||||
* $Id: prompt.c,v 1.1.2.11 1998/03/13 00:44:23 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -43,7 +43,6 @@
|
||||
#include "descriptor.h"
|
||||
#include "prompt.h"
|
||||
#include "fsm.h"
|
||||
#include "bundle.h"
|
||||
#include "lcp.h"
|
||||
#include "auth.h"
|
||||
#include "loadalias.h"
|
||||
@ -52,6 +51,7 @@
|
||||
#include "iplist.h"
|
||||
#include "throughput.h"
|
||||
#include "ipcp.h"
|
||||
#include "bundle.h"
|
||||
#include "lqr.h"
|
||||
#include "hdlc.h"
|
||||
#include "async.h"
|
||||
@ -279,7 +279,7 @@ prompt_Display(struct prompt *p, struct bundle *bundle)
|
||||
else
|
||||
pauth = " on ";
|
||||
|
||||
if (IpcpInfo.fsm.state == ST_OPENED)
|
||||
if (bundle->ncp.ipcp.fsm.state == ST_OPENED)
|
||||
pconnect = "PPP";
|
||||
else if (bundle_Phase(bundle) == PHASE_NETWORK)
|
||||
pconnect = "PPp";
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: route.c,v 1.42.2.8 1998/02/27 01:22:38 brian Exp $
|
||||
* $Id: route.c,v 1.42.2.9 1998/03/13 00:44:23 brian Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -55,8 +55,8 @@
|
||||
#include "hdlc.h"
|
||||
#include "link.h"
|
||||
#include "fsm.h"
|
||||
#include "bundle.h"
|
||||
#include "ipcp.h"
|
||||
#include "bundle.h"
|
||||
#include "route.h"
|
||||
#include "descriptor.h"
|
||||
#include "prompt.h"
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: tun.c,v 1.6.4.4 1998/03/02 17:25:30 brian Exp $
|
||||
* $Id: tun.c,v 1.6.4.5 1998/03/13 00:44:24 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -49,6 +49,9 @@
|
||||
#include "loadalias.h"
|
||||
#include "vars.h"
|
||||
#include "fsm.h"
|
||||
#include "throughput.h"
|
||||
#include "iplist.h"
|
||||
#include "ipcp.h"
|
||||
#include "bundle.h"
|
||||
#include "tun.h"
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: vjcomp.c,v 1.16.2.5 1998/02/23 00:38:43 brian Exp $
|
||||
* $Id: vjcomp.c,v 1.16.2.6 1998/03/13 00:44:26 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -63,14 +63,15 @@ SendPppFrame(struct link *l, struct mbuf * bp, struct bundle *bundle)
|
||||
{
|
||||
int type;
|
||||
u_short proto;
|
||||
u_short cproto = IpcpInfo.peer_compproto >> 16;
|
||||
u_short cproto = bundle->ncp.ipcp.peer_compproto >> 16;
|
||||
struct ccp *ccp = bundle2ccp(bundle, l->name);
|
||||
|
||||
LogPrintf(LogDEBUG, "SendPppFrame: proto = %x\n", IpcpInfo.peer_compproto);
|
||||
LogPrintf(LogDEBUG, "SendPppFrame: proto = %x\n",
|
||||
bundle->ncp.ipcp.peer_compproto);
|
||||
if (((struct ip *) MBUF_CTOP(bp))->ip_p == IPPROTO_TCP
|
||||
&& cproto == PROTO_VJCOMP) {
|
||||
type = sl_compress_tcp(bp, (struct ip *)MBUF_CTOP(bp), &cslc,
|
||||
IpcpInfo.peer_compproto & 0xff);
|
||||
bundle->ncp.ipcp.peer_compproto & 0xff);
|
||||
LogPrintf(LogDEBUG, "SendPppFrame: type = %x\n", type);
|
||||
switch (type) {
|
||||
case TYPE_IP:
|
||||
|
Loading…
Reference in New Issue
Block a user