diff options
author | Brian Somers <brian@FreeBSD.org> | 2000-03-14 01:46:54 +0000 |
---|---|---|
committer | Brian Somers <brian@FreeBSD.org> | 2000-03-14 01:46:54 +0000 |
commit | d6d3eeab46e7906545356c7571e46f0c61a5a397 (patch) | |
tree | e8b3f1a1139b61733094f2c0f949021e578dc9ad /usr.sbin/ppp/ccp.c | |
parent | 52c9ca1968734557de56a0f30dd275665059a961 (diff) | |
download | src-test2-d6d3eeab46e7906545356c7571e46f0c61a5a397.tar.gz src-test2-d6d3eeab46e7906545356c7571e46f0c61a5a397.zip |
Notes
Diffstat (limited to 'usr.sbin/ppp/ccp.c')
-rw-r--r-- | usr.sbin/ppp/ccp.c | 57 |
1 files changed, 27 insertions, 30 deletions
diff --git a/usr.sbin/ppp/ccp.c b/usr.sbin/ppp/ccp.c index ce45a09ba896..8ea977521eaf 100644 --- a/usr.sbin/ppp/ccp.c +++ b/usr.sbin/ppp/ccp.c @@ -93,35 +93,35 @@ static struct fsm_callbacks ccp_Callbacks = { static const char * const ccp_TimerNames[] = {"CCP restart", "CCP openmode", "CCP stopped"}; -static char const * const cftypes[] = { - /* 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 (rfc1974) */ - "MPPC", /* 18: Microsoft PPC (rfc2118) */ - "GAND", /* 19: Gandalf FZA (rfc1993) */ - "V42BIS", /* 20: ARG->DATA.42bis compression */ - "BSD", /* 21: BSD LZW Compress */ - "???", - "LZS-DCP", /* 23: LZS-DCP Compression Protocol (rfc1967) */ - "MAGNALINK/DEFLATE", /* 24: Magnalink Variable Resource (rfc1975) */ - /* 24: Deflate (according to pppd-2.3.*) */ - "DCE", /* 25: Data Circuit-Terminating Equip (rfc1976) */ - "DEFLATE", /* 26: Deflate (rfc1979) */ -}; - -#define NCFTYPES (sizeof cftypes/sizeof cftypes[0]) - static const char * protoname(int proto) { - if (proto < 0 || proto > NCFTYPES) - return "none"; + static char const * const cftypes[] = { + /* Check out the latest ``Compression Control Protocol'' rfc (1962) */ + "OUI", /* 0: OUI */ + "PRED1", /* 1: Predictor type 1 */ + "PRED2", /* 2: Predictor type 2 */ + "PUDDLE", /* 3: Puddle Jumber */ + NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, + "HWPPC", /* 16: Hewlett-Packard PPC */ + "STAC", /* 17: Stac Electronics LZS (rfc1974) */ + "MPPC", /* 18: Microsoft PPC (rfc2118) */ + "GAND", /* 19: Gandalf FZA (rfc1993) */ + "V42BIS", /* 20: ARG->DATA.42bis compression */ + "BSD", /* 21: BSD LZW Compress */ + NULL, + "LZS-DCP", /* 23: LZS-DCP Compression Protocol (rfc1967) */ + "MAGNALINK/DEFLATE",/* 24: Magnalink Variable Resource (rfc1975) */ + /* 24: Deflate (according to pppd-2.3.*) */ + "DCE", /* 25: Data Circuit-Terminating Equip (rfc1976) */ + "DEFLATE", /* 26: Deflate (rfc1979) */ + }; + + if (proto < 0 || proto > sizeof cftypes / sizeof *cftypes || + cftypes[proto] == NULL) + return HexStr(proto, NULL, 0); + return cftypes[proto]; } @@ -441,10 +441,7 @@ CcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type, if (end == NULL) end = ""; - if (type < NCFTYPES) - log_Printf(LogCCP, " %s[%d] %s\n", cftypes[type], length, end); - else - log_Printf(LogCCP, " ???[%d] %s\n", length, end); + log_Printf(LogCCP, " %s[%d] %s\n", protoname(type), length, end); if (f == -1) { /* Don't understand that :-( */ |