diff options
author | brian <brian@FreeBSD.org> | 1997-11-14 15:39:15 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1997-11-14 15:39:15 +0000 |
commit | 083732af9e482725012ded862a6d65349537087c (patch) | |
tree | e92db180b8fd0bd138fb9072d7903dedd43c0fc6 | |
parent | 27f25c18e3e4e765ece326700ffdd835ad63025f (diff) | |
download | FreeBSD-src-083732af9e482725012ded862a6d65349537087c.zip FreeBSD-src-083732af9e482725012ded862a6d65349537087c.tar.gz |
Update the cftypes arrays according to rfc1700.
Log IPCP reqests as IPCP.
-rw-r--r-- | usr.sbin/ppp/ccp.c | 25 | ||||
-rw-r--r-- | usr.sbin/ppp/ipcp.c | 35 | ||||
-rw-r--r-- | usr.sbin/ppp/lcp.c | 57 | ||||
-rw-r--r-- | usr.sbin/ppp/lcp.h | 11 |
4 files changed, 89 insertions, 39 deletions
diff --git a/usr.sbin/ppp/ccp.c b/usr.sbin/ppp/ccp.c index 1ce6583..4f76eae 100644 --- a/usr.sbin/ppp/ccp.c +++ b/usr.sbin/ppp/ccp.c @@ -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.17 1997/10/26 01:02:10 brian Exp $ + * $Id: ccp.c,v 1.18 1997/11/08 00:28:06 brian Exp $ * * TODO: * o Support other compression protocols @@ -80,14 +80,23 @@ struct fsm CcpFsm = { }; static char const *cftypes[] = { - /* 0 */ "OUI", "PRED1", "PRED2", "PUDDLE", - /* 4 */ "???", "???", "???", "???", - /* 8 */ "???", "???", "???", "???", - /* 12 */ "???", "???", "???", "???", - /* 16 */ "HWPPC", "STAC", "MSPPC", "GAND", - /* 20 */ "V42BIS", "BSD", + /* Check out the latest ``Compression Control Protocol'' rfc (rfc1962.txt) */ + "OUI", /* 0: OUI */ + "PRED1", /* 1: Predictor type 1 */ + "PRED2", /* 2: Predictor type 2 */ + "PUDDLE", /* 3: Puddle Jumber */ + "???", "???", "???", "???", "???", "???", + "???", "???", "???", "???", "???", "???", + "HWPPC", /* 16: Hewlett-Packard PPC */ + "STAC", /* 17: Stac Electronics LZS */ + "MSPPC", /* 18: Microsoft PPC */ + "GAND", /* 19: Gandalf FZA */ + "V42BIS", /* 20: V.42bis compression */ + "BSD", /* BSD LZW Compress */ }; +#define NCFTYPES (sizeof(cftypes)/sizeof(char *)) + int ReportCcpStatus() { @@ -223,7 +232,7 @@ CcpDecodeConfig(u_char *cp, int plen, int mode_type) break; type = *cp; length = cp[1]; - if (type <= TY_BSD) + if (type < NCFTYPES) snprintf(tbuff, sizeof(tbuff), " %s[%d] ", cftypes[type], length); else snprintf(tbuff, sizeof(tbuff), " "); diff --git a/usr.sbin/ppp/ipcp.c b/usr.sbin/ppp/ipcp.c index 43d60be..eaa5788 100644 --- a/usr.sbin/ppp/ipcp.c +++ b/usr.sbin/ppp/ipcp.c @@ -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.34 1997/11/08 00:28:07 brian Exp $ + * $Id: ipcp.c,v 1.35 1997/11/11 22:58:11 brian Exp $ * * TODO: * o More RFC1772 backwoard compatibility @@ -106,9 +106,26 @@ struct fsm IpcpFsm = { }; static char *cftypes[] = { - "???", "IPADDRS", "COMPPROTO", "IPADDR", + /* Check out the latest ``Assigned numbers'' rfc (rfc1700.txt) */ + "???", + "IPADDRS", /* 1: IP-Addresses */ /* deprecated */ + "COMPPROTO", /* 2: IP-Compression-Protocol */ + "IPADDR", /* 3: IP-Address */ }; +#define NCFTYPES (sizeof(cftypes)/sizeof(char *)) + +static char *cftypes128[] = { + /* Check out the latest ``Assigned numbers'' rfc (rfc1700.txt) */ + "???", + "PRIDNS", /* 129: Primary DNS Server Address */ + "PRINBNS", /* 130: Primary NBNS Server Address */ + "SECDNS", /* 131: Secondary DNS Server Address */ + "SECNBNS", /* 132: Secondary NBNS Server Address */ +}; + +#define NCFTYPES128 (sizeof(cftypes)/sizeof(char *)) + /* * Function called every second. Updates connection period and idle period, * also update LQR information. @@ -235,12 +252,14 @@ IpcpSendConfigReq(struct fsm * fp) cp = ReqBuff; LogPrintf(LogIPCP, "IpcpSendConfigReq\n"); if (!DEV_IS_SYNC || !REJECTED(icp, TY_IPADDR)) - PutConfValue(&cp, cftypes, TY_IPADDR, 6, ntohl(icp->want_ipaddr.s_addr)); + PutConfValue(LogIPCP, &cp, cftypes, TY_IPADDR, 6, + ntohl(icp->want_ipaddr.s_addr)); if (icp->want_compproto && !REJECTED(icp, TY_COMPPROTO)) { if (icp->heis1172) - PutConfValue(&cp, cftypes, TY_COMPPROTO, 4, icp->want_compproto >> 16); + PutConfValue(LogIPCP, &cp, cftypes, TY_COMPPROTO, 4, + icp->want_compproto >> 16); else - PutConfValue(&cp, cftypes, TY_COMPPROTO, 6, icp->want_compproto); + PutConfValue(LogIPCP, &cp, cftypes, TY_COMPPROTO, 6, icp->want_compproto); } FsmOutput(fp, CODE_CONFIGREQ, fp->reqid++, ReqBuff, cp - ReqBuff); } @@ -373,10 +392,12 @@ IpcpDecodeConfig(u_char * cp, int plen, int mode_type) while (plen >= sizeof(struct fsmconfig)) { type = *cp; length = cp[1]; - if (type <= TY_IPADDR) + if (type < NCFTYPES) snprintf(tbuff, sizeof(tbuff), " %s[%d] ", cftypes[type], length); + else if (type > 128 && type < 128 + NCFTYPES128) + snprintf(tbuff, sizeof(tbuff), " %s[%d] ", cftypes128[type], length); else - snprintf(tbuff, sizeof(tbuff), " "); + snprintf(tbuff, sizeof(tbuff), " ??? "); switch (type) { case TY_IPADDR: /* RFC1332 */ diff --git a/usr.sbin/ppp/lcp.c b/usr.sbin/ppp/lcp.c index b81fa13..33646c7 100644 --- a/usr.sbin/ppp/lcp.c +++ b/usr.sbin/ppp/lcp.c @@ -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.43 1997/11/08 00:28:07 brian Exp $ + * $Id: lcp.c,v 1.44 1997/11/11 13:08:12 brian Exp $ * * TODO: * o Validate magic number received from peer. @@ -74,10 +74,35 @@ static void LcpLayerFinish(struct fsm *); #define REJECTED(p, x) (p->his_reject & (1<<x)) static char *cftypes[] = { - "???", "MRU", "ACCMAP", "AUTHPROTO", "QUALPROTO", "MAGICNUM", - "RESERVED", "PROTOCOMP", "ACFCOMP", "FCSALT", "SDP", + /* Check out the latest ``Assigned numbers'' rfc (rfc1700.txt) */ + "???", + "MRU", /* 1: Maximum-Receive-Unit */ + "ACCMAP", /* 2: Async-Control-Character-Map */ + "AUTHPROTO", /* 3: Authentication-Protocol */ + "QUALPROTO", /* 4: Quality-Protocol */ + "MAGICNUM", /* 5: Magic-Number */ + "RESERVED", /* 6: RESERVED */ + "PROTOCOMP", /* 7: Protocol-Field-Compression */ + "ACFCOMP", /* 8: Address-and-Control-Field-Compression */ + "FCSALT", /* 9: FCS-Alternatives */ + "SDP", /* 10: Self-Describing-Pad */ + "NUMMODE", /* 11: Numbered-Mode */ + "MULTIPROC", /* 12: Multi-Link-Procedure */ + "CALLBACK", /* 13: Callback */ + "CONTIME", /* 14: Connect-Time */ + "COMPFRAME", /* 15: Compound-Frames */ + "NDE", /* 16: Nominal-Data-Encapsulation */ + "MULTIMRRU", /* 17: Multilink-MRRU */ + "MULTISSNH", /* 18: Multilink-Short-Sequence-Number-Header */ + "MULTIED", /* 19: Multilink-Endpoint-Descriminator */ + "PROPRIETRY", /* 20: Proprietary */ + "DCEID", /* 21: DCE-Identifier */ + "MULTIPP", /* 22: Multi-Link-Plus-Procedure */ + "LDBACP", /* 23: Link Discriminator for BACP */ }; +#define NCFTYPES (sizeof(cftypes)/sizeof(char *)) + struct fsm LcpFsm = { "LCP", /* Name of protocol */ PROTO_LCP, /* Protocol Number */ @@ -190,7 +215,8 @@ LcpInitRestartCounter(struct fsm * fp) } void -PutConfValue(u_char ** cpp, char **types, u_char type, int len, u_long val) +PutConfValue(int level, u_char ** cpp, char **types, u_char type, int len, + u_long val) { u_char *cp; struct in_addr ina; @@ -201,15 +227,14 @@ PutConfValue(u_char ** cpp, char **types, u_char type, int len, u_long val) if (len == 6) { if (type == TY_IPADDR) { ina.s_addr = htonl(val); - LogPrintf(LogLCP, " %s [%d] %s\n", + LogPrintf(level, " %s [%d] %s\n", types[type], len, inet_ntoa(ina)); - } else { - LogPrintf(LogLCP, " %s [%d] %08x\n", types[type], len, val); - } + } else + LogPrintf(level, " %s [%d] %08x\n", types[type], len, val); *cp++ = (val >> 24) & 0377; *cp++ = (val >> 16) & 0377; } else - LogPrintf(LogLCP, " %s [%d] %d\n", types[type], len, val); + LogPrintf(level, " %s [%d] %d\n", types[type], len, val); *cp++ = (val >> 8) & 0377; *cp++ = val & 0377; *cpp = cp; @@ -236,12 +261,12 @@ LcpSendConfigReq(struct fsm * fp) LogPrintf(LogLCP, " %s\n", cftypes[TY_PROTOCOMP]); } if (!REJECTED(lcp, TY_ACCMAP)) - PutConfValue(&cp, cftypes, TY_ACCMAP, 6, lcp->want_accmap); + PutConfValue(LogLCP, &cp, cftypes, TY_ACCMAP, 6, lcp->want_accmap); } if (!REJECTED(lcp, TY_MRU)) - PutConfValue(&cp, cftypes, TY_MRU, 4, lcp->want_mru); + PutConfValue(LogLCP, &cp, cftypes, TY_MRU, 4, lcp->want_mru); if (lcp->want_magic && !REJECTED(lcp, TY_MAGICNUM)) - PutConfValue(&cp, cftypes, TY_MAGICNUM, 6, lcp->want_magic); + PutConfValue(LogLCP, &cp, cftypes, TY_MAGICNUM, 6, lcp->want_magic); if (lcp->want_lqrperiod && !REJECTED(lcp, TY_QUALPROTO)) { req = (struct lqrreq *) cp; req->type = TY_QUALPROTO; @@ -253,10 +278,10 @@ LcpSendConfigReq(struct fsm * fp) } switch (lcp->want_auth) { case PROTO_PAP: - PutConfValue(&cp, cftypes, TY_AUTHPROTO, 4, lcp->want_auth); + PutConfValue(LogLCP, &cp, cftypes, TY_AUTHPROTO, 4, lcp->want_auth); break; case PROTO_CHAP: - PutConfValue(&cp, cftypes, TY_AUTHPROTO, 5, lcp->want_auth); + PutConfValue(LogLCP, &cp, cftypes, TY_AUTHPROTO, 5, lcp->want_auth); #ifdef HAVE_DES *cp++ = VarMSChap ? 0x80 : 0x05; /* Use MSChap vs. RFC 1994 (MD5) */ #else @@ -402,7 +427,7 @@ LcpDecodeConfig(u_char * cp, int plen, int mode_type) while (plen >= sizeof(struct fsmconfig)) { type = *cp; length = cp[1]; - if (type <= TY_ACFCOMP) + if (type < NCFTYPES) request = cftypes[type]; else request = "???"; @@ -657,7 +682,7 @@ LcpDecodeConfig(u_char * cp, int plen, int mode_type) } break; default: - LogPrintf(LogLCP, " ???[%02x]\n", type); + LogPrintf(LogLCP, " %s[02x]\n", request, type); if (mode_type == MODE_REQ) { reqreject: memcpy(rejp, cp, length); diff --git a/usr.sbin/ppp/lcp.h b/usr.sbin/ppp/lcp.h index 5b2803f..e3b67b2 100644 --- a/usr.sbin/ppp/lcp.h +++ b/usr.sbin/ppp/lcp.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: lcp.h,v 1.10 1997/10/26 12:42:12 brian Exp $ + * $Id: lcp.h,v 1.11 1997/11/08 00:28:08 brian Exp $ * * TODO: */ @@ -55,12 +55,7 @@ struct lcpstate { #define TY_PROTOCOMP 7 /* Protocol-Field-Compression */ #define TY_ACFCOMP 8 /* Address-and-Control-Field-Compression */ #define TY_FCSALT 9 /* FCS-Alternatives */ -#define TY_SDP 10 /* Self-Dscribing-Padding */ -#define TY_NUMMODE 11 /* Numbered-Mode */ -#define TY_XXXXXX 12 -#define TY_CALLBACK 13 /* Callback */ -#define TY_YYYYYY 14 -#define TY_COMPFRAME 15 /* Compound-Frames */ +#define TY_SDP 10 /* Self-Describing-Padding */ struct lqrreq { u_char type; @@ -78,6 +73,6 @@ extern void LcpSendProtoRej(u_char *, int); extern void LcpOpen(int); extern void LcpClose(void); extern void LcpDown(void); -extern void PutConfValue(u_char **, char **, u_char, int, u_long); +extern void PutConfValue(int, u_char **, char **, u_char, int, u_long); extern int ReportLcpStatus(void); extern void LcpInput(struct mbuf *); |