summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/ccp.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2000-03-14 01:46:54 +0000
committerbrian <brian@FreeBSD.org>2000-03-14 01:46:54 +0000
commitc905df5091647a7076a6c9da188e3098e8d9cd1c (patch)
treea9ddb1687fccd6cf0e8e107fd15255251a137904 /usr.sbin/ppp/ccp.c
parent3b65c00f328daf0fc8db68d8f715a571e8c6e184 (diff)
downloadFreeBSD-src-c905df5091647a7076a6c9da188e3098e8d9cd1c.zip
FreeBSD-src-c905df5091647a7076a6c9da188e3098e8d9cd1c.tar.gz
When ppp can't identify the relevant name, don't use "???", use
<nnn> or <0xxxx> instead.
Diffstat (limited to 'usr.sbin/ppp/ccp.c')
-rw-r--r--usr.sbin/ppp/ccp.c57
1 files changed, 27 insertions, 30 deletions
diff --git a/usr.sbin/ppp/ccp.c b/usr.sbin/ppp/ccp.c
index ce45a09..8ea9775 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 :-( */
OpenPOWER on IntegriCloud