Bring CCP and IPCP layers down properly when LCP
comes down. Give a count of bytes sent/received in IPCP log.
This commit is contained in:
parent
ef4ce80f95
commit
5b4c5b0055
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=29048
@ -17,20 +17,23 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: ipcp.c,v 1.26 1997/08/25 00:29:14 brian Exp $
|
||||
* $Id: ipcp.c,v 1.27 1997/08/31 22:59:29 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o More RFC1772 backwoard compatibility
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/socket.h>
|
||||
#include <limits.h>
|
||||
#include "fsm.h"
|
||||
#include "lcpproto.h"
|
||||
#include "lcp.h"
|
||||
#include "ipcp.h"
|
||||
#include <netdb.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/socket.h>
|
||||
#include "slcompress.h"
|
||||
#include "os.h"
|
||||
#include "phase.h"
|
||||
@ -64,6 +67,7 @@ static void IpcpInitRestartCounter(struct fsm *);
|
||||
struct pppTimer IpcpReportTimer;
|
||||
|
||||
static int lastInOctets, lastOutOctets;
|
||||
static int StartingIpIn, StartingIpOut;
|
||||
|
||||
#define REJECTED(p, x) (p->his_reject & (1<<x))
|
||||
|
||||
@ -136,7 +140,11 @@ ReportIpcpStatus()
|
||||
inet_ntoa(icp->his_ipaddr), icp->his_compproto);
|
||||
fprintf(VarTerm, " my side: %s, %lx\n",
|
||||
inet_ntoa(icp->want_ipaddr), icp->want_compproto);
|
||||
fprintf(VarTerm, "connected: %d secs, idle: %d secs\n\n", ipConnectSecs, ipIdleSecs);
|
||||
fprintf(VarTerm, "Connected: %d secs, idle: %d secs\n\n",
|
||||
ipConnectSecs, ipIdleSecs);
|
||||
fprintf(VarTerm, " %d octets in, %d octets out\n",
|
||||
IpcpOctetsIn(), IpcpOctetsOut());
|
||||
|
||||
fprintf(VarTerm, "Defaults:\n");
|
||||
fprintf(VarTerm, " My Address: %s/%d\n",
|
||||
inet_ntoa(DefMyAddress.ipaddr), DefMyAddress.width);
|
||||
@ -183,9 +191,9 @@ IpcpInit()
|
||||
}
|
||||
|
||||
/*
|
||||
* Some implementation of PPP are: Starting a negotiaion by require sending
|
||||
* *special* value as my address, even though standard of PPP is defined
|
||||
* full negotiation based. (e.g. "0.0.0.0" or Not "0.0.0.0")
|
||||
* Some implementations of PPP require that we send a
|
||||
* *special* value as our address, even though the rfc specifies
|
||||
* full negotiation (e.g. "0.0.0.0" or Not "0.0.0.0").
|
||||
*/
|
||||
if (HaveTriggerAddress) {
|
||||
icp->want_ipaddr.s_addr = TriggerAddress.s_addr;
|
||||
@ -197,6 +205,8 @@ IpcpInit()
|
||||
icp->want_compproto = 0;
|
||||
icp->heis1172 = 0;
|
||||
IpcpFsm.maxconfig = 10;
|
||||
StartingIpIn = ipInOctets;
|
||||
StartingIpOut = ipOutOctets;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -253,10 +263,28 @@ IpcpLayerFinish(struct fsm * fp)
|
||||
NewPhase(PHASE_TERMINATE);
|
||||
}
|
||||
|
||||
int
|
||||
IpcpOctetsIn()
|
||||
{
|
||||
return ipInOctets < StartingIpIn ?
|
||||
INT_MAX - StartingIpIn + ipInOctets - INT_MIN + 1 :
|
||||
ipInOctets - StartingIpIn;
|
||||
}
|
||||
|
||||
int
|
||||
IpcpOctetsOut()
|
||||
{
|
||||
return ipOutOctets < StartingIpOut ?
|
||||
INT_MAX - StartingIpOut + ipOutOctets - INT_MIN + 1 :
|
||||
ipOutOctets - StartingIpOut;
|
||||
}
|
||||
|
||||
static void
|
||||
IpcpLayerDown(struct fsm * fp)
|
||||
{
|
||||
LogPrintf(LogIPCP, "IpcpLayerDown.\n");
|
||||
LogPrintf(LogIPCP, "%d octets in, %d octets out\n",
|
||||
IpcpOctetsIn(), IpcpOctetsOut());
|
||||
StopTimer(&IpcpReportTimer);
|
||||
}
|
||||
|
||||
@ -282,6 +310,8 @@ IpcpLayerUp(struct fsm * fp)
|
||||
if (mode & MODE_ALIAS)
|
||||
VarPacketAliasSetAddress(IpcpInfo.want_ipaddr);
|
||||
OsLinkup();
|
||||
StartingIpIn = ipInOctets;
|
||||
StartingIpOut = ipOutOctets;
|
||||
IpcpStartReport();
|
||||
StartIdleTimer();
|
||||
}
|
||||
|
@ -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.8 1997/08/19 01:10:22 brian Exp $
|
||||
* $Id: ipcp.h,v 1.9 1997/08/25 00:29:15 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -76,5 +76,7 @@ extern struct in_addr nbns_entries[2];
|
||||
|
||||
extern void IpcpInit(void);
|
||||
extern void IpcpDefAddress(void);
|
||||
extern int IpcpOctetsIn(void);
|
||||
extern int IpcpOctetsOut(void);
|
||||
|
||||
#endif
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: lcp.c,v 1.28 1997/08/31 22:59:31 brian Exp $
|
||||
* $Id: lcp.c,v 1.29 1997/09/03 00:40:49 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o Validate magic number received from peer.
|
||||
@ -366,9 +366,9 @@ LcpLayerUp(struct fsm * fp)
|
||||
static void
|
||||
LcpLayerDown(struct fsm * fp)
|
||||
{
|
||||
LogPrintf(LogLCP, "LcpLayerDown\n");
|
||||
StopAllTimers();
|
||||
OsLinkdown();
|
||||
LogPrintf(LogLCP, "LcpLayerDown\n");
|
||||
NewPhase(PHASE_TERMINATE);
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: os.c,v 1.25 1997/08/31 22:59:44 brian Exp $
|
||||
* $Id: os.c,v 1.26 1997/09/03 00:40:50 brian Exp $
|
||||
*
|
||||
*/
|
||||
#include "fsm.h"
|
||||
@ -234,13 +234,16 @@ void
|
||||
OsLinkdown()
|
||||
{
|
||||
char *s;
|
||||
int Level;
|
||||
|
||||
if (linkup) {
|
||||
FsmDown(&CcpFsm); /* CCP must come down */
|
||||
|
||||
s = (char *) inet_ntoa(peer_addr);
|
||||
if (LogIsKept(LogLINK))
|
||||
LogPrintf(LogLINK, "OsLinkdown: %s\n", s);
|
||||
else
|
||||
LogPrintf(LogLCP, "OsLinkdown: %s\n", s);
|
||||
Level = LogIsKept(LogLINK) ? LogLINK : LogIPCP;
|
||||
LogPrintf(Level, "OsLinkdown: %s\n", s);
|
||||
|
||||
FsmDown(&IpcpFsm); /* IPCP must come down */
|
||||
|
||||
if (!(mode & MODE_AUTO))
|
||||
DeleteIfRoutes(0);
|
||||
|
Loading…
Reference in New Issue
Block a user