1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2001-2002 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 28*7c478bd9Sstevel@tonic-gate 29*7c478bd9Sstevel@tonic-gate #include <stdio.h> 30*7c478bd9Sstevel@tonic-gate #include <stdlib.h> 31*7c478bd9Sstevel@tonic-gate #include <string.h> 32*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 33*7c478bd9Sstevel@tonic-gate #include <sys/socket.h> 34*7c478bd9Sstevel@tonic-gate #include <sys/sysmacros.h> 35*7c478bd9Sstevel@tonic-gate #include <net/ppp_defs.h> 36*7c478bd9Sstevel@tonic-gate #include <net/ppp-comp.h> 37*7c478bd9Sstevel@tonic-gate #include <net/if.h> 38*7c478bd9Sstevel@tonic-gate #include <netinet/in.h> 39*7c478bd9Sstevel@tonic-gate #include <netinet/if_ether.h> 40*7c478bd9Sstevel@tonic-gate #include <arpa/inet.h> 41*7c478bd9Sstevel@tonic-gate #include "snoop.h" 42*7c478bd9Sstevel@tonic-gate #include "snoop_ppp.h" 43*7c478bd9Sstevel@tonic-gate 44*7c478bd9Sstevel@tonic-gate static int interpret_ppp_cp(int, uchar_t *, int, ppp_protoinfo_t *); 45*7c478bd9Sstevel@tonic-gate static int interpret_cp_options(uchar_t *, int, ppp_protoinfo_t *); 46*7c478bd9Sstevel@tonic-gate static int interpret_ppp_chap(int, uchar_t *, int, ppp_protoinfo_t *); 47*7c478bd9Sstevel@tonic-gate static int interpret_ppp_pap(int, uchar_t *, int, ppp_protoinfo_t *); 48*7c478bd9Sstevel@tonic-gate static int interpret_ppp_lqr(int, uchar_t *, int, ppp_protoinfo_t *); 49*7c478bd9Sstevel@tonic-gate static ppp_protoinfo_t *ppp_getprotoinfo(uint16_t); 50*7c478bd9Sstevel@tonic-gate static cp_optinfo_t *ppp_getoptinfo(cp_optinfo_t *, uint16_t); 51*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_vendor; 52*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_mru; 53*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_accm; 54*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_authproto; 55*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_qualproto; 56*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_magicnum; 57*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_fcs; 58*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_sdp; 59*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_nummode; 60*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_callback; 61*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_mrru; 62*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_epdisc; 63*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_dce; 64*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_linkdisc; 65*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_i18n; 66*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_ipaddresses; 67*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_ipcompproto; 68*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_ipaddress; 69*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_mobileipv4; 70*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_ifaceid; 71*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_ipv6compproto; 72*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_compoui; 73*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_bsdcomp; 74*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_staclzs; 75*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_mppc; 76*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_gandalf; 77*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_lzsdcp; 78*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_magnalink; 79*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_deflate; 80*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_encroui; 81*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_dese; 82*7c478bd9Sstevel@tonic-gate static optformat_func_t opt_format_muxpid; 83*7c478bd9Sstevel@tonic-gate 84*7c478bd9Sstevel@tonic-gate /* 85*7c478bd9Sstevel@tonic-gate * Many strings below are initialized with "Unknown". 86*7c478bd9Sstevel@tonic-gate */ 87*7c478bd9Sstevel@tonic-gate static char unknown_string[] = "Unknown"; 88*7c478bd9Sstevel@tonic-gate 89*7c478bd9Sstevel@tonic-gate /* 90*7c478bd9Sstevel@tonic-gate * Each known PPP protocol has an associated ppp_protoinfo_t in this array. 91*7c478bd9Sstevel@tonic-gate * Even if we can't decode the protocol (interpret_proto() == NULL), 92*7c478bd9Sstevel@tonic-gate * interpret_ppp() will at least print the protocol's name. There is no 93*7c478bd9Sstevel@tonic-gate * dependency on the ordering of the entries in this array. They have been 94*7c478bd9Sstevel@tonic-gate * ordered such that the most commonly used protocols are near the front. 95*7c478bd9Sstevel@tonic-gate * The array is delimited by a last entry of protocol of type 96*7c478bd9Sstevel@tonic-gate * PPP_PROTO_UNKNOWN. 97*7c478bd9Sstevel@tonic-gate */ 98*7c478bd9Sstevel@tonic-gate static ppp_protoinfo_t protoinfo_array[] = { 99*7c478bd9Sstevel@tonic-gate { PPP_IP, "IP", interpret_ip, NULL, NULL }, 100*7c478bd9Sstevel@tonic-gate { PPP_IPV6, "IPv6", interpret_ipv6, NULL, NULL }, 101*7c478bd9Sstevel@tonic-gate { PPP_COMP, "Compressed Data", NULL, NULL, NULL }, 102*7c478bd9Sstevel@tonic-gate { PPP_OSI, "OSI", NULL, NULL, NULL }, 103*7c478bd9Sstevel@tonic-gate { PPP_AT, "AppleTalk", NULL, NULL, NULL }, 104*7c478bd9Sstevel@tonic-gate { PPP_IPX, "IPX", NULL, NULL, NULL }, 105*7c478bd9Sstevel@tonic-gate { PPP_VJC_COMP, "VJ Compressed TCP", NULL, NULL, NULL }, 106*7c478bd9Sstevel@tonic-gate { PPP_VJC_UNCOMP, "VJ Uncompressed TCP", NULL, NULL, NULL }, 107*7c478bd9Sstevel@tonic-gate { PPP_BRIDGE, "Bridging", NULL, NULL, NULL }, 108*7c478bd9Sstevel@tonic-gate { PPP_802HELLO, "802.1d Hello", NULL, NULL, NULL }, 109*7c478bd9Sstevel@tonic-gate { PPP_MP, "MP", NULL, NULL, NULL }, 110*7c478bd9Sstevel@tonic-gate { PPP_ENCRYPT, "Encryption", NULL, NULL, NULL }, 111*7c478bd9Sstevel@tonic-gate { PPP_ENCRYPTFRAG, "Individual Link Encryption", NULL, NULL, NULL }, 112*7c478bd9Sstevel@tonic-gate { PPP_MUX, "PPP Muxing", NULL, NULL, NULL }, 113*7c478bd9Sstevel@tonic-gate { PPP_COMPFRAG, "Single Link Compressed Data", NULL, NULL, NULL }, 114*7c478bd9Sstevel@tonic-gate { PPP_FULLHDR, "IP Compression", NULL, NULL, NULL }, 115*7c478bd9Sstevel@tonic-gate { PPP_COMPTCP, "IP Compression", NULL, NULL, NULL }, 116*7c478bd9Sstevel@tonic-gate { PPP_COMPNONTCP, "IP Compression", NULL, NULL, NULL }, 117*7c478bd9Sstevel@tonic-gate { PPP_COMPUDP8, "IP Compression", NULL, NULL, NULL }, 118*7c478bd9Sstevel@tonic-gate { PPP_COMPRTP8, "IP Compression", NULL, NULL, NULL }, 119*7c478bd9Sstevel@tonic-gate { PPP_COMPTCPND, "IP Compression", NULL, NULL, NULL }, 120*7c478bd9Sstevel@tonic-gate { PPP_COMPSTATE, "IP Compression", NULL, NULL, NULL }, 121*7c478bd9Sstevel@tonic-gate { PPP_COMPUDP16, "IP Compression", NULL, NULL, NULL }, 122*7c478bd9Sstevel@tonic-gate { PPP_COMPRTP16, "IP Compression", NULL, NULL, NULL }, 123*7c478bd9Sstevel@tonic-gate { PPP_MPLS, "MPLS", NULL, NULL, NULL }, 124*7c478bd9Sstevel@tonic-gate { PPP_MPLSMC, "MPLS M/C", NULL, NULL, NULL }, 125*7c478bd9Sstevel@tonic-gate { PPP_LQR, "LQR", interpret_ppp_lqr, "PPP-LQR: ", 126*7c478bd9Sstevel@tonic-gate "Link Quality Report" }, 127*7c478bd9Sstevel@tonic-gate { PPP_LCP, "LCP", interpret_ppp_cp, "PPP-LCP: ", 128*7c478bd9Sstevel@tonic-gate "Link Control Protocol" }, 129*7c478bd9Sstevel@tonic-gate { PPP_IPCP, "IPCP", interpret_ppp_cp, "PPP-IPCP: ", 130*7c478bd9Sstevel@tonic-gate "IP Control Protocol" }, 131*7c478bd9Sstevel@tonic-gate { PPP_IPV6CP, "IPV6CP", interpret_ppp_cp, "PPP-IPV6CP: ", 132*7c478bd9Sstevel@tonic-gate "IPv6 Control Protocol" }, 133*7c478bd9Sstevel@tonic-gate { PPP_CCP, "CCP", interpret_ppp_cp, "PPP-CCP: ", 134*7c478bd9Sstevel@tonic-gate "Compression Control Protocol" }, 135*7c478bd9Sstevel@tonic-gate { PPP_CCPFRAG, "CCP-Link", interpret_ppp_cp, "PPP-CCP-Link: ", 136*7c478bd9Sstevel@tonic-gate "Per-Link Compression Control Protocol" }, 137*7c478bd9Sstevel@tonic-gate { PPP_ECP, "ECP", interpret_ppp_cp, "PPP-ECP: ", 138*7c478bd9Sstevel@tonic-gate "Encryption Control Protocol" }, 139*7c478bd9Sstevel@tonic-gate { PPP_ECPFRAG, "ECP-Link", interpret_ppp_cp, "PPP-ECP-Link: ", 140*7c478bd9Sstevel@tonic-gate "Per-Link Encryption Control Protocol" }, 141*7c478bd9Sstevel@tonic-gate { PPP_MPLSCP, "MPLSCP", NULL, NULL, NULL }, 142*7c478bd9Sstevel@tonic-gate { PPP_OSINLCP, "OSINLCP", NULL, NULL, NULL }, 143*7c478bd9Sstevel@tonic-gate { PPP_ATCP, "ATCP", NULL, NULL, NULL }, 144*7c478bd9Sstevel@tonic-gate { PPP_IPXCP, "IPXCP", NULL, NULL, NULL }, 145*7c478bd9Sstevel@tonic-gate { PPP_BACP, "BACP", NULL, NULL, NULL }, 146*7c478bd9Sstevel@tonic-gate { PPP_BCP, "BCP", NULL, NULL, NULL }, 147*7c478bd9Sstevel@tonic-gate { PPP_CBCP, "CBCP", NULL, NULL, NULL }, 148*7c478bd9Sstevel@tonic-gate { PPP_BAP, "BAP", NULL, NULL, NULL }, 149*7c478bd9Sstevel@tonic-gate { PPP_CHAP, "CHAP", interpret_ppp_chap, "CHAP: ", 150*7c478bd9Sstevel@tonic-gate "Challenge Handshake Authentication Protocl" }, 151*7c478bd9Sstevel@tonic-gate { PPP_PAP, "PAP", interpret_ppp_pap, "PAP: ", 152*7c478bd9Sstevel@tonic-gate "Password Authentication Protocol" }, 153*7c478bd9Sstevel@tonic-gate { PPP_EAP, "EAP", NULL, NULL, NULL }, 154*7c478bd9Sstevel@tonic-gate { 0, unknown_string, NULL, NULL, NULL } 155*7c478bd9Sstevel@tonic-gate }; 156*7c478bd9Sstevel@tonic-gate 157*7c478bd9Sstevel@tonic-gate static cp_optinfo_t lcp_optinfo[] = { 158*7c478bd9Sstevel@tonic-gate { OPT_LCP_VENDOR, "Vendor-Specific", 6, 159*7c478bd9Sstevel@tonic-gate opt_format_vendor }, 160*7c478bd9Sstevel@tonic-gate { OPT_LCP_MRU, "Maximum-Receive-Unit", 4, 161*7c478bd9Sstevel@tonic-gate opt_format_mru }, 162*7c478bd9Sstevel@tonic-gate { OPT_LCP_ASYNCMAP, "Async-Control-Character-Map", 6, 163*7c478bd9Sstevel@tonic-gate opt_format_accm }, 164*7c478bd9Sstevel@tonic-gate { OPT_LCP_AUTHTYPE, "Authentication-Protocol", 4, 165*7c478bd9Sstevel@tonic-gate opt_format_authproto }, 166*7c478bd9Sstevel@tonic-gate { OPT_LCP_QUALITY, "Quality-Protocol", 4, 167*7c478bd9Sstevel@tonic-gate opt_format_qualproto }, 168*7c478bd9Sstevel@tonic-gate { OPT_LCP_MAGICNUMBER, "Magic-Number", 6, 169*7c478bd9Sstevel@tonic-gate opt_format_magicnum }, 170*7c478bd9Sstevel@tonic-gate { OPT_LCP_PCOMPRESSION, "Protocol-Field-Compression", 2, NULL }, 171*7c478bd9Sstevel@tonic-gate { OPT_LCP_ACCOMPRESSION, "Address-and-Control-Field-Compression", 2, 172*7c478bd9Sstevel@tonic-gate NULL }, 173*7c478bd9Sstevel@tonic-gate { OPT_LCP_FCSALTERN, "FCS-Alternative", 3, 174*7c478bd9Sstevel@tonic-gate opt_format_fcs }, 175*7c478bd9Sstevel@tonic-gate { OPT_LCP_SELFDESCPAD, "Self-Describing-Padding", 3, 176*7c478bd9Sstevel@tonic-gate opt_format_sdp }, 177*7c478bd9Sstevel@tonic-gate { OPT_LCP_NUMBERED, "Numbered-Mode", 3, 178*7c478bd9Sstevel@tonic-gate opt_format_nummode }, 179*7c478bd9Sstevel@tonic-gate { OPT_LCP_MULTILINKPROC, "Multi-Link-Procedure", 2, NULL }, 180*7c478bd9Sstevel@tonic-gate { OPT_LCP_CALLBACK, "Callback", 3, 181*7c478bd9Sstevel@tonic-gate opt_format_callback }, 182*7c478bd9Sstevel@tonic-gate { OPT_LCP_CONNECTTIME, "Connect-Time", 2, NULL }, 183*7c478bd9Sstevel@tonic-gate { OPT_LCP_COMPOUNDFRAMES, "Compound-Frames", 2, NULL }, 184*7c478bd9Sstevel@tonic-gate { OPT_LCP_DATAENCAP, "Nominal-Data-Encapsulation", 2, NULL }, 185*7c478bd9Sstevel@tonic-gate { OPT_LCP_MRRU, "Multilink-MRRU", 4, 186*7c478bd9Sstevel@tonic-gate opt_format_mrru }, 187*7c478bd9Sstevel@tonic-gate { OPT_LCP_SSNHF, "Multilink-Short-Sequence-Number-Header-Format", 188*7c478bd9Sstevel@tonic-gate 2, NULL }, 189*7c478bd9Sstevel@tonic-gate { OPT_LCP_EPDISC, "Multilink-Endpoint-Discriminator", 3, 190*7c478bd9Sstevel@tonic-gate opt_format_epdisc }, 191*7c478bd9Sstevel@tonic-gate { OPT_LCP_DCEIDENT, "DCE-Identifier", 3, 192*7c478bd9Sstevel@tonic-gate opt_format_dce }, 193*7c478bd9Sstevel@tonic-gate { OPT_LCP_MLPLUSPROC, "Multi-Link-Plus-Procedure", 2, NULL }, 194*7c478bd9Sstevel@tonic-gate { OPT_LCP_LINKDISC, "Link Discriminator for BACP", 4, 195*7c478bd9Sstevel@tonic-gate opt_format_linkdisc }, 196*7c478bd9Sstevel@tonic-gate { OPT_LCP_AUTH, "LCP-Authentication-Option", 2, NULL }, 197*7c478bd9Sstevel@tonic-gate { OPT_LCP_COBS, "COBS", 2, NULL }, 198*7c478bd9Sstevel@tonic-gate { OPT_LCP_PFXELISION, "Prefix elision", 2, NULL }, 199*7c478bd9Sstevel@tonic-gate { OPT_LCP_MPHDRFMT, "Multilink header format", 2, NULL }, 200*7c478bd9Sstevel@tonic-gate { OPT_LCP_I18N, "Internationalization", 6, 201*7c478bd9Sstevel@tonic-gate opt_format_i18n }, 202*7c478bd9Sstevel@tonic-gate { OPT_LCP_SDL, "Simple Data Link on SONET/SDH", 2, NULL }, 203*7c478bd9Sstevel@tonic-gate { OPT_LCP_MUXING, "Old PPP Multiplexing", 2, NULL }, 204*7c478bd9Sstevel@tonic-gate { 0, unknown_string, 0, NULL } 205*7c478bd9Sstevel@tonic-gate }; 206*7c478bd9Sstevel@tonic-gate 207*7c478bd9Sstevel@tonic-gate static cp_optinfo_t ipcp_optinfo[] = { 208*7c478bd9Sstevel@tonic-gate { OPT_IPCP_ADDRS, "IP-Addresses", 10, 209*7c478bd9Sstevel@tonic-gate opt_format_ipaddresses }, 210*7c478bd9Sstevel@tonic-gate { OPT_IPCP_COMPRESSTYPE, "IP-Compression-Protocol", 4, 211*7c478bd9Sstevel@tonic-gate opt_format_ipcompproto }, 212*7c478bd9Sstevel@tonic-gate { OPT_IPCP_ADDR, "IP-Address", 6, 213*7c478bd9Sstevel@tonic-gate opt_format_ipaddress }, 214*7c478bd9Sstevel@tonic-gate { OPT_IPCP_MOBILEIPV4, "Mobile-IPv4", 6, 215*7c478bd9Sstevel@tonic-gate opt_format_mobileipv4 }, 216*7c478bd9Sstevel@tonic-gate { OPT_IPCP_DNS1, "Primary DNS Address", 6, 217*7c478bd9Sstevel@tonic-gate opt_format_ipaddress }, 218*7c478bd9Sstevel@tonic-gate { OPT_IPCP_NBNS1, "Primary NBNS Address", 6, 219*7c478bd9Sstevel@tonic-gate opt_format_ipaddress }, 220*7c478bd9Sstevel@tonic-gate { OPT_IPCP_DNS2, "Secondary DNS Address", 6, 221*7c478bd9Sstevel@tonic-gate opt_format_ipaddress }, 222*7c478bd9Sstevel@tonic-gate { OPT_IPCP_NBNS2, "Secondary NBNS Address", 6, 223*7c478bd9Sstevel@tonic-gate opt_format_ipaddress }, 224*7c478bd9Sstevel@tonic-gate { OPT_IPCP_SUBNET, "IP-Subnet", 6, 225*7c478bd9Sstevel@tonic-gate opt_format_ipaddress }, 226*7c478bd9Sstevel@tonic-gate { 0, unknown_string, 0, NULL } 227*7c478bd9Sstevel@tonic-gate }; 228*7c478bd9Sstevel@tonic-gate 229*7c478bd9Sstevel@tonic-gate static cp_optinfo_t ipv6cp_optinfo[] = { 230*7c478bd9Sstevel@tonic-gate { OPT_IPV6CP_IFACEID, "Interface-Identifier", 10, 231*7c478bd9Sstevel@tonic-gate opt_format_ifaceid }, 232*7c478bd9Sstevel@tonic-gate { OPT_IPV6CP_COMPRESSTYPE, "IPv6-Compression-Protocol", 4, 233*7c478bd9Sstevel@tonic-gate opt_format_ipv6compproto }, 234*7c478bd9Sstevel@tonic-gate { 0, unknown_string, 0, NULL } 235*7c478bd9Sstevel@tonic-gate }; 236*7c478bd9Sstevel@tonic-gate 237*7c478bd9Sstevel@tonic-gate static cp_optinfo_t ccp_optinfo[] = { 238*7c478bd9Sstevel@tonic-gate { OPT_CCP_PROPRIETARY, "Proprietary Compression OUI", 6, 239*7c478bd9Sstevel@tonic-gate opt_format_compoui }, 240*7c478bd9Sstevel@tonic-gate { OPT_CCP_PREDICTOR1, "Predictor type 1", 2, NULL }, 241*7c478bd9Sstevel@tonic-gate { OPT_CCP_PREDICTOR2, "Predictor type 2", 2, NULL }, 242*7c478bd9Sstevel@tonic-gate { OPT_CCP_PUDDLEJUMP, "Puddle Jumper", 2, NULL }, 243*7c478bd9Sstevel@tonic-gate { OPT_CCP_HPPPC, "Hewlett-Packard PPC", 2, NULL }, 244*7c478bd9Sstevel@tonic-gate { OPT_CCP_STACLZS, "Stac Electronics LZS", 5, 245*7c478bd9Sstevel@tonic-gate opt_format_staclzs }, 246*7c478bd9Sstevel@tonic-gate { OPT_CCP_MPPC, "Microsoft PPC", 6, 247*7c478bd9Sstevel@tonic-gate opt_format_mppc }, 248*7c478bd9Sstevel@tonic-gate { OPT_CCP_GANDALFFZA, "Gandalf FZA", 3, 249*7c478bd9Sstevel@tonic-gate opt_format_gandalf }, 250*7c478bd9Sstevel@tonic-gate { OPT_CCP_V42BIS, "V.42bis compression", 2, 251*7c478bd9Sstevel@tonic-gate NULL }, 252*7c478bd9Sstevel@tonic-gate { OPT_CCP_BSDCOMP, "BSD LZW Compress", 3, 253*7c478bd9Sstevel@tonic-gate opt_format_bsdcomp }, 254*7c478bd9Sstevel@tonic-gate { OPT_CCP_LZSDCP, "LZS-DCP", 6, 255*7c478bd9Sstevel@tonic-gate opt_format_lzsdcp }, 256*7c478bd9Sstevel@tonic-gate { OPT_CCP_MAGNALINK, "Magnalink", 4, 257*7c478bd9Sstevel@tonic-gate opt_format_magnalink }, 258*7c478bd9Sstevel@tonic-gate { OPT_CCP_DEFLATE, "Deflate", 4, 259*7c478bd9Sstevel@tonic-gate opt_format_deflate }, 260*7c478bd9Sstevel@tonic-gate { 0, unknown_string, 0, NULL } 261*7c478bd9Sstevel@tonic-gate }; 262*7c478bd9Sstevel@tonic-gate 263*7c478bd9Sstevel@tonic-gate static cp_optinfo_t ecp_optinfo[] = { 264*7c478bd9Sstevel@tonic-gate { OPT_ECP_PROPRIETARY, "Proprietary Encryption OUI", 6, 265*7c478bd9Sstevel@tonic-gate opt_format_encroui }, 266*7c478bd9Sstevel@tonic-gate { OPT_ECP_DESE, "DESE", 10, 267*7c478bd9Sstevel@tonic-gate opt_format_dese }, 268*7c478bd9Sstevel@tonic-gate { OPT_ECP_3DESE, "3DESE", 10, 269*7c478bd9Sstevel@tonic-gate opt_format_dese }, 270*7c478bd9Sstevel@tonic-gate { OPT_ECP_DESEBIS, "DESE-bis", 10, 271*7c478bd9Sstevel@tonic-gate opt_format_dese }, 272*7c478bd9Sstevel@tonic-gate { 0, unknown_string, 0, NULL } 273*7c478bd9Sstevel@tonic-gate }; 274*7c478bd9Sstevel@tonic-gate 275*7c478bd9Sstevel@tonic-gate static cp_optinfo_t muxcp_optinfo[] = { 276*7c478bd9Sstevel@tonic-gate { OPT_MUXCP_DEFAULTPID, "Default PID", 4, 277*7c478bd9Sstevel@tonic-gate opt_format_muxpid }, 278*7c478bd9Sstevel@tonic-gate { 0, unknown_string, 0, NULL } 279*7c478bd9Sstevel@tonic-gate }; 280*7c478bd9Sstevel@tonic-gate 281*7c478bd9Sstevel@tonic-gate static char *cp_codearray[] = { 282*7c478bd9Sstevel@tonic-gate "(Vendor Specific)", 283*7c478bd9Sstevel@tonic-gate "(Configure-Request)", 284*7c478bd9Sstevel@tonic-gate "(Configure-Ack)", 285*7c478bd9Sstevel@tonic-gate "(Configure-Nak)", 286*7c478bd9Sstevel@tonic-gate "(Configure-Reject)", 287*7c478bd9Sstevel@tonic-gate "(Terminate-Request)", 288*7c478bd9Sstevel@tonic-gate "(Terminate-Ack)", 289*7c478bd9Sstevel@tonic-gate "(Code-Reject)", 290*7c478bd9Sstevel@tonic-gate "(Protocol-Reject)", 291*7c478bd9Sstevel@tonic-gate "(Echo-Request)", 292*7c478bd9Sstevel@tonic-gate "(Echo-Reply)", 293*7c478bd9Sstevel@tonic-gate "(Discard-Request)", 294*7c478bd9Sstevel@tonic-gate "(Identification)", 295*7c478bd9Sstevel@tonic-gate "(Time-Remaining)", 296*7c478bd9Sstevel@tonic-gate "(Reset-Request)", 297*7c478bd9Sstevel@tonic-gate "(Reset-Ack)" 298*7c478bd9Sstevel@tonic-gate }; 299*7c478bd9Sstevel@tonic-gate #define MAX_CPCODE ((sizeof (cp_codearray) / sizeof (char *)) - 1) 300*7c478bd9Sstevel@tonic-gate 301*7c478bd9Sstevel@tonic-gate static char *pap_codearray[] = { 302*7c478bd9Sstevel@tonic-gate "(Unknown)", 303*7c478bd9Sstevel@tonic-gate "(Authenticate-Request)", 304*7c478bd9Sstevel@tonic-gate "(Authenticate-Ack)", 305*7c478bd9Sstevel@tonic-gate "(Authenticate-Nak)" 306*7c478bd9Sstevel@tonic-gate }; 307*7c478bd9Sstevel@tonic-gate #define MAX_PAPCODE ((sizeof (pap_codearray) / sizeof (char *)) - 1) 308*7c478bd9Sstevel@tonic-gate 309*7c478bd9Sstevel@tonic-gate static char *chap_codearray[] = { 310*7c478bd9Sstevel@tonic-gate "(Unknown)", 311*7c478bd9Sstevel@tonic-gate "(Challenge)", 312*7c478bd9Sstevel@tonic-gate "(Response)", 313*7c478bd9Sstevel@tonic-gate "(Success)", 314*7c478bd9Sstevel@tonic-gate "(Failure)" 315*7c478bd9Sstevel@tonic-gate }; 316*7c478bd9Sstevel@tonic-gate #define MAX_CHAPCODE ((sizeof (chap_codearray) / sizeof (char *)) - 1) 317*7c478bd9Sstevel@tonic-gate 318*7c478bd9Sstevel@tonic-gate 319*7c478bd9Sstevel@tonic-gate int 320*7c478bd9Sstevel@tonic-gate interpret_ppp(int flags, uchar_t *data, int len) 321*7c478bd9Sstevel@tonic-gate { 322*7c478bd9Sstevel@tonic-gate uint16_t protocol; 323*7c478bd9Sstevel@tonic-gate ppp_protoinfo_t *protoinfo; 324*7c478bd9Sstevel@tonic-gate uchar_t *payload = data; 325*7c478bd9Sstevel@tonic-gate 326*7c478bd9Sstevel@tonic-gate if (len < 2) 327*7c478bd9Sstevel@tonic-gate return (len); 328*7c478bd9Sstevel@tonic-gate 329*7c478bd9Sstevel@tonic-gate GETINT16(protocol, payload); 330*7c478bd9Sstevel@tonic-gate len -= sizeof (uint16_t); 331*7c478bd9Sstevel@tonic-gate 332*7c478bd9Sstevel@tonic-gate protoinfo = ppp_getprotoinfo(protocol); 333*7c478bd9Sstevel@tonic-gate 334*7c478bd9Sstevel@tonic-gate if (flags & F_SUM) { 335*7c478bd9Sstevel@tonic-gate (void) sprintf(get_sum_line(), 336*7c478bd9Sstevel@tonic-gate "PPP Protocol=0x%x (%s)", protocol, protoinfo->name); 337*7c478bd9Sstevel@tonic-gate } else { /* F_DTAIL */ 338*7c478bd9Sstevel@tonic-gate show_header("PPP: ", "Point-to-Point Protocol", len); 339*7c478bd9Sstevel@tonic-gate show_space(); 340*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Protocol = 0x%x (%s)", 341*7c478bd9Sstevel@tonic-gate protocol, protoinfo->name); 342*7c478bd9Sstevel@tonic-gate show_space(); 343*7c478bd9Sstevel@tonic-gate } 344*7c478bd9Sstevel@tonic-gate 345*7c478bd9Sstevel@tonic-gate if (protoinfo->interpret_proto != NULL) { 346*7c478bd9Sstevel@tonic-gate len = protoinfo->interpret_proto(flags, payload, len, 347*7c478bd9Sstevel@tonic-gate protoinfo); 348*7c478bd9Sstevel@tonic-gate } 349*7c478bd9Sstevel@tonic-gate 350*7c478bd9Sstevel@tonic-gate return (len); 351*7c478bd9Sstevel@tonic-gate } 352*7c478bd9Sstevel@tonic-gate 353*7c478bd9Sstevel@tonic-gate /* 354*7c478bd9Sstevel@tonic-gate * interpret_ppp_cp() - Interpret PPP control protocols. It is convenient 355*7c478bd9Sstevel@tonic-gate * to do some of the decoding of these protocols in a common function since 356*7c478bd9Sstevel@tonic-gate * they share packet formats. This function expects to receive data 357*7c478bd9Sstevel@tonic-gate * starting with the code field. 358*7c478bd9Sstevel@tonic-gate */ 359*7c478bd9Sstevel@tonic-gate static int 360*7c478bd9Sstevel@tonic-gate interpret_ppp_cp(int flags, uchar_t *data, int len, ppp_protoinfo_t *protoinfo) 361*7c478bd9Sstevel@tonic-gate { 362*7c478bd9Sstevel@tonic-gate uint8_t code; 363*7c478bd9Sstevel@tonic-gate uint8_t id; 364*7c478bd9Sstevel@tonic-gate char *codestr; 365*7c478bd9Sstevel@tonic-gate uint16_t length; 366*7c478bd9Sstevel@tonic-gate uchar_t *datap = data; 367*7c478bd9Sstevel@tonic-gate 368*7c478bd9Sstevel@tonic-gate if (len < sizeof (ppp_pkt_t)) 369*7c478bd9Sstevel@tonic-gate return (len); 370*7c478bd9Sstevel@tonic-gate 371*7c478bd9Sstevel@tonic-gate GETINT8(code, datap); 372*7c478bd9Sstevel@tonic-gate GETINT8(id, datap); 373*7c478bd9Sstevel@tonic-gate GETINT16(length, datap); 374*7c478bd9Sstevel@tonic-gate 375*7c478bd9Sstevel@tonic-gate len -= sizeof (ppp_pkt_t); 376*7c478bd9Sstevel@tonic-gate 377*7c478bd9Sstevel@tonic-gate if (code <= MAX_CPCODE) 378*7c478bd9Sstevel@tonic-gate codestr = cp_codearray[code]; 379*7c478bd9Sstevel@tonic-gate else 380*7c478bd9Sstevel@tonic-gate codestr = ""; 381*7c478bd9Sstevel@tonic-gate 382*7c478bd9Sstevel@tonic-gate if (flags & F_SUM) { 383*7c478bd9Sstevel@tonic-gate (void) sprintf(get_sum_line(), 384*7c478bd9Sstevel@tonic-gate "%s%s", protoinfo->prefix, codestr); 385*7c478bd9Sstevel@tonic-gate } else { /* (flags & F_DTAIL) */ 386*7c478bd9Sstevel@tonic-gate show_header(protoinfo->prefix, protoinfo->description, len); 387*7c478bd9Sstevel@tonic-gate show_space(); 388*7c478bd9Sstevel@tonic-gate 389*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Code = %d %s", code, codestr); 390*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Identifier = %d", id); 391*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Length = %d", length); 392*7c478bd9Sstevel@tonic-gate 393*7c478bd9Sstevel@tonic-gate show_space(); 394*7c478bd9Sstevel@tonic-gate 395*7c478bd9Sstevel@tonic-gate len = MIN(len, length - sizeof (ppp_pkt_t)); 396*7c478bd9Sstevel@tonic-gate if (len == 0) 397*7c478bd9Sstevel@tonic-gate return (len); 398*7c478bd9Sstevel@tonic-gate 399*7c478bd9Sstevel@tonic-gate switch (code) { 400*7c478bd9Sstevel@tonic-gate case CODE_VENDOR: { 401*7c478bd9Sstevel@tonic-gate uint32_t magicnum; 402*7c478bd9Sstevel@tonic-gate uint32_t oui; 403*7c478bd9Sstevel@tonic-gate char *ouistr; 404*7c478bd9Sstevel@tonic-gate uint8_t kind; 405*7c478bd9Sstevel@tonic-gate 406*7c478bd9Sstevel@tonic-gate if (len < sizeof (magicnum) + sizeof (oui)) 407*7c478bd9Sstevel@tonic-gate return (len); 408*7c478bd9Sstevel@tonic-gate 409*7c478bd9Sstevel@tonic-gate GETINT32(magicnum, datap); 410*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Magic-Number = 0x%08x", 411*7c478bd9Sstevel@tonic-gate magicnum); 412*7c478bd9Sstevel@tonic-gate 413*7c478bd9Sstevel@tonic-gate GETINT32(oui, datap); 414*7c478bd9Sstevel@tonic-gate kind = oui & 0x000000ff; 415*7c478bd9Sstevel@tonic-gate oui >>= 8; 416*7c478bd9Sstevel@tonic-gate 417*7c478bd9Sstevel@tonic-gate ouistr = ether_ouiname(oui); 418*7c478bd9Sstevel@tonic-gate if (ouistr == NULL) 419*7c478bd9Sstevel@tonic-gate ouistr = unknown_string; 420*7c478bd9Sstevel@tonic-gate 421*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "OUI = 0x%06x (%s)", 422*7c478bd9Sstevel@tonic-gate oui, ouistr); 423*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Kind = %d", kind); 424*7c478bd9Sstevel@tonic-gate show_space(); 425*7c478bd9Sstevel@tonic-gate break; 426*7c478bd9Sstevel@tonic-gate } 427*7c478bd9Sstevel@tonic-gate 428*7c478bd9Sstevel@tonic-gate case CODE_CONFREQ: 429*7c478bd9Sstevel@tonic-gate case CODE_CONFACK: 430*7c478bd9Sstevel@tonic-gate case CODE_CONFNAK: 431*7c478bd9Sstevel@tonic-gate case CODE_CONFREJ: 432*7c478bd9Sstevel@tonic-gate /* 433*7c478bd9Sstevel@tonic-gate * The above all contain protocol specific 434*7c478bd9Sstevel@tonic-gate * configuration options. Parse these options. 435*7c478bd9Sstevel@tonic-gate */ 436*7c478bd9Sstevel@tonic-gate interpret_cp_options(datap, len, protoinfo); 437*7c478bd9Sstevel@tonic-gate break; 438*7c478bd9Sstevel@tonic-gate 439*7c478bd9Sstevel@tonic-gate case CODE_TERMREQ: 440*7c478bd9Sstevel@tonic-gate case CODE_TERMACK: 441*7c478bd9Sstevel@tonic-gate /* 442*7c478bd9Sstevel@tonic-gate * The arbitrary data in these two packet types 443*7c478bd9Sstevel@tonic-gate * is almost always plain text. Print it as such. 444*7c478bd9Sstevel@tonic-gate */ 445*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Data = %.*s", 446*7c478bd9Sstevel@tonic-gate length - sizeof (ppp_pkt_t), datap); 447*7c478bd9Sstevel@tonic-gate show_space(); 448*7c478bd9Sstevel@tonic-gate break; 449*7c478bd9Sstevel@tonic-gate 450*7c478bd9Sstevel@tonic-gate case CODE_CODEREJ: 451*7c478bd9Sstevel@tonic-gate /* 452*7c478bd9Sstevel@tonic-gate * What follows is the rejected control protocol 453*7c478bd9Sstevel@tonic-gate * packet, starting with the code field. 454*7c478bd9Sstevel@tonic-gate * Conveniently, we can call interpret_ppp_cp() to 455*7c478bd9Sstevel@tonic-gate * decode this. 456*7c478bd9Sstevel@tonic-gate */ 457*7c478bd9Sstevel@tonic-gate prot_nest_prefix = protoinfo->prefix; 458*7c478bd9Sstevel@tonic-gate interpret_ppp_cp(flags, datap, len, protoinfo); 459*7c478bd9Sstevel@tonic-gate prot_nest_prefix = ""; 460*7c478bd9Sstevel@tonic-gate break; 461*7c478bd9Sstevel@tonic-gate 462*7c478bd9Sstevel@tonic-gate case CODE_PROTREJ: 463*7c478bd9Sstevel@tonic-gate /* 464*7c478bd9Sstevel@tonic-gate * We don't print the rejected-protocol field 465*7c478bd9Sstevel@tonic-gate * explicitely. Instead, we cheat and pretend that 466*7c478bd9Sstevel@tonic-gate * the rejected-protocol field is actually the 467*7c478bd9Sstevel@tonic-gate * protocol field in the included PPP packet. This 468*7c478bd9Sstevel@tonic-gate * way, we can invoke interpret_ppp() and have it 469*7c478bd9Sstevel@tonic-gate * treat the included packet normally. 470*7c478bd9Sstevel@tonic-gate */ 471*7c478bd9Sstevel@tonic-gate prot_nest_prefix = protoinfo->prefix; 472*7c478bd9Sstevel@tonic-gate interpret_ppp(flags, datap, len); 473*7c478bd9Sstevel@tonic-gate prot_nest_prefix = ""; 474*7c478bd9Sstevel@tonic-gate break; 475*7c478bd9Sstevel@tonic-gate 476*7c478bd9Sstevel@tonic-gate case CODE_ECHOREQ: 477*7c478bd9Sstevel@tonic-gate case CODE_ECHOREP: 478*7c478bd9Sstevel@tonic-gate case CODE_DISCREQ: 479*7c478bd9Sstevel@tonic-gate case CODE_IDENT: 480*7c478bd9Sstevel@tonic-gate case CODE_TIMEREMAIN: { 481*7c478bd9Sstevel@tonic-gate uint32_t magicnum; 482*7c478bd9Sstevel@tonic-gate char *message_label = "Identification = %.*s"; 483*7c478bd9Sstevel@tonic-gate 484*7c478bd9Sstevel@tonic-gate if (len < sizeof (uint32_t)) 485*7c478bd9Sstevel@tonic-gate break; 486*7c478bd9Sstevel@tonic-gate 487*7c478bd9Sstevel@tonic-gate GETINT32(magicnum, datap); 488*7c478bd9Sstevel@tonic-gate len -= sizeof (uint32_t); 489*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Magic-Number = 0x%08x", 490*7c478bd9Sstevel@tonic-gate magicnum); 491*7c478bd9Sstevel@tonic-gate /* 492*7c478bd9Sstevel@tonic-gate * Unless this is an identification or 493*7c478bd9Sstevel@tonic-gate * time-remaining packet, arbitrary data follows 494*7c478bd9Sstevel@tonic-gate * the magic number field. The user can take a 495*7c478bd9Sstevel@tonic-gate * look at the hex dump for enlightenment. 496*7c478bd9Sstevel@tonic-gate */ 497*7c478bd9Sstevel@tonic-gate if (code == CODE_TIMEREMAIN) { 498*7c478bd9Sstevel@tonic-gate uint32_t timeremaining; 499*7c478bd9Sstevel@tonic-gate 500*7c478bd9Sstevel@tonic-gate if (len < sizeof (uint32_t)) 501*7c478bd9Sstevel@tonic-gate break; 502*7c478bd9Sstevel@tonic-gate 503*7c478bd9Sstevel@tonic-gate message_label = "Message = %.*s"; 504*7c478bd9Sstevel@tonic-gate 505*7c478bd9Sstevel@tonic-gate GETINT32(timeremaining, datap); 506*7c478bd9Sstevel@tonic-gate len -= sizeof (uint32_t); 507*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), 508*7c478bd9Sstevel@tonic-gate "Seconds Remaining = %d", timeremaining); 509*7c478bd9Sstevel@tonic-gate } 510*7c478bd9Sstevel@tonic-gate 511*7c478bd9Sstevel@tonic-gate if (code == CODE_IDENT || code == CODE_TIMEREMAIN) { 512*7c478bd9Sstevel@tonic-gate if (len == 0) 513*7c478bd9Sstevel@tonic-gate break; 514*7c478bd9Sstevel@tonic-gate 515*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), message_label, 516*7c478bd9Sstevel@tonic-gate len, datap); 517*7c478bd9Sstevel@tonic-gate } 518*7c478bd9Sstevel@tonic-gate show_space(); 519*7c478bd9Sstevel@tonic-gate break; 520*7c478bd9Sstevel@tonic-gate } 521*7c478bd9Sstevel@tonic-gate 522*7c478bd9Sstevel@tonic-gate /* 523*7c478bd9Sstevel@tonic-gate * Reset-Request and Reset-Ack contain arbitrary data which 524*7c478bd9Sstevel@tonic-gate * the user can sift through using the -x option. 525*7c478bd9Sstevel@tonic-gate */ 526*7c478bd9Sstevel@tonic-gate case CODE_RESETREQ: 527*7c478bd9Sstevel@tonic-gate case CODE_RESETACK: 528*7c478bd9Sstevel@tonic-gate default: 529*7c478bd9Sstevel@tonic-gate break; 530*7c478bd9Sstevel@tonic-gate } 531*7c478bd9Sstevel@tonic-gate } 532*7c478bd9Sstevel@tonic-gate return (len); 533*7c478bd9Sstevel@tonic-gate } 534*7c478bd9Sstevel@tonic-gate 535*7c478bd9Sstevel@tonic-gate 536*7c478bd9Sstevel@tonic-gate /* 537*7c478bd9Sstevel@tonic-gate * interpret_cp_options() decodes control protocol configuration options. 538*7c478bd9Sstevel@tonic-gate * Since each control protocol has a different set of options whose type 539*7c478bd9Sstevel@tonic-gate * numbers overlap, the protoinfo parameter is used to get a handle on 540*7c478bd9Sstevel@tonic-gate * which option set to use for decoding. 541*7c478bd9Sstevel@tonic-gate */ 542*7c478bd9Sstevel@tonic-gate static int 543*7c478bd9Sstevel@tonic-gate interpret_cp_options(uchar_t *optptr, int len, ppp_protoinfo_t *protoinfo) 544*7c478bd9Sstevel@tonic-gate { 545*7c478bd9Sstevel@tonic-gate cp_optinfo_t *optinfo; 546*7c478bd9Sstevel@tonic-gate cp_optinfo_t *optinfo_ptr; 547*7c478bd9Sstevel@tonic-gate uint8_t optlen; 548*7c478bd9Sstevel@tonic-gate uint8_t opttype; 549*7c478bd9Sstevel@tonic-gate 550*7c478bd9Sstevel@tonic-gate switch (protoinfo->proto) { 551*7c478bd9Sstevel@tonic-gate case PPP_LCP: 552*7c478bd9Sstevel@tonic-gate optinfo = lcp_optinfo; 553*7c478bd9Sstevel@tonic-gate break; 554*7c478bd9Sstevel@tonic-gate case PPP_IPCP: 555*7c478bd9Sstevel@tonic-gate optinfo = ipcp_optinfo; 556*7c478bd9Sstevel@tonic-gate break; 557*7c478bd9Sstevel@tonic-gate case PPP_IPV6CP: 558*7c478bd9Sstevel@tonic-gate optinfo = ipv6cp_optinfo; 559*7c478bd9Sstevel@tonic-gate break; 560*7c478bd9Sstevel@tonic-gate case PPP_CCP: 561*7c478bd9Sstevel@tonic-gate optinfo = ccp_optinfo; 562*7c478bd9Sstevel@tonic-gate break; 563*7c478bd9Sstevel@tonic-gate case PPP_ECP: 564*7c478bd9Sstevel@tonic-gate optinfo = ecp_optinfo; 565*7c478bd9Sstevel@tonic-gate break; 566*7c478bd9Sstevel@tonic-gate case PPP_MUXCP: 567*7c478bd9Sstevel@tonic-gate optinfo = muxcp_optinfo; 568*7c478bd9Sstevel@tonic-gate break; 569*7c478bd9Sstevel@tonic-gate default: 570*7c478bd9Sstevel@tonic-gate return (len); 571*7c478bd9Sstevel@tonic-gate break; 572*7c478bd9Sstevel@tonic-gate } 573*7c478bd9Sstevel@tonic-gate 574*7c478bd9Sstevel@tonic-gate if (len >= 2) { 575*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "%s Configuration Options", 576*7c478bd9Sstevel@tonic-gate protoinfo->name); 577*7c478bd9Sstevel@tonic-gate show_space(); 578*7c478bd9Sstevel@tonic-gate } 579*7c478bd9Sstevel@tonic-gate 580*7c478bd9Sstevel@tonic-gate while (len >= 2) { 581*7c478bd9Sstevel@tonic-gate GETINT8(opttype, optptr); 582*7c478bd9Sstevel@tonic-gate GETINT8(optlen, optptr); 583*7c478bd9Sstevel@tonic-gate 584*7c478bd9Sstevel@tonic-gate optinfo_ptr = ppp_getoptinfo(optinfo, opttype); 585*7c478bd9Sstevel@tonic-gate 586*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Option Type = %d (%s)", opttype, 587*7c478bd9Sstevel@tonic-gate optinfo_ptr->opt_name); 588*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Option Length = %d", optlen); 589*7c478bd9Sstevel@tonic-gate 590*7c478bd9Sstevel@tonic-gate /* 591*7c478bd9Sstevel@tonic-gate * Don't continue if there isn't enough data to 592*7c478bd9Sstevel@tonic-gate * contain this option, or if this type of option 593*7c478bd9Sstevel@tonic-gate * should contain more data than the length field 594*7c478bd9Sstevel@tonic-gate * claims there is. 595*7c478bd9Sstevel@tonic-gate */ 596*7c478bd9Sstevel@tonic-gate if (optlen > len || optlen < optinfo_ptr->opt_minsize) { 597*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), 598*7c478bd9Sstevel@tonic-gate "Warning: Incomplete Option"); 599*7c478bd9Sstevel@tonic-gate show_space(); 600*7c478bd9Sstevel@tonic-gate break; 601*7c478bd9Sstevel@tonic-gate } 602*7c478bd9Sstevel@tonic-gate 603*7c478bd9Sstevel@tonic-gate if (optinfo_ptr->opt_formatdata != NULL) { 604*7c478bd9Sstevel@tonic-gate optinfo_ptr->opt_formatdata(optptr, 605*7c478bd9Sstevel@tonic-gate MIN(optlen - 2, len - 2)); 606*7c478bd9Sstevel@tonic-gate } 607*7c478bd9Sstevel@tonic-gate 608*7c478bd9Sstevel@tonic-gate len -= optlen; 609*7c478bd9Sstevel@tonic-gate optptr += optlen - 2; 610*7c478bd9Sstevel@tonic-gate 611*7c478bd9Sstevel@tonic-gate show_space(); 612*7c478bd9Sstevel@tonic-gate } 613*7c478bd9Sstevel@tonic-gate 614*7c478bd9Sstevel@tonic-gate return (len); 615*7c478bd9Sstevel@tonic-gate } 616*7c478bd9Sstevel@tonic-gate 617*7c478bd9Sstevel@tonic-gate static int 618*7c478bd9Sstevel@tonic-gate interpret_ppp_chap(int flags, uchar_t *data, int len, 619*7c478bd9Sstevel@tonic-gate ppp_protoinfo_t *protoinfo) 620*7c478bd9Sstevel@tonic-gate { 621*7c478bd9Sstevel@tonic-gate uint8_t code; 622*7c478bd9Sstevel@tonic-gate uint8_t id; 623*7c478bd9Sstevel@tonic-gate char *codestr; 624*7c478bd9Sstevel@tonic-gate uint16_t length; 625*7c478bd9Sstevel@tonic-gate int lengthleft; 626*7c478bd9Sstevel@tonic-gate uchar_t *datap = data; 627*7c478bd9Sstevel@tonic-gate 628*7c478bd9Sstevel@tonic-gate 629*7c478bd9Sstevel@tonic-gate if (len < sizeof (ppp_pkt_t)) 630*7c478bd9Sstevel@tonic-gate return (len); 631*7c478bd9Sstevel@tonic-gate 632*7c478bd9Sstevel@tonic-gate GETINT8(code, datap); 633*7c478bd9Sstevel@tonic-gate GETINT8(id, datap); 634*7c478bd9Sstevel@tonic-gate GETINT8(length, datap); 635*7c478bd9Sstevel@tonic-gate 636*7c478bd9Sstevel@tonic-gate if (code <= MAX_CHAPCODE) 637*7c478bd9Sstevel@tonic-gate codestr = chap_codearray[code]; 638*7c478bd9Sstevel@tonic-gate else 639*7c478bd9Sstevel@tonic-gate codestr = ""; 640*7c478bd9Sstevel@tonic-gate 641*7c478bd9Sstevel@tonic-gate if (flags & F_SUM) { 642*7c478bd9Sstevel@tonic-gate (void) sprintf(get_sum_line(), 643*7c478bd9Sstevel@tonic-gate "%s%s", protoinfo->prefix, codestr); 644*7c478bd9Sstevel@tonic-gate } else { /* (flags & F_DTAIL) */ 645*7c478bd9Sstevel@tonic-gate show_header(protoinfo->prefix, protoinfo->description, len); 646*7c478bd9Sstevel@tonic-gate show_space(); 647*7c478bd9Sstevel@tonic-gate 648*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Code = %d %s", code, codestr); 649*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Identifier = %d", id); 650*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Length = %d", length); 651*7c478bd9Sstevel@tonic-gate 652*7c478bd9Sstevel@tonic-gate show_space(); 653*7c478bd9Sstevel@tonic-gate 654*7c478bd9Sstevel@tonic-gate if (len < length) 655*7c478bd9Sstevel@tonic-gate return (len); 656*7c478bd9Sstevel@tonic-gate 657*7c478bd9Sstevel@tonic-gate lengthleft = len - sizeof (ppp_pkt_t); 658*7c478bd9Sstevel@tonic-gate 659*7c478bd9Sstevel@tonic-gate switch (code) { 660*7c478bd9Sstevel@tonic-gate case CODE_CHALLENGE: 661*7c478bd9Sstevel@tonic-gate case CODE_RESPONSE: { 662*7c478bd9Sstevel@tonic-gate uint8_t value_size; 663*7c478bd9Sstevel@tonic-gate uint16_t peername_size; 664*7c478bd9Sstevel@tonic-gate 665*7c478bd9Sstevel@tonic-gate if (lengthleft < sizeof (value_size)) 666*7c478bd9Sstevel@tonic-gate break; 667*7c478bd9Sstevel@tonic-gate 668*7c478bd9Sstevel@tonic-gate GETINT8(value_size, datap); 669*7c478bd9Sstevel@tonic-gate lengthleft -= sizeof (value_size); 670*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Value-Size = %d", 671*7c478bd9Sstevel@tonic-gate value_size); 672*7c478bd9Sstevel@tonic-gate 673*7c478bd9Sstevel@tonic-gate if (lengthleft < sizeof (peername_size)) 674*7c478bd9Sstevel@tonic-gate break; 675*7c478bd9Sstevel@tonic-gate peername_size = MIN(length - sizeof (ppp_pkt_t) - 676*7c478bd9Sstevel@tonic-gate value_size, lengthleft); 677*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Name = %.*s", 678*7c478bd9Sstevel@tonic-gate peername_size, datap + value_size); 679*7c478bd9Sstevel@tonic-gate 680*7c478bd9Sstevel@tonic-gate break; 681*7c478bd9Sstevel@tonic-gate } 682*7c478bd9Sstevel@tonic-gate case CODE_SUCCESS: 683*7c478bd9Sstevel@tonic-gate case CODE_FAILURE: { 684*7c478bd9Sstevel@tonic-gate uint16_t message_size = MIN(length - sizeof (ppp_pkt_t), 685*7c478bd9Sstevel@tonic-gate lengthleft); 686*7c478bd9Sstevel@tonic-gate 687*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Message = %.*s", 688*7c478bd9Sstevel@tonic-gate message_size, datap); 689*7c478bd9Sstevel@tonic-gate break; 690*7c478bd9Sstevel@tonic-gate } 691*7c478bd9Sstevel@tonic-gate default: 692*7c478bd9Sstevel@tonic-gate break; 693*7c478bd9Sstevel@tonic-gate } 694*7c478bd9Sstevel@tonic-gate } 695*7c478bd9Sstevel@tonic-gate 696*7c478bd9Sstevel@tonic-gate show_space(); 697*7c478bd9Sstevel@tonic-gate len -= length; 698*7c478bd9Sstevel@tonic-gate return (len); 699*7c478bd9Sstevel@tonic-gate } 700*7c478bd9Sstevel@tonic-gate 701*7c478bd9Sstevel@tonic-gate static int 702*7c478bd9Sstevel@tonic-gate interpret_ppp_pap(int flags, uchar_t *data, int len, 703*7c478bd9Sstevel@tonic-gate ppp_protoinfo_t *protoinfo) 704*7c478bd9Sstevel@tonic-gate { 705*7c478bd9Sstevel@tonic-gate uint8_t code; 706*7c478bd9Sstevel@tonic-gate uint8_t id; 707*7c478bd9Sstevel@tonic-gate char *codestr; 708*7c478bd9Sstevel@tonic-gate uint16_t length; 709*7c478bd9Sstevel@tonic-gate int lengthleft; 710*7c478bd9Sstevel@tonic-gate uchar_t *datap = data; 711*7c478bd9Sstevel@tonic-gate 712*7c478bd9Sstevel@tonic-gate if (len < sizeof (ppp_pkt_t)) 713*7c478bd9Sstevel@tonic-gate return (len); 714*7c478bd9Sstevel@tonic-gate 715*7c478bd9Sstevel@tonic-gate GETINT8(code, datap); 716*7c478bd9Sstevel@tonic-gate GETINT8(id, datap); 717*7c478bd9Sstevel@tonic-gate GETINT16(length, datap); 718*7c478bd9Sstevel@tonic-gate 719*7c478bd9Sstevel@tonic-gate lengthleft = len - sizeof (ppp_pkt_t); 720*7c478bd9Sstevel@tonic-gate 721*7c478bd9Sstevel@tonic-gate if (code <= MAX_PAPCODE) 722*7c478bd9Sstevel@tonic-gate codestr = pap_codearray[code]; 723*7c478bd9Sstevel@tonic-gate else 724*7c478bd9Sstevel@tonic-gate codestr = ""; 725*7c478bd9Sstevel@tonic-gate 726*7c478bd9Sstevel@tonic-gate if (flags & F_SUM) { 727*7c478bd9Sstevel@tonic-gate (void) sprintf(get_sum_line(), 728*7c478bd9Sstevel@tonic-gate "%s%s", protoinfo->prefix, codestr); 729*7c478bd9Sstevel@tonic-gate } else { /* (flags & F_DTAIL) */ 730*7c478bd9Sstevel@tonic-gate show_header(protoinfo->prefix, protoinfo->description, len); 731*7c478bd9Sstevel@tonic-gate show_space(); 732*7c478bd9Sstevel@tonic-gate 733*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Code = %d %s", code, codestr); 734*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Identifier = %d", id); 735*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Length = %d", length); 736*7c478bd9Sstevel@tonic-gate 737*7c478bd9Sstevel@tonic-gate show_space(); 738*7c478bd9Sstevel@tonic-gate 739*7c478bd9Sstevel@tonic-gate if (len < length) 740*7c478bd9Sstevel@tonic-gate return (len); 741*7c478bd9Sstevel@tonic-gate 742*7c478bd9Sstevel@tonic-gate switch (code) { 743*7c478bd9Sstevel@tonic-gate case CODE_AUTHREQ: { 744*7c478bd9Sstevel@tonic-gate uint8_t fieldlen; 745*7c478bd9Sstevel@tonic-gate 746*7c478bd9Sstevel@tonic-gate if (lengthleft < sizeof (fieldlen)) 747*7c478bd9Sstevel@tonic-gate break; 748*7c478bd9Sstevel@tonic-gate GETINT8(fieldlen, datap); 749*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Peer-Id Length = %d", 750*7c478bd9Sstevel@tonic-gate fieldlen); 751*7c478bd9Sstevel@tonic-gate lengthleft -= sizeof (fieldlen); 752*7c478bd9Sstevel@tonic-gate 753*7c478bd9Sstevel@tonic-gate if (lengthleft < fieldlen) 754*7c478bd9Sstevel@tonic-gate break; 755*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Peer-Id = %.*s", 756*7c478bd9Sstevel@tonic-gate fieldlen, datap); 757*7c478bd9Sstevel@tonic-gate lengthleft -= fieldlen; 758*7c478bd9Sstevel@tonic-gate 759*7c478bd9Sstevel@tonic-gate datap += fieldlen; 760*7c478bd9Sstevel@tonic-gate 761*7c478bd9Sstevel@tonic-gate if (lengthleft < sizeof (fieldlen)) 762*7c478bd9Sstevel@tonic-gate break; 763*7c478bd9Sstevel@tonic-gate GETINT8(fieldlen, datap); 764*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Password Length = %d", 765*7c478bd9Sstevel@tonic-gate fieldlen); 766*7c478bd9Sstevel@tonic-gate lengthleft -= sizeof (fieldlen); 767*7c478bd9Sstevel@tonic-gate 768*7c478bd9Sstevel@tonic-gate if (lengthleft < fieldlen) 769*7c478bd9Sstevel@tonic-gate break; 770*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Password = %.*s", 771*7c478bd9Sstevel@tonic-gate fieldlen, datap); 772*7c478bd9Sstevel@tonic-gate 773*7c478bd9Sstevel@tonic-gate break; 774*7c478bd9Sstevel@tonic-gate } 775*7c478bd9Sstevel@tonic-gate case CODE_AUTHACK: 776*7c478bd9Sstevel@tonic-gate case CODE_AUTHNAK: { 777*7c478bd9Sstevel@tonic-gate uint8_t msglen; 778*7c478bd9Sstevel@tonic-gate 779*7c478bd9Sstevel@tonic-gate if (lengthleft < sizeof (msglen)) 780*7c478bd9Sstevel@tonic-gate break; 781*7c478bd9Sstevel@tonic-gate GETINT8(msglen, datap); 782*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Msg-Length = %d", 783*7c478bd9Sstevel@tonic-gate msglen); 784*7c478bd9Sstevel@tonic-gate lengthleft -= sizeof (msglen); 785*7c478bd9Sstevel@tonic-gate 786*7c478bd9Sstevel@tonic-gate if (lengthleft < msglen) 787*7c478bd9Sstevel@tonic-gate break; 788*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Message = %.*s", 789*7c478bd9Sstevel@tonic-gate msglen, datap); 790*7c478bd9Sstevel@tonic-gate 791*7c478bd9Sstevel@tonic-gate break; 792*7c478bd9Sstevel@tonic-gate } 793*7c478bd9Sstevel@tonic-gate default: 794*7c478bd9Sstevel@tonic-gate break; 795*7c478bd9Sstevel@tonic-gate } 796*7c478bd9Sstevel@tonic-gate } 797*7c478bd9Sstevel@tonic-gate 798*7c478bd9Sstevel@tonic-gate show_space(); 799*7c478bd9Sstevel@tonic-gate len -= length; 800*7c478bd9Sstevel@tonic-gate return (len); 801*7c478bd9Sstevel@tonic-gate } 802*7c478bd9Sstevel@tonic-gate 803*7c478bd9Sstevel@tonic-gate 804*7c478bd9Sstevel@tonic-gate static int 805*7c478bd9Sstevel@tonic-gate interpret_ppp_lqr(int flags, uchar_t *data, int len, 806*7c478bd9Sstevel@tonic-gate ppp_protoinfo_t *protoinfo) 807*7c478bd9Sstevel@tonic-gate { 808*7c478bd9Sstevel@tonic-gate lqr_pkt_t lqr_pkt; 809*7c478bd9Sstevel@tonic-gate if (len < sizeof (lqr_pkt_t)) 810*7c478bd9Sstevel@tonic-gate return (len); 811*7c478bd9Sstevel@tonic-gate 812*7c478bd9Sstevel@tonic-gate (void) memcpy(&lqr_pkt, data, sizeof (lqr_pkt_t)); 813*7c478bd9Sstevel@tonic-gate 814*7c478bd9Sstevel@tonic-gate if (flags & F_SUM) { 815*7c478bd9Sstevel@tonic-gate (void) sprintf(get_sum_line(), protoinfo->prefix); 816*7c478bd9Sstevel@tonic-gate } else { /* (flags & F_DTAIL) */ 817*7c478bd9Sstevel@tonic-gate show_header(protoinfo->prefix, protoinfo->description, len); 818*7c478bd9Sstevel@tonic-gate show_space(); 819*7c478bd9Sstevel@tonic-gate 820*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Magic-Number = 0x%08x", 821*7c478bd9Sstevel@tonic-gate ntohl(lqr_pkt.lqr_magic)); 822*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "LastOutLQRs = %d", 823*7c478bd9Sstevel@tonic-gate ntohl(lqr_pkt.lqr_lastoutlqrs)); 824*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "LastOutPackets = %d", 825*7c478bd9Sstevel@tonic-gate ntohl(lqr_pkt.lqr_lastoutpackets)); 826*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "LastOutOctets = %d", 827*7c478bd9Sstevel@tonic-gate ntohl(lqr_pkt.lqr_lastoutoctets)); 828*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "PeerInLQRs = %d", 829*7c478bd9Sstevel@tonic-gate ntohl(lqr_pkt.lqr_peerinlqrs)); 830*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "PeerInPackets = %d", 831*7c478bd9Sstevel@tonic-gate ntohl(lqr_pkt.lqr_peerinpackets)); 832*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "PeerInDiscards = %d", 833*7c478bd9Sstevel@tonic-gate ntohl(lqr_pkt.lqr_peerindiscards)); 834*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "PeerInErrors = %d", 835*7c478bd9Sstevel@tonic-gate ntohl(lqr_pkt.lqr_peerinerrors)); 836*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "PeerInOctets = %d", 837*7c478bd9Sstevel@tonic-gate ntohl(lqr_pkt.lqr_peerinoctets)); 838*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "PeerOutLQRs = %d", 839*7c478bd9Sstevel@tonic-gate ntohl(lqr_pkt.lqr_peeroutlqrs)); 840*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "PeerOutPackets = %d", 841*7c478bd9Sstevel@tonic-gate ntohl(lqr_pkt.lqr_peeroutpackets)); 842*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "PeerOutOctets = %d", 843*7c478bd9Sstevel@tonic-gate ntohl(lqr_pkt.lqr_peeroutoctets)); 844*7c478bd9Sstevel@tonic-gate 845*7c478bd9Sstevel@tonic-gate show_space(); 846*7c478bd9Sstevel@tonic-gate } 847*7c478bd9Sstevel@tonic-gate 848*7c478bd9Sstevel@tonic-gate len -= sizeof (lqr_pkt_t); 849*7c478bd9Sstevel@tonic-gate return (len); 850*7c478bd9Sstevel@tonic-gate } 851*7c478bd9Sstevel@tonic-gate 852*7c478bd9Sstevel@tonic-gate static ppp_protoinfo_t * 853*7c478bd9Sstevel@tonic-gate ppp_getprotoinfo(uint16_t proto) 854*7c478bd9Sstevel@tonic-gate { 855*7c478bd9Sstevel@tonic-gate ppp_protoinfo_t *protoinfo_ptr = &protoinfo_array[0]; 856*7c478bd9Sstevel@tonic-gate 857*7c478bd9Sstevel@tonic-gate while (protoinfo_ptr->proto != proto && protoinfo_ptr->proto != 0) { 858*7c478bd9Sstevel@tonic-gate protoinfo_ptr++; 859*7c478bd9Sstevel@tonic-gate } 860*7c478bd9Sstevel@tonic-gate 861*7c478bd9Sstevel@tonic-gate return (protoinfo_ptr); 862*7c478bd9Sstevel@tonic-gate } 863*7c478bd9Sstevel@tonic-gate 864*7c478bd9Sstevel@tonic-gate 865*7c478bd9Sstevel@tonic-gate static cp_optinfo_t * 866*7c478bd9Sstevel@tonic-gate ppp_getoptinfo(cp_optinfo_t optinfo_list[], uint16_t opt_type) 867*7c478bd9Sstevel@tonic-gate { 868*7c478bd9Sstevel@tonic-gate cp_optinfo_t *optinfo_ptr = &optinfo_list[0]; 869*7c478bd9Sstevel@tonic-gate 870*7c478bd9Sstevel@tonic-gate while (optinfo_ptr->opt_type != opt_type && 871*7c478bd9Sstevel@tonic-gate optinfo_ptr->opt_name != unknown_string) { 872*7c478bd9Sstevel@tonic-gate optinfo_ptr++; 873*7c478bd9Sstevel@tonic-gate } 874*7c478bd9Sstevel@tonic-gate 875*7c478bd9Sstevel@tonic-gate return (optinfo_ptr); 876*7c478bd9Sstevel@tonic-gate } 877*7c478bd9Sstevel@tonic-gate 878*7c478bd9Sstevel@tonic-gate 879*7c478bd9Sstevel@tonic-gate /* 880*7c478bd9Sstevel@tonic-gate * Below are the functions which parse control protocol configuration 881*7c478bd9Sstevel@tonic-gate * options. The first argument to these functions (optdata) points to the 882*7c478bd9Sstevel@tonic-gate * first byte of the option after the length field. The second argument 883*7c478bd9Sstevel@tonic-gate * (size) is the number of bytes in the option after the length field 884*7c478bd9Sstevel@tonic-gate * (length - 2). 885*7c478bd9Sstevel@tonic-gate */ 886*7c478bd9Sstevel@tonic-gate 887*7c478bd9Sstevel@tonic-gate /* 888*7c478bd9Sstevel@tonic-gate * The format of the Vendor-Specific option (rfc2153) is: 889*7c478bd9Sstevel@tonic-gate * 890*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 891*7c478bd9Sstevel@tonic-gate * | Type | Length | OUI 892*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 893*7c478bd9Sstevel@tonic-gate * ... | Kind | Value(s) ... 894*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- 895*7c478bd9Sstevel@tonic-gate */ 896*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 897*7c478bd9Sstevel@tonic-gate static void 898*7c478bd9Sstevel@tonic-gate opt_format_vendor(uchar_t *optdata, uint8_t size) 899*7c478bd9Sstevel@tonic-gate { 900*7c478bd9Sstevel@tonic-gate uint32_t oui; 901*7c478bd9Sstevel@tonic-gate char *ouistr; 902*7c478bd9Sstevel@tonic-gate uint8_t kind; 903*7c478bd9Sstevel@tonic-gate 904*7c478bd9Sstevel@tonic-gate GETINT32(oui, optdata); 905*7c478bd9Sstevel@tonic-gate kind = oui & 0x000000ff; 906*7c478bd9Sstevel@tonic-gate oui >>= 8; 907*7c478bd9Sstevel@tonic-gate 908*7c478bd9Sstevel@tonic-gate ouistr = ether_ouiname(oui); 909*7c478bd9Sstevel@tonic-gate if (ouistr == NULL) 910*7c478bd9Sstevel@tonic-gate ouistr = unknown_string; 911*7c478bd9Sstevel@tonic-gate 912*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "OUI = 0x%06x (%s)", oui, ouistr); 913*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Kind = %d", kind); 914*7c478bd9Sstevel@tonic-gate } 915*7c478bd9Sstevel@tonic-gate 916*7c478bd9Sstevel@tonic-gate /* 917*7c478bd9Sstevel@tonic-gate * The format of the MRU option (rfc1661) is: 918*7c478bd9Sstevel@tonic-gate * 919*7c478bd9Sstevel@tonic-gate * 0 1 2 3 920*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 921*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 922*7c478bd9Sstevel@tonic-gate * | Type | Length | Maximum-Receive-Unit | 923*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 924*7c478bd9Sstevel@tonic-gate */ 925*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 926*7c478bd9Sstevel@tonic-gate static void 927*7c478bd9Sstevel@tonic-gate opt_format_mru(uchar_t *optdata, uint8_t size) 928*7c478bd9Sstevel@tonic-gate { 929*7c478bd9Sstevel@tonic-gate uint16_t mru; 930*7c478bd9Sstevel@tonic-gate 931*7c478bd9Sstevel@tonic-gate GETINT16(mru, optdata); 932*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "MRU = %d", mru); 933*7c478bd9Sstevel@tonic-gate } 934*7c478bd9Sstevel@tonic-gate 935*7c478bd9Sstevel@tonic-gate /* 936*7c478bd9Sstevel@tonic-gate * The format of the accm option (rfc1662) is: 937*7c478bd9Sstevel@tonic-gate * 938*7c478bd9Sstevel@tonic-gate * 0 1 2 3 939*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 940*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 941*7c478bd9Sstevel@tonic-gate * | Type | Length | ACCM 942*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 943*7c478bd9Sstevel@tonic-gate * ACCM (cont) | 944*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 945*7c478bd9Sstevel@tonic-gate */ 946*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 947*7c478bd9Sstevel@tonic-gate static void 948*7c478bd9Sstevel@tonic-gate opt_format_accm(uchar_t *optdata, uint8_t size) 949*7c478bd9Sstevel@tonic-gate { 950*7c478bd9Sstevel@tonic-gate uint32_t accm; 951*7c478bd9Sstevel@tonic-gate 952*7c478bd9Sstevel@tonic-gate GETINT32(accm, optdata); 953*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "ACCM = 0x%08x", accm); 954*7c478bd9Sstevel@tonic-gate } 955*7c478bd9Sstevel@tonic-gate 956*7c478bd9Sstevel@tonic-gate /* 957*7c478bd9Sstevel@tonic-gate * The format of the Authentication-Protocol option (rfc1661) is: 958*7c478bd9Sstevel@tonic-gate * 959*7c478bd9Sstevel@tonic-gate * 0 1 2 3 960*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 961*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 962*7c478bd9Sstevel@tonic-gate * | Type | Length | Authentication-Protocol | 963*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 964*7c478bd9Sstevel@tonic-gate * | Data ... 965*7c478bd9Sstevel@tonic-gate * +-+-+-+-+ 966*7c478bd9Sstevel@tonic-gate * 967*7c478bd9Sstevel@tonic-gate * For PAP (rfc1334), there is no data. For CHAP (rfc1994), there is one 968*7c478bd9Sstevel@tonic-gate * byte of data representing the algorithm. 969*7c478bd9Sstevel@tonic-gate */ 970*7c478bd9Sstevel@tonic-gate static void 971*7c478bd9Sstevel@tonic-gate opt_format_authproto(uchar_t *optdata, uint8_t size) 972*7c478bd9Sstevel@tonic-gate { 973*7c478bd9Sstevel@tonic-gate uint16_t proto; 974*7c478bd9Sstevel@tonic-gate ppp_protoinfo_t *auth_protoinfo; 975*7c478bd9Sstevel@tonic-gate 976*7c478bd9Sstevel@tonic-gate GETINT16(proto, optdata); 977*7c478bd9Sstevel@tonic-gate 978*7c478bd9Sstevel@tonic-gate auth_protoinfo = ppp_getprotoinfo(proto); 979*7c478bd9Sstevel@tonic-gate 980*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Protocol = 0x%x (%s)", proto, 981*7c478bd9Sstevel@tonic-gate auth_protoinfo->name); 982*7c478bd9Sstevel@tonic-gate 983*7c478bd9Sstevel@tonic-gate switch (proto) { 984*7c478bd9Sstevel@tonic-gate case PPP_CHAP: { 985*7c478bd9Sstevel@tonic-gate uint8_t algo; 986*7c478bd9Sstevel@tonic-gate char *algostr; 987*7c478bd9Sstevel@tonic-gate 988*7c478bd9Sstevel@tonic-gate if (size < sizeof (proto) + sizeof (algo)) 989*7c478bd9Sstevel@tonic-gate return; 990*7c478bd9Sstevel@tonic-gate 991*7c478bd9Sstevel@tonic-gate GETINT8(algo, optdata); 992*7c478bd9Sstevel@tonic-gate switch (algo) { 993*7c478bd9Sstevel@tonic-gate case 5: 994*7c478bd9Sstevel@tonic-gate algostr = "CHAP with MD5"; 995*7c478bd9Sstevel@tonic-gate break; 996*7c478bd9Sstevel@tonic-gate case 128: 997*7c478bd9Sstevel@tonic-gate algostr = "MS-CHAP"; 998*7c478bd9Sstevel@tonic-gate break; 999*7c478bd9Sstevel@tonic-gate case 129: 1000*7c478bd9Sstevel@tonic-gate algostr = "MS-CHAP-2"; 1001*7c478bd9Sstevel@tonic-gate break; 1002*7c478bd9Sstevel@tonic-gate default: 1003*7c478bd9Sstevel@tonic-gate algostr = unknown_string; 1004*7c478bd9Sstevel@tonic-gate break; 1005*7c478bd9Sstevel@tonic-gate } 1006*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Algorithm = %d (%s)", algo, 1007*7c478bd9Sstevel@tonic-gate algostr); 1008*7c478bd9Sstevel@tonic-gate break; 1009*7c478bd9Sstevel@tonic-gate } 1010*7c478bd9Sstevel@tonic-gate default: 1011*7c478bd9Sstevel@tonic-gate break; 1012*7c478bd9Sstevel@tonic-gate } 1013*7c478bd9Sstevel@tonic-gate } 1014*7c478bd9Sstevel@tonic-gate 1015*7c478bd9Sstevel@tonic-gate /* 1016*7c478bd9Sstevel@tonic-gate * The format of the Quality Protocol option (rfc1661) is: 1017*7c478bd9Sstevel@tonic-gate * 1018*7c478bd9Sstevel@tonic-gate * 0 1 2 3 1019*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1020*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1021*7c478bd9Sstevel@tonic-gate * | Type | Length | Quality-Protocol | 1022*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1023*7c478bd9Sstevel@tonic-gate * | Data ... 1024*7c478bd9Sstevel@tonic-gate * +-+-+-+-+ 1025*7c478bd9Sstevel@tonic-gate * 1026*7c478bd9Sstevel@tonic-gate * For LQR, the data consists of a 4 byte reporting period. 1027*7c478bd9Sstevel@tonic-gate */ 1028*7c478bd9Sstevel@tonic-gate static void 1029*7c478bd9Sstevel@tonic-gate opt_format_qualproto(uchar_t *optdata, uint8_t size) 1030*7c478bd9Sstevel@tonic-gate { 1031*7c478bd9Sstevel@tonic-gate uint16_t proto; 1032*7c478bd9Sstevel@tonic-gate ppp_protoinfo_t *qual_protoinfo; 1033*7c478bd9Sstevel@tonic-gate 1034*7c478bd9Sstevel@tonic-gate GETINT16(proto, optdata); 1035*7c478bd9Sstevel@tonic-gate 1036*7c478bd9Sstevel@tonic-gate qual_protoinfo = ppp_getprotoinfo(proto); 1037*7c478bd9Sstevel@tonic-gate 1038*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Protocol = 0x%x (%s)", proto, 1039*7c478bd9Sstevel@tonic-gate qual_protoinfo->name); 1040*7c478bd9Sstevel@tonic-gate 1041*7c478bd9Sstevel@tonic-gate switch (proto) { 1042*7c478bd9Sstevel@tonic-gate case PPP_LQR: { 1043*7c478bd9Sstevel@tonic-gate uint32_t reporting_period; 1044*7c478bd9Sstevel@tonic-gate 1045*7c478bd9Sstevel@tonic-gate if (size < sizeof (proto) + sizeof (reporting_period)) 1046*7c478bd9Sstevel@tonic-gate return; 1047*7c478bd9Sstevel@tonic-gate 1048*7c478bd9Sstevel@tonic-gate GETINT32(reporting_period, optdata); 1049*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Reporting-Period = %d", 1050*7c478bd9Sstevel@tonic-gate reporting_period); 1051*7c478bd9Sstevel@tonic-gate break; 1052*7c478bd9Sstevel@tonic-gate } 1053*7c478bd9Sstevel@tonic-gate default: 1054*7c478bd9Sstevel@tonic-gate break; 1055*7c478bd9Sstevel@tonic-gate } 1056*7c478bd9Sstevel@tonic-gate } 1057*7c478bd9Sstevel@tonic-gate 1058*7c478bd9Sstevel@tonic-gate /* 1059*7c478bd9Sstevel@tonic-gate * The format of the Magic Number option (rfc1661) is: 1060*7c478bd9Sstevel@tonic-gate * 1061*7c478bd9Sstevel@tonic-gate * 0 1 2 3 1062*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1063*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1064*7c478bd9Sstevel@tonic-gate * | Type | Length | Magic-Number 1065*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1066*7c478bd9Sstevel@tonic-gate * Magic-Number (cont) | 1067*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1068*7c478bd9Sstevel@tonic-gate */ 1069*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 1070*7c478bd9Sstevel@tonic-gate static void 1071*7c478bd9Sstevel@tonic-gate opt_format_magicnum(uchar_t *optdata, uint8_t size) 1072*7c478bd9Sstevel@tonic-gate { 1073*7c478bd9Sstevel@tonic-gate uint32_t magicnum; 1074*7c478bd9Sstevel@tonic-gate 1075*7c478bd9Sstevel@tonic-gate GETINT32(magicnum, optdata); 1076*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Magic Number = 0x%08x", magicnum); 1077*7c478bd9Sstevel@tonic-gate } 1078*7c478bd9Sstevel@tonic-gate 1079*7c478bd9Sstevel@tonic-gate /* 1080*7c478bd9Sstevel@tonic-gate * The format of the FCS-Alternatives option (rfc1570) is: 1081*7c478bd9Sstevel@tonic-gate * 1082*7c478bd9Sstevel@tonic-gate * 0 1 2 1083*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 1084*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1085*7c478bd9Sstevel@tonic-gate * | Type | Length | Options | 1086*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1087*7c478bd9Sstevel@tonic-gate */ 1088*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 1089*7c478bd9Sstevel@tonic-gate static void 1090*7c478bd9Sstevel@tonic-gate opt_format_fcs(uchar_t *optdata, uint8_t size) 1091*7c478bd9Sstevel@tonic-gate { 1092*7c478bd9Sstevel@tonic-gate uint8_t options; 1093*7c478bd9Sstevel@tonic-gate 1094*7c478bd9Sstevel@tonic-gate GETINT8(options, optdata); 1095*7c478bd9Sstevel@tonic-gate 1096*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Options = 0x%02x", options); 1097*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), " %s", 1098*7c478bd9Sstevel@tonic-gate getflag(options, 0x01, "NULL FCS", "")); 1099*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), " %s", 1100*7c478bd9Sstevel@tonic-gate getflag(options, 0x02, "CCITT 16-bit FCS", "")); 1101*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), " %s", 1102*7c478bd9Sstevel@tonic-gate getflag(options, 0x04, "CCITT 32-bit FCS", "")); 1103*7c478bd9Sstevel@tonic-gate } 1104*7c478bd9Sstevel@tonic-gate 1105*7c478bd9Sstevel@tonic-gate /* 1106*7c478bd9Sstevel@tonic-gate * The format of the Self-Describing-Padding option (rfc1570) is: 1107*7c478bd9Sstevel@tonic-gate * 1108*7c478bd9Sstevel@tonic-gate * 0 1 2 1109*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 1110*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1111*7c478bd9Sstevel@tonic-gate * | Type | Length | Maximum | 1112*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1113*7c478bd9Sstevel@tonic-gate */ 1114*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 1115*7c478bd9Sstevel@tonic-gate static void 1116*7c478bd9Sstevel@tonic-gate opt_format_sdp(uchar_t *optdata, uint8_t size) 1117*7c478bd9Sstevel@tonic-gate { 1118*7c478bd9Sstevel@tonic-gate uint8_t max; 1119*7c478bd9Sstevel@tonic-gate 1120*7c478bd9Sstevel@tonic-gate GETINT8(max, optdata); 1121*7c478bd9Sstevel@tonic-gate 1122*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Maximum = %d", max); 1123*7c478bd9Sstevel@tonic-gate } 1124*7c478bd9Sstevel@tonic-gate 1125*7c478bd9Sstevel@tonic-gate /* 1126*7c478bd9Sstevel@tonic-gate * The format of the Numbered-Mode option (rfc1663) is: 1127*7c478bd9Sstevel@tonic-gate * 1128*7c478bd9Sstevel@tonic-gate * 0 1 2 3 1129*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1130*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1131*7c478bd9Sstevel@tonic-gate * | Type | Length | Window | Address... 1132*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1133*7c478bd9Sstevel@tonic-gate */ 1134*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 1135*7c478bd9Sstevel@tonic-gate static void 1136*7c478bd9Sstevel@tonic-gate opt_format_nummode(uchar_t *optdata, uint8_t size) 1137*7c478bd9Sstevel@tonic-gate { 1138*7c478bd9Sstevel@tonic-gate uint8_t window; 1139*7c478bd9Sstevel@tonic-gate 1140*7c478bd9Sstevel@tonic-gate GETINT8(window, optdata); 1141*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Window = %d", window); 1142*7c478bd9Sstevel@tonic-gate } 1143*7c478bd9Sstevel@tonic-gate 1144*7c478bd9Sstevel@tonic-gate /* 1145*7c478bd9Sstevel@tonic-gate * The format of the Callback option (rfc1570) is: 1146*7c478bd9Sstevel@tonic-gate * 1147*7c478bd9Sstevel@tonic-gate * 0 1 2 3 1148*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1149*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1150*7c478bd9Sstevel@tonic-gate * | Type | Length | Operation | Message ... 1151*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1152*7c478bd9Sstevel@tonic-gate */ 1153*7c478bd9Sstevel@tonic-gate static void 1154*7c478bd9Sstevel@tonic-gate opt_format_callback(uchar_t *optdata, uint8_t size) 1155*7c478bd9Sstevel@tonic-gate { 1156*7c478bd9Sstevel@tonic-gate uint8_t operation; 1157*7c478bd9Sstevel@tonic-gate char *opstr; 1158*7c478bd9Sstevel@tonic-gate 1159*7c478bd9Sstevel@tonic-gate GETINT8(operation, optdata); 1160*7c478bd9Sstevel@tonic-gate switch (operation) { 1161*7c478bd9Sstevel@tonic-gate case 0: 1162*7c478bd9Sstevel@tonic-gate opstr = "User Authentication"; 1163*7c478bd9Sstevel@tonic-gate break; 1164*7c478bd9Sstevel@tonic-gate case 1: 1165*7c478bd9Sstevel@tonic-gate opstr = "Dialing String"; 1166*7c478bd9Sstevel@tonic-gate break; 1167*7c478bd9Sstevel@tonic-gate case 2: 1168*7c478bd9Sstevel@tonic-gate opstr = "Location Identifier"; 1169*7c478bd9Sstevel@tonic-gate break; 1170*7c478bd9Sstevel@tonic-gate case 3: 1171*7c478bd9Sstevel@tonic-gate opstr = "E.164 Number"; 1172*7c478bd9Sstevel@tonic-gate break; 1173*7c478bd9Sstevel@tonic-gate case 4: 1174*7c478bd9Sstevel@tonic-gate opstr = "X.500 Distinguished Name"; 1175*7c478bd9Sstevel@tonic-gate break; 1176*7c478bd9Sstevel@tonic-gate case 6: 1177*7c478bd9Sstevel@tonic-gate opstr = "CBCP Negotiation"; 1178*7c478bd9Sstevel@tonic-gate break; 1179*7c478bd9Sstevel@tonic-gate default: 1180*7c478bd9Sstevel@tonic-gate opstr = unknown_string; 1181*7c478bd9Sstevel@tonic-gate break; 1182*7c478bd9Sstevel@tonic-gate } 1183*7c478bd9Sstevel@tonic-gate 1184*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Operation = %d (%s)", operation, opstr); 1185*7c478bd9Sstevel@tonic-gate 1186*7c478bd9Sstevel@tonic-gate if (size > sizeof (operation)) { 1187*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Message = %.*s", 1188*7c478bd9Sstevel@tonic-gate size - sizeof (operation), optdata); 1189*7c478bd9Sstevel@tonic-gate } 1190*7c478bd9Sstevel@tonic-gate } 1191*7c478bd9Sstevel@tonic-gate 1192*7c478bd9Sstevel@tonic-gate /* 1193*7c478bd9Sstevel@tonic-gate * The format of the Multilink-MRRU option (rfc1990) is: 1194*7c478bd9Sstevel@tonic-gate * 1195*7c478bd9Sstevel@tonic-gate * 0 1 2 3 1196*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1197*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1198*7c478bd9Sstevel@tonic-gate * | Type = 17 | Length = 4 | Max-Receive-Reconstructed-Unit| 1199*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1200*7c478bd9Sstevel@tonic-gate */ 1201*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 1202*7c478bd9Sstevel@tonic-gate static void 1203*7c478bd9Sstevel@tonic-gate opt_format_mrru(uchar_t *optdata, uint8_t size) 1204*7c478bd9Sstevel@tonic-gate { 1205*7c478bd9Sstevel@tonic-gate uint16_t mrru; 1206*7c478bd9Sstevel@tonic-gate 1207*7c478bd9Sstevel@tonic-gate GETINT16(mrru, optdata); 1208*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "MRRU = %d", mrru); 1209*7c478bd9Sstevel@tonic-gate } 1210*7c478bd9Sstevel@tonic-gate 1211*7c478bd9Sstevel@tonic-gate /* 1212*7c478bd9Sstevel@tonic-gate * The format of the Endpoint Discriminator option (rfc1990) is: 1213*7c478bd9Sstevel@tonic-gate * 1214*7c478bd9Sstevel@tonic-gate * 0 1 2 3 1215*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1216*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1217*7c478bd9Sstevel@tonic-gate * | Type = 19 | Length | Class | Address ... 1218*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1219*7c478bd9Sstevel@tonic-gate */ 1220*7c478bd9Sstevel@tonic-gate static void 1221*7c478bd9Sstevel@tonic-gate opt_format_epdisc(uchar_t *optdata, uint8_t size) 1222*7c478bd9Sstevel@tonic-gate { 1223*7c478bd9Sstevel@tonic-gate uint8_t class; 1224*7c478bd9Sstevel@tonic-gate char *classstr; 1225*7c478bd9Sstevel@tonic-gate uint8_t addrlen = size - sizeof (class); 1226*7c478bd9Sstevel@tonic-gate char *addr; 1227*7c478bd9Sstevel@tonic-gate 1228*7c478bd9Sstevel@tonic-gate GETINT8(class, optdata); 1229*7c478bd9Sstevel@tonic-gate 1230*7c478bd9Sstevel@tonic-gate switch (class) { 1231*7c478bd9Sstevel@tonic-gate case 0: 1232*7c478bd9Sstevel@tonic-gate classstr = "Null Class"; 1233*7c478bd9Sstevel@tonic-gate break; 1234*7c478bd9Sstevel@tonic-gate case 1: 1235*7c478bd9Sstevel@tonic-gate classstr = "Locally Assigned Address"; 1236*7c478bd9Sstevel@tonic-gate break; 1237*7c478bd9Sstevel@tonic-gate case 2: 1238*7c478bd9Sstevel@tonic-gate classstr = "IPv4 Address"; 1239*7c478bd9Sstevel@tonic-gate break; 1240*7c478bd9Sstevel@tonic-gate case 3: 1241*7c478bd9Sstevel@tonic-gate classstr = "IEE 802.1 Global MAC Address"; 1242*7c478bd9Sstevel@tonic-gate break; 1243*7c478bd9Sstevel@tonic-gate case 4: 1244*7c478bd9Sstevel@tonic-gate classstr = "PPP Magic-Number Block"; 1245*7c478bd9Sstevel@tonic-gate break; 1246*7c478bd9Sstevel@tonic-gate case 5: 1247*7c478bd9Sstevel@tonic-gate classstr = "Public Switched Network Directory Number"; 1248*7c478bd9Sstevel@tonic-gate break; 1249*7c478bd9Sstevel@tonic-gate default: 1250*7c478bd9Sstevel@tonic-gate classstr = unknown_string; 1251*7c478bd9Sstevel@tonic-gate break; 1252*7c478bd9Sstevel@tonic-gate } 1253*7c478bd9Sstevel@tonic-gate 1254*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Address Class = %d (%s)", class, 1255*7c478bd9Sstevel@tonic-gate classstr); 1256*7c478bd9Sstevel@tonic-gate 1257*7c478bd9Sstevel@tonic-gate if (addrlen == 0) 1258*7c478bd9Sstevel@tonic-gate return; 1259*7c478bd9Sstevel@tonic-gate 1260*7c478bd9Sstevel@tonic-gate addr = (char *)malloc(addrlen); 1261*7c478bd9Sstevel@tonic-gate (void) memcpy(addr, optdata, addrlen); 1262*7c478bd9Sstevel@tonic-gate switch (class) { 1263*7c478bd9Sstevel@tonic-gate case 2: { 1264*7c478bd9Sstevel@tonic-gate char addrstr[INET_ADDRSTRLEN]; 1265*7c478bd9Sstevel@tonic-gate 1266*7c478bd9Sstevel@tonic-gate if (addrlen != sizeof (in_addr_t)) 1267*7c478bd9Sstevel@tonic-gate break; 1268*7c478bd9Sstevel@tonic-gate if (inet_ntop(AF_INET, addr, addrstr, INET_ADDRSTRLEN) != 1269*7c478bd9Sstevel@tonic-gate NULL) { 1270*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Address = %s", addrstr); 1271*7c478bd9Sstevel@tonic-gate } 1272*7c478bd9Sstevel@tonic-gate break; 1273*7c478bd9Sstevel@tonic-gate } 1274*7c478bd9Sstevel@tonic-gate case 3: { 1275*7c478bd9Sstevel@tonic-gate char *addrstr; 1276*7c478bd9Sstevel@tonic-gate 1277*7c478bd9Sstevel@tonic-gate if (addrlen != sizeof (struct ether_addr)) 1278*7c478bd9Sstevel@tonic-gate break; 1279*7c478bd9Sstevel@tonic-gate if ((addrstr = ether_ntoa((struct ether_addr *)addr)) != NULL) { 1280*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Address = %s", addrstr); 1281*7c478bd9Sstevel@tonic-gate } 1282*7c478bd9Sstevel@tonic-gate break; 1283*7c478bd9Sstevel@tonic-gate } 1284*7c478bd9Sstevel@tonic-gate case 5: { 1285*7c478bd9Sstevel@tonic-gate /* 1286*7c478bd9Sstevel@tonic-gate * For this case, the address is supposed to be a plain 1287*7c478bd9Sstevel@tonic-gate * text telephone number. 1288*7c478bd9Sstevel@tonic-gate */ 1289*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Address = %.*s", addrlen, 1290*7c478bd9Sstevel@tonic-gate addr); 1291*7c478bd9Sstevel@tonic-gate } 1292*7c478bd9Sstevel@tonic-gate default: 1293*7c478bd9Sstevel@tonic-gate break; 1294*7c478bd9Sstevel@tonic-gate } 1295*7c478bd9Sstevel@tonic-gate 1296*7c478bd9Sstevel@tonic-gate free(addr); 1297*7c478bd9Sstevel@tonic-gate } 1298*7c478bd9Sstevel@tonic-gate 1299*7c478bd9Sstevel@tonic-gate /* 1300*7c478bd9Sstevel@tonic-gate * The DCE identifier option has the following format (from rfc1976): 1301*7c478bd9Sstevel@tonic-gate * 1302*7c478bd9Sstevel@tonic-gate * 0 1 2 1303*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 1304*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1305*7c478bd9Sstevel@tonic-gate * | Type | Length | Mode | 1306*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1307*7c478bd9Sstevel@tonic-gate */ 1308*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 1309*7c478bd9Sstevel@tonic-gate static void 1310*7c478bd9Sstevel@tonic-gate opt_format_dce(uchar_t *optdata, uint8_t size) 1311*7c478bd9Sstevel@tonic-gate { 1312*7c478bd9Sstevel@tonic-gate uint8_t mode; 1313*7c478bd9Sstevel@tonic-gate char *modestr; 1314*7c478bd9Sstevel@tonic-gate 1315*7c478bd9Sstevel@tonic-gate GETINT8(mode, optdata); 1316*7c478bd9Sstevel@tonic-gate switch (mode) { 1317*7c478bd9Sstevel@tonic-gate case 1: 1318*7c478bd9Sstevel@tonic-gate modestr = "No Additional Negotiation"; 1319*7c478bd9Sstevel@tonic-gate break; 1320*7c478bd9Sstevel@tonic-gate case 2: 1321*7c478bd9Sstevel@tonic-gate modestr = "Full PPP Negotiation and State Machine"; 1322*7c478bd9Sstevel@tonic-gate break; 1323*7c478bd9Sstevel@tonic-gate default: 1324*7c478bd9Sstevel@tonic-gate modestr = unknown_string; 1325*7c478bd9Sstevel@tonic-gate break; 1326*7c478bd9Sstevel@tonic-gate } 1327*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Mode = %d (%s)", mode, modestr); 1328*7c478bd9Sstevel@tonic-gate } 1329*7c478bd9Sstevel@tonic-gate 1330*7c478bd9Sstevel@tonic-gate /* 1331*7c478bd9Sstevel@tonic-gate * The format of the Link Discriminator option (rfc2125) is: 1332*7c478bd9Sstevel@tonic-gate * 1333*7c478bd9Sstevel@tonic-gate * 0 1 2 3 1334*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1335*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1336*7c478bd9Sstevel@tonic-gate * | Type | Length | Link Discriminator | 1337*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1338*7c478bd9Sstevel@tonic-gate */ 1339*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 1340*7c478bd9Sstevel@tonic-gate static void 1341*7c478bd9Sstevel@tonic-gate opt_format_linkdisc(uchar_t *optdata, uint8_t size) 1342*7c478bd9Sstevel@tonic-gate { 1343*7c478bd9Sstevel@tonic-gate uint16_t discrim; 1344*7c478bd9Sstevel@tonic-gate 1345*7c478bd9Sstevel@tonic-gate GETINT16(discrim, optdata); 1346*7c478bd9Sstevel@tonic-gate 1347*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Link Discriminator = %d", discrim); 1348*7c478bd9Sstevel@tonic-gate } 1349*7c478bd9Sstevel@tonic-gate 1350*7c478bd9Sstevel@tonic-gate 1351*7c478bd9Sstevel@tonic-gate /* 1352*7c478bd9Sstevel@tonic-gate * The format of the Internationalization option (rfc2484) is: 1353*7c478bd9Sstevel@tonic-gate * 1354*7c478bd9Sstevel@tonic-gate * 0 1 2 3 1355*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1356*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1357*7c478bd9Sstevel@tonic-gate * | Type | Length | MIBenum 1358*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1359*7c478bd9Sstevel@tonic-gate * MIBenum (cont) | Language-Tag... 1360*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1361*7c478bd9Sstevel@tonic-gate */ 1362*7c478bd9Sstevel@tonic-gate static void 1363*7c478bd9Sstevel@tonic-gate opt_format_i18n(uchar_t *optdata, uint8_t size) 1364*7c478bd9Sstevel@tonic-gate { 1365*7c478bd9Sstevel@tonic-gate uint32_t mibenum; 1366*7c478bd9Sstevel@tonic-gate uint8_t taglen; 1367*7c478bd9Sstevel@tonic-gate 1368*7c478bd9Sstevel@tonic-gate taglen = size - sizeof (mibenum); 1369*7c478bd9Sstevel@tonic-gate 1370*7c478bd9Sstevel@tonic-gate GETINT32(mibenum, optdata); 1371*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "MIBenum = %d", mibenum); 1372*7c478bd9Sstevel@tonic-gate 1373*7c478bd9Sstevel@tonic-gate if (taglen > 0) { 1374*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Language Tag = %.*s", taglen, 1375*7c478bd9Sstevel@tonic-gate optdata); 1376*7c478bd9Sstevel@tonic-gate } 1377*7c478bd9Sstevel@tonic-gate } 1378*7c478bd9Sstevel@tonic-gate 1379*7c478bd9Sstevel@tonic-gate /* 1380*7c478bd9Sstevel@tonic-gate * The format of the obsolete IP-Addresses option (rfc1172) is: 1381*7c478bd9Sstevel@tonic-gate * 1382*7c478bd9Sstevel@tonic-gate * 0 1 2 3 1383*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1384*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1385*7c478bd9Sstevel@tonic-gate * | Type | Length | Source-IP-Address 1386*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1387*7c478bd9Sstevel@tonic-gate * Source-IP-Address (cont) | Destination-IP-Address 1388*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1389*7c478bd9Sstevel@tonic-gate * Destination-IP-Address (cont) | 1390*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1391*7c478bd9Sstevel@tonic-gate */ 1392*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 1393*7c478bd9Sstevel@tonic-gate static void 1394*7c478bd9Sstevel@tonic-gate opt_format_ipaddresses(uchar_t *optdata, uint8_t size) 1395*7c478bd9Sstevel@tonic-gate { 1396*7c478bd9Sstevel@tonic-gate in_addr_t addr; 1397*7c478bd9Sstevel@tonic-gate char addrstr[INET_ADDRSTRLEN]; 1398*7c478bd9Sstevel@tonic-gate 1399*7c478bd9Sstevel@tonic-gate (void) memcpy(&addr, optdata, sizeof (in_addr_t)); 1400*7c478bd9Sstevel@tonic-gate if (inet_ntop(AF_INET, &addr, addrstr, INET_ADDRSTRLEN) != NULL) { 1401*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Source Address = %s", 1402*7c478bd9Sstevel@tonic-gate addrstr); 1403*7c478bd9Sstevel@tonic-gate } 1404*7c478bd9Sstevel@tonic-gate 1405*7c478bd9Sstevel@tonic-gate optdata += sizeof (in_addr_t); 1406*7c478bd9Sstevel@tonic-gate 1407*7c478bd9Sstevel@tonic-gate (void) memcpy(&addr, optdata, sizeof (in_addr_t)); 1408*7c478bd9Sstevel@tonic-gate if (inet_ntop(AF_INET, &addr, addrstr, INET_ADDRSTRLEN) != NULL) { 1409*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Destination Address = %s", 1410*7c478bd9Sstevel@tonic-gate addrstr); 1411*7c478bd9Sstevel@tonic-gate } 1412*7c478bd9Sstevel@tonic-gate } 1413*7c478bd9Sstevel@tonic-gate 1414*7c478bd9Sstevel@tonic-gate /* 1415*7c478bd9Sstevel@tonic-gate * The format of the IP-Compression-Protocol option (rfc1332) is: 1416*7c478bd9Sstevel@tonic-gate * 1417*7c478bd9Sstevel@tonic-gate * 0 1 2 3 1418*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1419*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1420*7c478bd9Sstevel@tonic-gate * | Type | Length | IP-Compression-Protocol | 1421*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1422*7c478bd9Sstevel@tonic-gate * | Data ... 1423*7c478bd9Sstevel@tonic-gate * +-+-+-+-+ 1424*7c478bd9Sstevel@tonic-gate * 1425*7c478bd9Sstevel@tonic-gate * For VJ Compressed TCP/IP, data consists of: 1426*7c478bd9Sstevel@tonic-gate * 1427*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1428*7c478bd9Sstevel@tonic-gate * | Max-Slot-Id | Comp-Slot-Id | 1429*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1430*7c478bd9Sstevel@tonic-gate * 1431*7c478bd9Sstevel@tonic-gate * For IPHC (rfc2509), data consists of: 1432*7c478bd9Sstevel@tonic-gate * 1433*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1434*7c478bd9Sstevel@tonic-gate * | TCP_SPACE | NON_TCP_SPACE | 1435*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1436*7c478bd9Sstevel@tonic-gate * | F_MAX_PERIOD | F_MAX_TIME | 1437*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1438*7c478bd9Sstevel@tonic-gate * | MAX_HEADER | suboptions... 1439*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1440*7c478bd9Sstevel@tonic-gate */ 1441*7c478bd9Sstevel@tonic-gate static void 1442*7c478bd9Sstevel@tonic-gate opt_format_ipcompproto(uchar_t *optdata, uint8_t size) 1443*7c478bd9Sstevel@tonic-gate { 1444*7c478bd9Sstevel@tonic-gate uint16_t proto; 1445*7c478bd9Sstevel@tonic-gate ppp_protoinfo_t *comp_protoinfo; 1446*7c478bd9Sstevel@tonic-gate 1447*7c478bd9Sstevel@tonic-gate GETINT16(proto, optdata); 1448*7c478bd9Sstevel@tonic-gate 1449*7c478bd9Sstevel@tonic-gate comp_protoinfo = ppp_getprotoinfo(proto); 1450*7c478bd9Sstevel@tonic-gate 1451*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Protocol = 0x%x (%s)", proto, 1452*7c478bd9Sstevel@tonic-gate comp_protoinfo->name); 1453*7c478bd9Sstevel@tonic-gate 1454*7c478bd9Sstevel@tonic-gate switch (proto) { 1455*7c478bd9Sstevel@tonic-gate case PPP_VJC_COMP: { 1456*7c478bd9Sstevel@tonic-gate uint8_t maxslotid; 1457*7c478bd9Sstevel@tonic-gate uint8_t compslotid; 1458*7c478bd9Sstevel@tonic-gate 1459*7c478bd9Sstevel@tonic-gate if (size < sizeof (proto) + sizeof (maxslotid) + 1460*7c478bd9Sstevel@tonic-gate sizeof (compslotid)) 1461*7c478bd9Sstevel@tonic-gate break; 1462*7c478bd9Sstevel@tonic-gate 1463*7c478bd9Sstevel@tonic-gate GETINT8(maxslotid, optdata); 1464*7c478bd9Sstevel@tonic-gate GETINT8(compslotid, optdata); 1465*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Max-Slot-Id = %d", maxslotid); 1466*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Comp-Slot Flag = 0x%x", 1467*7c478bd9Sstevel@tonic-gate compslotid); 1468*7c478bd9Sstevel@tonic-gate break; 1469*7c478bd9Sstevel@tonic-gate } 1470*7c478bd9Sstevel@tonic-gate case PPP_FULLHDR: { 1471*7c478bd9Sstevel@tonic-gate uint16_t tcp_space; 1472*7c478bd9Sstevel@tonic-gate uint16_t non_tcp_space; 1473*7c478bd9Sstevel@tonic-gate uint16_t f_max_period; 1474*7c478bd9Sstevel@tonic-gate uint16_t f_max_time; 1475*7c478bd9Sstevel@tonic-gate uint16_t max_header; 1476*7c478bd9Sstevel@tonic-gate 1477*7c478bd9Sstevel@tonic-gate if (size < sizeof (proto) + sizeof (tcp_space) + 1478*7c478bd9Sstevel@tonic-gate sizeof (non_tcp_space) + sizeof (f_max_period) + 1479*7c478bd9Sstevel@tonic-gate sizeof (f_max_time) + sizeof (max_header)) 1480*7c478bd9Sstevel@tonic-gate break; 1481*7c478bd9Sstevel@tonic-gate 1482*7c478bd9Sstevel@tonic-gate GETINT16(tcp_space, optdata); 1483*7c478bd9Sstevel@tonic-gate GETINT16(non_tcp_space, optdata); 1484*7c478bd9Sstevel@tonic-gate GETINT16(f_max_period, optdata); 1485*7c478bd9Sstevel@tonic-gate GETINT16(f_max_time, optdata); 1486*7c478bd9Sstevel@tonic-gate GETINT16(max_header, optdata); 1487*7c478bd9Sstevel@tonic-gate 1488*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "TCP_SPACE = %d", tcp_space); 1489*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "NON_TCP_SPACE = %d", 1490*7c478bd9Sstevel@tonic-gate non_tcp_space); 1491*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "F_MAX_PERIOD = %d", 1492*7c478bd9Sstevel@tonic-gate f_max_period); 1493*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "F_MAX_TIME = %d", f_max_time); 1494*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "MAX_HEADER = %d octets", 1495*7c478bd9Sstevel@tonic-gate max_header); 1496*7c478bd9Sstevel@tonic-gate } 1497*7c478bd9Sstevel@tonic-gate default: 1498*7c478bd9Sstevel@tonic-gate break; 1499*7c478bd9Sstevel@tonic-gate } 1500*7c478bd9Sstevel@tonic-gate } 1501*7c478bd9Sstevel@tonic-gate 1502*7c478bd9Sstevel@tonic-gate /* 1503*7c478bd9Sstevel@tonic-gate * The format of the IP-Address option (rfc1332) is: 1504*7c478bd9Sstevel@tonic-gate * 1505*7c478bd9Sstevel@tonic-gate * 0 1 2 3 1506*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1507*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1508*7c478bd9Sstevel@tonic-gate * | Type | Length | IP-Address 1509*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1510*7c478bd9Sstevel@tonic-gate * IP-Address (cont) | 1511*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1512*7c478bd9Sstevel@tonic-gate */ 1513*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 1514*7c478bd9Sstevel@tonic-gate static void 1515*7c478bd9Sstevel@tonic-gate opt_format_ipaddress(uchar_t *optdata, uint8_t size) 1516*7c478bd9Sstevel@tonic-gate { 1517*7c478bd9Sstevel@tonic-gate in_addr_t ipaddr; 1518*7c478bd9Sstevel@tonic-gate char addrstr[INET_ADDRSTRLEN]; 1519*7c478bd9Sstevel@tonic-gate 1520*7c478bd9Sstevel@tonic-gate (void) memcpy(&ipaddr, optdata, sizeof (in_addr_t)); 1521*7c478bd9Sstevel@tonic-gate if (inet_ntop(AF_INET, &ipaddr, addrstr, INET_ADDRSTRLEN) != NULL) { 1522*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Address = %s", addrstr); 1523*7c478bd9Sstevel@tonic-gate } 1524*7c478bd9Sstevel@tonic-gate } 1525*7c478bd9Sstevel@tonic-gate 1526*7c478bd9Sstevel@tonic-gate /* 1527*7c478bd9Sstevel@tonic-gate * The format of the Mobile-IPv4 option (rfc2290) is: 1528*7c478bd9Sstevel@tonic-gate * 1529*7c478bd9Sstevel@tonic-gate * 0 1 2 3 1530*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1531*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1532*7c478bd9Sstevel@tonic-gate * | Type | Length | Mobile Node's ... 1533*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1534*7c478bd9Sstevel@tonic-gate * ... Home Address | 1535*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1536*7c478bd9Sstevel@tonic-gate */ 1537*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 1538*7c478bd9Sstevel@tonic-gate static void 1539*7c478bd9Sstevel@tonic-gate opt_format_mobileipv4(uchar_t *optdata, uint8_t size) 1540*7c478bd9Sstevel@tonic-gate { 1541*7c478bd9Sstevel@tonic-gate in_addr_t ipaddr; 1542*7c478bd9Sstevel@tonic-gate char addrstr[INET_ADDRSTRLEN]; 1543*7c478bd9Sstevel@tonic-gate 1544*7c478bd9Sstevel@tonic-gate (void) memcpy(&ipaddr, optdata, sizeof (in_addr_t)); 1545*7c478bd9Sstevel@tonic-gate if (inet_ntop(AF_INET, &ipaddr, addrstr, INET_ADDRSTRLEN) != NULL) { 1546*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), 1547*7c478bd9Sstevel@tonic-gate "Mobile Node's Home Address = %s", addrstr); 1548*7c478bd9Sstevel@tonic-gate } 1549*7c478bd9Sstevel@tonic-gate } 1550*7c478bd9Sstevel@tonic-gate 1551*7c478bd9Sstevel@tonic-gate /* 1552*7c478bd9Sstevel@tonic-gate * The format of the Interface-Identifier option (rfc2472) is: 1553*7c478bd9Sstevel@tonic-gate * 1554*7c478bd9Sstevel@tonic-gate * 0 1 2 3 1555*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1556*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1557*7c478bd9Sstevel@tonic-gate * | Type | Length | Interface-Identifier (MS Bytes) 1558*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1559*7c478bd9Sstevel@tonic-gate * Interface-Identifier (cont) 1560*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1561*7c478bd9Sstevel@tonic-gate * Interface-Identifier (LS Bytes) | 1562*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1563*7c478bd9Sstevel@tonic-gate */ 1564*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 1565*7c478bd9Sstevel@tonic-gate static void 1566*7c478bd9Sstevel@tonic-gate opt_format_ifaceid(uchar_t *optdata, uint8_t size) 1567*7c478bd9Sstevel@tonic-gate { 1568*7c478bd9Sstevel@tonic-gate in6_addr_t id; 1569*7c478bd9Sstevel@tonic-gate char idstr[INET6_ADDRSTRLEN]; 1570*7c478bd9Sstevel@tonic-gate 1571*7c478bd9Sstevel@tonic-gate (void) memset(&id, 0, sizeof (in6_addr_t)); 1572*7c478bd9Sstevel@tonic-gate (void) memcpy(&id.s6_addr[8], optdata, 8); 1573*7c478bd9Sstevel@tonic-gate 1574*7c478bd9Sstevel@tonic-gate if (inet_ntop(AF_INET6, &id, idstr, INET6_ADDRSTRLEN) != NULL) { 1575*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Interface ID = %s", idstr); 1576*7c478bd9Sstevel@tonic-gate } 1577*7c478bd9Sstevel@tonic-gate } 1578*7c478bd9Sstevel@tonic-gate 1579*7c478bd9Sstevel@tonic-gate /* 1580*7c478bd9Sstevel@tonic-gate * The format of the IPv6-Compression-Protocol option (rfc2472) is: 1581*7c478bd9Sstevel@tonic-gate * 1582*7c478bd9Sstevel@tonic-gate * 0 1 2 3 1583*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1584*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1585*7c478bd9Sstevel@tonic-gate * | Type | Length | IPv6-Compression-Protocol | 1586*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1587*7c478bd9Sstevel@tonic-gate * | Data ... 1588*7c478bd9Sstevel@tonic-gate * +-+-+-+-+ 1589*7c478bd9Sstevel@tonic-gate */ 1590*7c478bd9Sstevel@tonic-gate static void 1591*7c478bd9Sstevel@tonic-gate opt_format_ipv6compproto(uchar_t *optdata, uint8_t size) 1592*7c478bd9Sstevel@tonic-gate { 1593*7c478bd9Sstevel@tonic-gate uint16_t proto; 1594*7c478bd9Sstevel@tonic-gate ppp_protoinfo_t *comp_protoinfo; 1595*7c478bd9Sstevel@tonic-gate 1596*7c478bd9Sstevel@tonic-gate GETINT16(proto, optdata); 1597*7c478bd9Sstevel@tonic-gate 1598*7c478bd9Sstevel@tonic-gate comp_protoinfo = ppp_getprotoinfo(proto); 1599*7c478bd9Sstevel@tonic-gate 1600*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Protocol = 0x%x (%s)", proto, 1601*7c478bd9Sstevel@tonic-gate comp_protoinfo->name); 1602*7c478bd9Sstevel@tonic-gate 1603*7c478bd9Sstevel@tonic-gate switch (proto) { 1604*7c478bd9Sstevel@tonic-gate case PPP_FULLHDR: { 1605*7c478bd9Sstevel@tonic-gate uint16_t tcp_space; 1606*7c478bd9Sstevel@tonic-gate uint16_t non_tcp_space; 1607*7c478bd9Sstevel@tonic-gate uint16_t f_max_period; 1608*7c478bd9Sstevel@tonic-gate uint16_t f_max_time; 1609*7c478bd9Sstevel@tonic-gate uint16_t max_header; 1610*7c478bd9Sstevel@tonic-gate 1611*7c478bd9Sstevel@tonic-gate if (size < sizeof (proto) + sizeof (tcp_space) + 1612*7c478bd9Sstevel@tonic-gate sizeof (non_tcp_space) + sizeof (f_max_period) + 1613*7c478bd9Sstevel@tonic-gate sizeof (f_max_time) + sizeof (max_header)) 1614*7c478bd9Sstevel@tonic-gate return; 1615*7c478bd9Sstevel@tonic-gate 1616*7c478bd9Sstevel@tonic-gate GETINT16(tcp_space, optdata); 1617*7c478bd9Sstevel@tonic-gate GETINT16(non_tcp_space, optdata); 1618*7c478bd9Sstevel@tonic-gate GETINT16(f_max_period, optdata); 1619*7c478bd9Sstevel@tonic-gate GETINT16(f_max_time, optdata); 1620*7c478bd9Sstevel@tonic-gate GETINT16(max_header, optdata); 1621*7c478bd9Sstevel@tonic-gate 1622*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "TCP_SPACE = %d", tcp_space); 1623*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "NON_TCP_SPACE = %d", 1624*7c478bd9Sstevel@tonic-gate non_tcp_space); 1625*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "F_MAX_PERIOD = %d", 1626*7c478bd9Sstevel@tonic-gate f_max_period); 1627*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "F_MAX_TIME = %d", f_max_time); 1628*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "MAX_HEADER = %d octets", 1629*7c478bd9Sstevel@tonic-gate max_header); 1630*7c478bd9Sstevel@tonic-gate } 1631*7c478bd9Sstevel@tonic-gate default: 1632*7c478bd9Sstevel@tonic-gate break; 1633*7c478bd9Sstevel@tonic-gate } 1634*7c478bd9Sstevel@tonic-gate } 1635*7c478bd9Sstevel@tonic-gate 1636*7c478bd9Sstevel@tonic-gate /* 1637*7c478bd9Sstevel@tonic-gate * The format of the Proprietary Compression OUI option (rfc1962) is: 1638*7c478bd9Sstevel@tonic-gate * 1639*7c478bd9Sstevel@tonic-gate * 0 1 2 3 1640*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1641*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1642*7c478bd9Sstevel@tonic-gate * | Type | Length | OUI ... 1643*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1644*7c478bd9Sstevel@tonic-gate * OUI | Subtype | Values... 1645*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- 1646*7c478bd9Sstevel@tonic-gate */ 1647*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 1648*7c478bd9Sstevel@tonic-gate static void 1649*7c478bd9Sstevel@tonic-gate opt_format_compoui(uchar_t *optdata, uint8_t size) 1650*7c478bd9Sstevel@tonic-gate { 1651*7c478bd9Sstevel@tonic-gate uint32_t oui; 1652*7c478bd9Sstevel@tonic-gate uint8_t subtype; 1653*7c478bd9Sstevel@tonic-gate char *ouistr; 1654*7c478bd9Sstevel@tonic-gate 1655*7c478bd9Sstevel@tonic-gate GETINT32(oui, optdata); 1656*7c478bd9Sstevel@tonic-gate subtype = oui & 0x000000ff; 1657*7c478bd9Sstevel@tonic-gate oui >>= 8; 1658*7c478bd9Sstevel@tonic-gate 1659*7c478bd9Sstevel@tonic-gate ouistr = ether_ouiname(oui); 1660*7c478bd9Sstevel@tonic-gate if (ouistr == NULL) 1661*7c478bd9Sstevel@tonic-gate ouistr = unknown_string; 1662*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "OUI = 0x%06x (%s)", oui, ouistr); 1663*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Subtype = 0x%x", subtype); 1664*7c478bd9Sstevel@tonic-gate } 1665*7c478bd9Sstevel@tonic-gate 1666*7c478bd9Sstevel@tonic-gate /* 1667*7c478bd9Sstevel@tonic-gate * The format of the Stac LZS configuration option (rfc1974) is: 1668*7c478bd9Sstevel@tonic-gate * 1669*7c478bd9Sstevel@tonic-gate * 0 1 2 3 1670*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1671*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1672*7c478bd9Sstevel@tonic-gate * | Type | Length | History Count | 1673*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1674*7c478bd9Sstevel@tonic-gate * | Check Mode | 1675*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+ 1676*7c478bd9Sstevel@tonic-gate */ 1677*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 1678*7c478bd9Sstevel@tonic-gate static void 1679*7c478bd9Sstevel@tonic-gate opt_format_staclzs(uchar_t *optdata, uint8_t size) 1680*7c478bd9Sstevel@tonic-gate { 1681*7c478bd9Sstevel@tonic-gate uint16_t hcount; 1682*7c478bd9Sstevel@tonic-gate uint8_t cmode; 1683*7c478bd9Sstevel@tonic-gate 1684*7c478bd9Sstevel@tonic-gate GETINT16(hcount, optdata); 1685*7c478bd9Sstevel@tonic-gate GETINT8(cmode, optdata); 1686*7c478bd9Sstevel@tonic-gate 1687*7c478bd9Sstevel@tonic-gate cmode &= 0x07; 1688*7c478bd9Sstevel@tonic-gate 1689*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "History Count = %d", hcount); 1690*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Check Mode = %d", cmode); 1691*7c478bd9Sstevel@tonic-gate } 1692*7c478bd9Sstevel@tonic-gate 1693*7c478bd9Sstevel@tonic-gate /* 1694*7c478bd9Sstevel@tonic-gate * The format of MPPC configuration option (rfc2118) is: 1695*7c478bd9Sstevel@tonic-gate * 1696*7c478bd9Sstevel@tonic-gate * 0 1 2 3 1697*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1698*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1699*7c478bd9Sstevel@tonic-gate * | Type | Length | Supported Bits | 1700*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1701*7c478bd9Sstevel@tonic-gate * | Supported Bits | 1702*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1703*7c478bd9Sstevel@tonic-gate */ 1704*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 1705*7c478bd9Sstevel@tonic-gate static void 1706*7c478bd9Sstevel@tonic-gate opt_format_mppc(uchar_t *optdata, uint8_t size) 1707*7c478bd9Sstevel@tonic-gate { 1708*7c478bd9Sstevel@tonic-gate uint32_t sb; 1709*7c478bd9Sstevel@tonic-gate 1710*7c478bd9Sstevel@tonic-gate GETINT32(sb, optdata); 1711*7c478bd9Sstevel@tonic-gate 1712*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Supported Bits = 0x%x", sb); 1713*7c478bd9Sstevel@tonic-gate } 1714*7c478bd9Sstevel@tonic-gate 1715*7c478bd9Sstevel@tonic-gate /* 1716*7c478bd9Sstevel@tonic-gate * The format of the Gandalf FZA configuration option (rfc1993) is: 1717*7c478bd9Sstevel@tonic-gate * 1718*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1719*7c478bd9Sstevel@tonic-gate * | Type | Length | History | Version ... 1720*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1721*7c478bd9Sstevel@tonic-gate */ 1722*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 1723*7c478bd9Sstevel@tonic-gate static void 1724*7c478bd9Sstevel@tonic-gate opt_format_gandalf(uchar_t *optdata, uint8_t size) 1725*7c478bd9Sstevel@tonic-gate { 1726*7c478bd9Sstevel@tonic-gate uint8_t history; 1727*7c478bd9Sstevel@tonic-gate 1728*7c478bd9Sstevel@tonic-gate GETINT8(history, optdata); 1729*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Maximum History Size = %d bits", 1730*7c478bd9Sstevel@tonic-gate history); 1731*7c478bd9Sstevel@tonic-gate } 1732*7c478bd9Sstevel@tonic-gate 1733*7c478bd9Sstevel@tonic-gate /* 1734*7c478bd9Sstevel@tonic-gate * The format of the BSD Compress configuration option (rfc1977) is: 1735*7c478bd9Sstevel@tonic-gate * 1736*7c478bd9Sstevel@tonic-gate * 0 1 2 1737*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 1738*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1739*7c478bd9Sstevel@tonic-gate * | Type | Length | Vers| Dict | 1740*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1741*7c478bd9Sstevel@tonic-gate */ 1742*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 1743*7c478bd9Sstevel@tonic-gate static void 1744*7c478bd9Sstevel@tonic-gate opt_format_bsdcomp(uchar_t *optdata, uint8_t size) 1745*7c478bd9Sstevel@tonic-gate { 1746*7c478bd9Sstevel@tonic-gate uint8_t version; 1747*7c478bd9Sstevel@tonic-gate uint8_t codesize; 1748*7c478bd9Sstevel@tonic-gate 1749*7c478bd9Sstevel@tonic-gate GETINT8(codesize, optdata); 1750*7c478bd9Sstevel@tonic-gate 1751*7c478bd9Sstevel@tonic-gate version = codesize >> 5; 1752*7c478bd9Sstevel@tonic-gate codesize &= 0x1f; 1753*7c478bd9Sstevel@tonic-gate 1754*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Version = 0x%x", version); 1755*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Maximum Code Size = %d bits", codesize); 1756*7c478bd9Sstevel@tonic-gate } 1757*7c478bd9Sstevel@tonic-gate 1758*7c478bd9Sstevel@tonic-gate /* 1759*7c478bd9Sstevel@tonic-gate * The format of the LZS-DCP configuration option (rfc1967) is: 1760*7c478bd9Sstevel@tonic-gate * 1761*7c478bd9Sstevel@tonic-gate * 0 1 2 3 1762*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1763*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1764*7c478bd9Sstevel@tonic-gate * | Type | Length | History Count | 1765*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1766*7c478bd9Sstevel@tonic-gate * | Check Mode | Process Mode | 1767*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1768*7c478bd9Sstevel@tonic-gate */ 1769*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 1770*7c478bd9Sstevel@tonic-gate static void 1771*7c478bd9Sstevel@tonic-gate opt_format_lzsdcp(uchar_t *optdata, uint8_t size) 1772*7c478bd9Sstevel@tonic-gate { 1773*7c478bd9Sstevel@tonic-gate uint16_t history; 1774*7c478bd9Sstevel@tonic-gate uint8_t mode; 1775*7c478bd9Sstevel@tonic-gate char *modestr; 1776*7c478bd9Sstevel@tonic-gate 1777*7c478bd9Sstevel@tonic-gate GETINT16(history, optdata); 1778*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "History Count = %d", history); 1779*7c478bd9Sstevel@tonic-gate 1780*7c478bd9Sstevel@tonic-gate /* check mode */ 1781*7c478bd9Sstevel@tonic-gate GETINT8(mode, optdata); 1782*7c478bd9Sstevel@tonic-gate switch (mode) { 1783*7c478bd9Sstevel@tonic-gate case 0: 1784*7c478bd9Sstevel@tonic-gate modestr = "None"; 1785*7c478bd9Sstevel@tonic-gate break; 1786*7c478bd9Sstevel@tonic-gate case 1: 1787*7c478bd9Sstevel@tonic-gate modestr = "LCB"; 1788*7c478bd9Sstevel@tonic-gate break; 1789*7c478bd9Sstevel@tonic-gate case 2: 1790*7c478bd9Sstevel@tonic-gate modestr = "Sequence Number"; 1791*7c478bd9Sstevel@tonic-gate break; 1792*7c478bd9Sstevel@tonic-gate case 3: 1793*7c478bd9Sstevel@tonic-gate modestr = "Sequence Number + LCB (default)"; 1794*7c478bd9Sstevel@tonic-gate break; 1795*7c478bd9Sstevel@tonic-gate default: 1796*7c478bd9Sstevel@tonic-gate modestr = unknown_string; 1797*7c478bd9Sstevel@tonic-gate break; 1798*7c478bd9Sstevel@tonic-gate } 1799*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Check Mode = %d (%s)", mode, modestr); 1800*7c478bd9Sstevel@tonic-gate 1801*7c478bd9Sstevel@tonic-gate /* process mode */ 1802*7c478bd9Sstevel@tonic-gate GETINT8(mode, optdata); 1803*7c478bd9Sstevel@tonic-gate switch (mode) { 1804*7c478bd9Sstevel@tonic-gate case 0: 1805*7c478bd9Sstevel@tonic-gate modestr = "None (default)"; 1806*7c478bd9Sstevel@tonic-gate break; 1807*7c478bd9Sstevel@tonic-gate case 1: 1808*7c478bd9Sstevel@tonic-gate modestr = "Process-Uncompressed"; 1809*7c478bd9Sstevel@tonic-gate break; 1810*7c478bd9Sstevel@tonic-gate default: 1811*7c478bd9Sstevel@tonic-gate modestr = unknown_string; 1812*7c478bd9Sstevel@tonic-gate break; 1813*7c478bd9Sstevel@tonic-gate } 1814*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Process Mode = %d (%s)", mode, modestr); 1815*7c478bd9Sstevel@tonic-gate 1816*7c478bd9Sstevel@tonic-gate } 1817*7c478bd9Sstevel@tonic-gate 1818*7c478bd9Sstevel@tonic-gate /* 1819*7c478bd9Sstevel@tonic-gate * The format of the Magnalink configuration option (rfc1975) is: 1820*7c478bd9Sstevel@tonic-gate * 1821*7c478bd9Sstevel@tonic-gate * 0 1 2 3 1822*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1823*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1824*7c478bd9Sstevel@tonic-gate * | Type | Length |FE |P| History | # Contexts | 1825*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1826*7c478bd9Sstevel@tonic-gate */ 1827*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 1828*7c478bd9Sstevel@tonic-gate static void 1829*7c478bd9Sstevel@tonic-gate opt_format_magnalink(uchar_t *optdata, uint8_t size) 1830*7c478bd9Sstevel@tonic-gate { 1831*7c478bd9Sstevel@tonic-gate uint8_t features; 1832*7c478bd9Sstevel@tonic-gate uint8_t pflag; 1833*7c478bd9Sstevel@tonic-gate uint8_t history; 1834*7c478bd9Sstevel@tonic-gate uint8_t contexts; 1835*7c478bd9Sstevel@tonic-gate 1836*7c478bd9Sstevel@tonic-gate GETINT8(history, optdata); 1837*7c478bd9Sstevel@tonic-gate GETINT8(contexts, optdata); 1838*7c478bd9Sstevel@tonic-gate 1839*7c478bd9Sstevel@tonic-gate features = history >> 6; 1840*7c478bd9Sstevel@tonic-gate pflag = (history >> 5) & 0x01; 1841*7c478bd9Sstevel@tonic-gate history &= 0x1f; 1842*7c478bd9Sstevel@tonic-gate 1843*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Features = 0x%d", features); 1844*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Packet Flag = %d", pflag); 1845*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "History Size = %d", history); 1846*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Contexts = %d", contexts); 1847*7c478bd9Sstevel@tonic-gate } 1848*7c478bd9Sstevel@tonic-gate 1849*7c478bd9Sstevel@tonic-gate /* 1850*7c478bd9Sstevel@tonic-gate * The format of the Deflate configuration option (rfc1979) is: 1851*7c478bd9Sstevel@tonic-gate * 1852*7c478bd9Sstevel@tonic-gate * 0 1 2 3 1853*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1854*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1855*7c478bd9Sstevel@tonic-gate * | Type | Length |Window | Method| MBZ |Chk| 1856*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1857*7c478bd9Sstevel@tonic-gate */ 1858*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 1859*7c478bd9Sstevel@tonic-gate static void 1860*7c478bd9Sstevel@tonic-gate opt_format_deflate(uchar_t *optdata, uint8_t size) 1861*7c478bd9Sstevel@tonic-gate { 1862*7c478bd9Sstevel@tonic-gate uint8_t window; 1863*7c478bd9Sstevel@tonic-gate uint8_t method; 1864*7c478bd9Sstevel@tonic-gate uint8_t chk; 1865*7c478bd9Sstevel@tonic-gate 1866*7c478bd9Sstevel@tonic-gate GETINT8(method, optdata); 1867*7c478bd9Sstevel@tonic-gate window = method >> 4; 1868*7c478bd9Sstevel@tonic-gate method &= 0x0f; 1869*7c478bd9Sstevel@tonic-gate 1870*7c478bd9Sstevel@tonic-gate GETINT8(chk, optdata); 1871*7c478bd9Sstevel@tonic-gate chk &= 0x03; 1872*7c478bd9Sstevel@tonic-gate 1873*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Maximum Window Size = %d", window); 1874*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Compression Method = 0x%x", method); 1875*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Check Method = 0x%x", chk); 1876*7c478bd9Sstevel@tonic-gate } 1877*7c478bd9Sstevel@tonic-gate 1878*7c478bd9Sstevel@tonic-gate /* 1879*7c478bd9Sstevel@tonic-gate * The format of the Proprietary Encryption OUI option (rfc1968) is: 1880*7c478bd9Sstevel@tonic-gate * 1881*7c478bd9Sstevel@tonic-gate * 0 1 2 3 1882*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1883*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1884*7c478bd9Sstevel@tonic-gate * | Type | Length | OUI ... 1885*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1886*7c478bd9Sstevel@tonic-gate * OUI | Subtype | Values... 1887*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- 1888*7c478bd9Sstevel@tonic-gate */ 1889*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 1890*7c478bd9Sstevel@tonic-gate static void 1891*7c478bd9Sstevel@tonic-gate opt_format_encroui(uchar_t *optdata, uint8_t size) 1892*7c478bd9Sstevel@tonic-gate { 1893*7c478bd9Sstevel@tonic-gate uint32_t oui; 1894*7c478bd9Sstevel@tonic-gate uint8_t subtype; 1895*7c478bd9Sstevel@tonic-gate char *ouistr; 1896*7c478bd9Sstevel@tonic-gate 1897*7c478bd9Sstevel@tonic-gate GETINT32(oui, optdata); 1898*7c478bd9Sstevel@tonic-gate subtype = oui & 0x000000ff; 1899*7c478bd9Sstevel@tonic-gate oui >>= 8; 1900*7c478bd9Sstevel@tonic-gate 1901*7c478bd9Sstevel@tonic-gate ouistr = ether_ouiname(oui); 1902*7c478bd9Sstevel@tonic-gate if (ouistr == NULL) 1903*7c478bd9Sstevel@tonic-gate ouistr = unknown_string; 1904*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "OUI = 0x%06x (%s)", oui, ouistr); 1905*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Subtype = 0x%x", subtype); 1906*7c478bd9Sstevel@tonic-gate } 1907*7c478bd9Sstevel@tonic-gate 1908*7c478bd9Sstevel@tonic-gate /* 1909*7c478bd9Sstevel@tonic-gate * The format of the DESE, DESE-bis, and 3DESE configuration options 1910*7c478bd9Sstevel@tonic-gate * (rfc1969, rfc2419, and rfc2420) are: 1911*7c478bd9Sstevel@tonic-gate * 1912*7c478bd9Sstevel@tonic-gate * 0 1 2 3 1913*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1914*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1915*7c478bd9Sstevel@tonic-gate * | Type = 3 | Length | Initial Nonce ... 1916*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1917*7c478bd9Sstevel@tonic-gate */ 1918*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 1919*7c478bd9Sstevel@tonic-gate static void 1920*7c478bd9Sstevel@tonic-gate opt_format_dese(uchar_t *optdata, uint8_t size) 1921*7c478bd9Sstevel@tonic-gate { 1922*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), 1923*7c478bd9Sstevel@tonic-gate "Initial Nonce = 0x%02x%02x%02x%02x%02x%02x%02x%02x", 1924*7c478bd9Sstevel@tonic-gate optdata[0], optdata[1], optdata[2], optdata[3], optdata[4], 1925*7c478bd9Sstevel@tonic-gate optdata[5], optdata[6], optdata[7]); 1926*7c478bd9Sstevel@tonic-gate } 1927*7c478bd9Sstevel@tonic-gate 1928*7c478bd9Sstevel@tonic-gate /* 1929*7c478bd9Sstevel@tonic-gate * The format of the PPPMux Default Protocol Id option 1930*7c478bd9Sstevel@tonic-gate * (draft-ietf-pppext-pppmux-02.txt) is: 1931*7c478bd9Sstevel@tonic-gate * 1932*7c478bd9Sstevel@tonic-gate * 0 1 2 3 1933*7c478bd9Sstevel@tonic-gate * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1934*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1935*7c478bd9Sstevel@tonic-gate * | Type = 1 | Length = 4 | Default PID | 1936*7c478bd9Sstevel@tonic-gate * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1937*7c478bd9Sstevel@tonic-gate */ 1938*7c478bd9Sstevel@tonic-gate /*ARGSUSED1*/ 1939*7c478bd9Sstevel@tonic-gate static void 1940*7c478bd9Sstevel@tonic-gate opt_format_muxpid(uchar_t *optdata, uint8_t size) 1941*7c478bd9Sstevel@tonic-gate { 1942*7c478bd9Sstevel@tonic-gate uint16_t defpid; 1943*7c478bd9Sstevel@tonic-gate 1944*7c478bd9Sstevel@tonic-gate GETINT16(defpid, optdata); 1945*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Default PID = %d", defpid); 1946*7c478bd9Sstevel@tonic-gate } 1947