lcp.c (55146) | lcp.c (58034) |
---|---|
1/* 2 * PPP Link Control Protocol (LCP) Module 3 * 4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp) 5 * 6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. 7 * 8 * Redistribution and use in source and binary forms are permitted 9 * provided that the above copyright notice and this paragraph are 10 * duplicated in all such forms and that any documentation, 11 * advertising materials, and other materials related to such 12 * distribution and use acknowledge that the software was developed 13 * by the Internet Initiative Japan, Inc. The name of the 14 * IIJ may not be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 19 * | 1/* 2 * PPP Link Control Protocol (LCP) Module 3 * 4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp) 5 * 6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. 7 * 8 * Redistribution and use in source and binary forms are permitted 9 * provided that the above copyright notice and this paragraph are 10 * duplicated in all such forms and that any documentation, 11 * advertising materials, and other materials related to such 12 * distribution and use acknowledge that the software was developed 13 * by the Internet Initiative Japan, Inc. The name of the 14 * IIJ may not be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 19 * |
20 * $FreeBSD: head/usr.sbin/ppp/lcp.c 55146 1999-12-27 11:54:57Z brian $ | 20 * $FreeBSD: head/usr.sbin/ppp/lcp.c 58034 2000-03-14 01:46:54Z brian $ |
21 * 22 */ 23 24#include <sys/param.h> 25#include <netinet/in.h> 26#include <netinet/in_systm.h> 27#include <netinet/ip.h> 28#include <sys/un.h> --- 70 unchanged lines hidden (view full) --- 99 LcpDecodeConfig, 100 fsm_NullRecvResetReq, 101 fsm_NullRecvResetAck 102}; 103 104static const char * const lcp_TimerNames[] = 105 {"LCP restart", "LCP openmode", "LCP stopped"}; 106 | 21 * 22 */ 23 24#include <sys/param.h> 25#include <netinet/in.h> 26#include <netinet/in_systm.h> 27#include <netinet/ip.h> 28#include <sys/un.h> --- 70 unchanged lines hidden (view full) --- 99 LcpDecodeConfig, 100 fsm_NullRecvResetReq, 101 fsm_NullRecvResetAck 102}; 103 104static const char * const lcp_TimerNames[] = 105 {"LCP restart", "LCP openmode", "LCP stopped"}; 106 |
107static const char * const cftypes[] = { 108 /* Check out the latest ``Assigned numbers'' rfc (rfc1700.txt) */ 109 "???", 110 "MRU", /* 1: Maximum-Receive-Unit */ 111 "ACCMAP", /* 2: Async-Control-Character-Map */ 112 "AUTHPROTO", /* 3: Authentication-Protocol */ 113 "QUALPROTO", /* 4: Quality-Protocol */ 114 "MAGICNUM", /* 5: Magic-Number */ 115 "RESERVED", /* 6: RESERVED */ 116 "PROTOCOMP", /* 7: Protocol-Field-Compression */ 117 "ACFCOMP", /* 8: Address-and-Control-Field-Compression */ 118 "FCSALT", /* 9: FCS-Alternatives */ 119 "SDP", /* 10: Self-Describing-Pad */ 120 "NUMMODE", /* 11: Numbered-Mode */ 121 "MULTIPROC", /* 12: Multi-Link-Procedure */ 122 "CALLBACK", /* 13: Callback */ 123 "CONTIME", /* 14: Connect-Time */ 124 "COMPFRAME", /* 15: Compound-Frames */ 125 "NDE", /* 16: Nominal-Data-Encapsulation */ 126 "MRRU", /* 17: Multilink-MRRU */ 127 "SHORTSEQ", /* 18: Multilink-Short-Sequence-Number-Header */ 128 "ENDDISC", /* 19: Multilink-Endpoint-Discriminator */ 129 "PROPRIETRY", /* 20: Proprietary */ 130 "DCEID", /* 21: DCE-Identifier */ 131 "MULTIPP", /* 22: Multi-Link-Plus-Procedure */ 132 "LDBACP", /* 23: Link Discriminator for BACP */ 133}; | 107static const char * 108protoname(int proto) 109{ 110 static const char * const cftypes[] = { 111 /* Check out the latest ``Assigned numbers'' rfc (1700) */ 112 NULL, 113 "MRU", /* 1: Maximum-Receive-Unit */ 114 "ACCMAP", /* 2: Async-Control-Character-Map */ 115 "AUTHPROTO", /* 3: Authentication-Protocol */ 116 "QUALPROTO", /* 4: Quality-Protocol */ 117 "MAGICNUM", /* 5: Magic-Number */ 118 "RESERVED", /* 6: RESERVED */ 119 "PROTOCOMP", /* 7: Protocol-Field-Compression */ 120 "ACFCOMP", /* 8: Address-and-Control-Field-Compression */ 121 "FCSALT", /* 9: FCS-Alternatives */ 122 "SDP", /* 10: Self-Describing-Pad */ 123 "NUMMODE", /* 11: Numbered-Mode */ 124 "MULTIPROC", /* 12: Multi-Link-Procedure */ 125 "CALLBACK", /* 13: Callback */ 126 "CONTIME", /* 14: Connect-Time */ 127 "COMPFRAME", /* 15: Compound-Frames */ 128 "NDE", /* 16: Nominal-Data-Encapsulation */ 129 "MRRU", /* 17: Multilink-MRRU */ 130 "SHORTSEQ", /* 18: Multilink-Short-Sequence-Number-Header */ 131 "ENDDISC", /* 19: Multilink-Endpoint-Discriminator */ 132 "PROPRIETRY", /* 20: Proprietary */ 133 "DCEID", /* 21: DCE-Identifier */ 134 "MULTIPP", /* 22: Multi-Link-Plus-Procedure */ 135 "LDBACP", /* 23: Link Discriminator for BACP */ 136 }; |
134 | 137 |
135#define NCFTYPES (sizeof cftypes/sizeof cftypes[0]) | 138 if (proto < 0 || proto > sizeof cftypes / sizeof *cftypes || 139 cftypes[proto] == NULL) 140 return HexStr(proto, NULL, 0); |
136 | 141 |
142 return cftypes[proto]; 143} 144 |
|
137int 138lcp_ReportStatus(struct cmdargs const *arg) 139{ 140 struct link *l; 141 struct lcp *lcp; 142 143 l = command_ChooseLink(arg); 144 lcp = &l->lcp; --- 396 unchanged lines hidden (view full) --- 541 struct physical *p = link2physical(fp->link); 542 543 sz = op = callback_req = 0; 544 545 while (plen >= sizeof(struct fsmconfig)) { 546 type = *cp; 547 length = cp[1]; 548 | 145int 146lcp_ReportStatus(struct cmdargs const *arg) 147{ 148 struct link *l; 149 struct lcp *lcp; 150 151 l = command_ChooseLink(arg); 152 lcp = &l->lcp; --- 396 unchanged lines hidden (view full) --- 549 struct physical *p = link2physical(fp->link); 550 551 sz = op = callback_req = 0; 552 553 while (plen >= sizeof(struct fsmconfig)) { 554 type = *cp; 555 length = cp[1]; 556 |
549 if (type < 0 || type >= NCFTYPES) 550 snprintf(request, sizeof request, " <%d>[%d]", type, length); 551 else 552 snprintf(request, sizeof request, " %s[%d]", cftypes[type], length); | 557 snprintf(request, sizeof request, " %s[%d]", protoname(type), length); |
553 554 if (length < 2) { 555 log_Printf(LogLCP, "%s:%s: Bad LCP length\n", fp->link->name, request); 556 break; 557 } 558 559 switch (type) { 560 case TY_MRRU: --- 600 unchanged lines hidden --- | 558 559 if (length < 2) { 560 log_Printf(LogLCP, "%s:%s: Bad LCP length\n", fp->link->name, request); 561 break; 562 } 563 564 switch (type) { 565 case TY_MRRU: --- 600 unchanged lines hidden --- |