sync with 3.7.1 (2002/5/31)
This commit is contained in:
parent
79b978bc0d
commit
83d7d548f9
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: addrtoname.c,v 1.5 2002/02/18 09:37:05 itojun Exp $ */
|
||||
/* $NetBSD: addrtoname.c,v 1.6 2002/05/31 09:45:44 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
|
@ -27,9 +27,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.83 2001/09/17 21:57:50 fenner Exp (LBL)";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.86 2001/11/25 01:48:46 guy Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: addrtoname.c,v 1.5 2002/02/18 09:37:05 itojun Exp $");
|
||||
__RCSID("$NetBSD: addrtoname.c,v 1.6 2002/05/31 09:45:44 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -72,6 +72,8 @@ struct rtentry;
|
|||
|
||||
/*
|
||||
* hash tables for whatever-to-name translations
|
||||
*
|
||||
* XXX there has to be error checks against strdup(3) failure
|
||||
*/
|
||||
|
||||
#define HASHNAMESIZE 4096
|
||||
|
@ -88,6 +90,7 @@ struct hnamemem uporttable[HASHNAMESIZE];
|
|||
struct hnamemem eprototable[HASHNAMESIZE];
|
||||
struct hnamemem dnaddrtable[HASHNAMESIZE];
|
||||
struct hnamemem llcsaptable[HASHNAMESIZE];
|
||||
struct hnamemem ipxsaptable[HASHNAMESIZE];
|
||||
|
||||
#ifdef INET6
|
||||
struct h6namemem {
|
||||
|
@ -619,6 +622,32 @@ udpport_string(register u_short port)
|
|||
return (tp->name);
|
||||
}
|
||||
|
||||
const char *
|
||||
ipxsap_string(u_short port)
|
||||
{
|
||||
register char *cp;
|
||||
register struct hnamemem *tp;
|
||||
register u_int32_t i = port;
|
||||
char buf[sizeof("0000")];
|
||||
|
||||
for (tp = &ipxsaptable[i & (HASHNAMESIZE-1)]; tp->nxt; tp = tp->nxt)
|
||||
if (tp->addr == i)
|
||||
return (tp->name);
|
||||
|
||||
tp->addr = i;
|
||||
tp->nxt = newhnamemem();
|
||||
|
||||
cp = buf;
|
||||
NTOHS(port);
|
||||
*cp++ = hex[port >> 12 & 0xf];
|
||||
*cp++ = hex[port >> 8 & 0xf];
|
||||
*cp++ = hex[port >> 4 & 0xf];
|
||||
*cp++ = hex[port & 0xf];
|
||||
*cp++ = '\0';
|
||||
tp->name = strdup(buf);
|
||||
return (tp->name);
|
||||
}
|
||||
|
||||
static void
|
||||
init_servarray(void)
|
||||
{
|
||||
|
@ -663,12 +692,12 @@ init_eprotoarray(void)
|
|||
register struct hnamemem *table;
|
||||
|
||||
for (i = 0; eproto_db[i].s; i++) {
|
||||
int j = ntohs(eproto_db[i].p) & (HASHNAMESIZE-1);
|
||||
int j = htons(eproto_db[i].p) & (HASHNAMESIZE-1);
|
||||
table = &eprototable[j];
|
||||
while (table->name)
|
||||
table = table->nxt;
|
||||
table->name = eproto_db[i].s;
|
||||
table->addr = ntohs(eproto_db[i].p);
|
||||
table->addr = htons(eproto_db[i].p);
|
||||
table->nxt = newhnamemem();
|
||||
}
|
||||
}
|
||||
|
@ -814,6 +843,240 @@ init_llcsaparray(void)
|
|||
}
|
||||
}
|
||||
|
||||
static struct tok ipxsap_db[] = {
|
||||
{ 0x0000, "Unknown" },
|
||||
{ 0x0001, "User" },
|
||||
{ 0x0002, "User Group" },
|
||||
{ 0x0003, "PrintQueue" },
|
||||
{ 0x0004, "FileServer" },
|
||||
{ 0x0005, "JobServer" },
|
||||
{ 0x0006, "Gateway" },
|
||||
{ 0x0007, "PrintServer" },
|
||||
{ 0x0008, "ArchiveQueue" },
|
||||
{ 0x0009, "ArchiveServer" },
|
||||
{ 0x000a, "JobQueue" },
|
||||
{ 0x000b, "Administration" },
|
||||
{ 0x000F, "Novell TI-RPC" },
|
||||
{ 0x0017, "Diagnostics" },
|
||||
{ 0x0020, "NetBIOS" },
|
||||
{ 0x0021, "NAS SNA Gateway" },
|
||||
{ 0x0023, "NACS AsyncGateway" },
|
||||
{ 0x0024, "RemoteBridge/RoutingService" },
|
||||
{ 0x0026, "BridgeServer" },
|
||||
{ 0x0027, "TCP/IP Gateway" },
|
||||
{ 0x0028, "Point-to-point X.25 BridgeServer" },
|
||||
{ 0x0029, "3270 Gateway" },
|
||||
{ 0x002a, "CHI Corp" },
|
||||
{ 0x002c, "PC Chalkboard" },
|
||||
{ 0x002d, "TimeSynchServer" },
|
||||
{ 0x002e, "ARCserve5.0/PalindromeBackup" },
|
||||
{ 0x0045, "DI3270 Gateway" },
|
||||
{ 0x0047, "AdvertisingPrintServer" },
|
||||
{ 0x004a, "NetBlazerModems" },
|
||||
{ 0x004b, "BtrieveVAP" },
|
||||
{ 0x004c, "NetwareSQL" },
|
||||
{ 0x004d, "XtreeNetwork" },
|
||||
{ 0x0050, "BtrieveVAP4.11" },
|
||||
{ 0x0052, "QuickLink" },
|
||||
{ 0x0053, "PrintQueueUser" },
|
||||
{ 0x0058, "Multipoint X.25 Router" },
|
||||
{ 0x0060, "STLB/NLM" },
|
||||
{ 0x0064, "ARCserve" },
|
||||
{ 0x0066, "ARCserve3.0" },
|
||||
{ 0x0072, "WAN CopyUtility" },
|
||||
{ 0x007a, "TES-NetwareVMS" },
|
||||
{ 0x0092, "WATCOM Debugger/EmeraldTapeBackupServer" },
|
||||
{ 0x0095, "DDA OBGYN" },
|
||||
{ 0x0098, "NetwareAccessServer" },
|
||||
{ 0x009a, "Netware for VMS II/NamedPipeServer" },
|
||||
{ 0x009b, "NetwareAccessServer" },
|
||||
{ 0x009e, "PortableNetwareServer/SunLinkNVT" },
|
||||
{ 0x00a1, "PowerchuteAPC UPS" },
|
||||
{ 0x00aa, "LAWserve" },
|
||||
{ 0x00ac, "CompaqIDA StatusMonitor" },
|
||||
{ 0x0100, "PIPE STAIL" },
|
||||
{ 0x0102, "LAN ProtectBindery" },
|
||||
{ 0x0103, "OracleDataBaseServer" },
|
||||
{ 0x0107, "Netware386/RSPX RemoteConsole" },
|
||||
{ 0x010f, "NovellSNA Gateway" },
|
||||
{ 0x0111, "TestServer" },
|
||||
{ 0x0112, "HP PrintServer" },
|
||||
{ 0x0114, "CSA MUX" },
|
||||
{ 0x0115, "CSA LCA" },
|
||||
{ 0x0116, "CSA CM" },
|
||||
{ 0x0117, "CSA SMA" },
|
||||
{ 0x0118, "CSA DBA" },
|
||||
{ 0x0119, "CSA NMA" },
|
||||
{ 0x011a, "CSA SSA" },
|
||||
{ 0x011b, "CSA STATUS" },
|
||||
{ 0x011e, "CSA APPC" },
|
||||
{ 0x0126, "SNA TEST SSA Profile" },
|
||||
{ 0x012a, "CSA TRACE" },
|
||||
{ 0x012b, "NetwareSAA" },
|
||||
{ 0x012e, "IKARUS VirusScan" },
|
||||
{ 0x0130, "CommunicationsExecutive" },
|
||||
{ 0x0133, "NNS DomainServer/NetwareNamingServicesDomain" },
|
||||
{ 0x0135, "NetwareNamingServicesProfile" },
|
||||
{ 0x0137, "Netware386 PrintQueue/NNS PrintQueue" },
|
||||
{ 0x0141, "LAN SpoolServer" },
|
||||
{ 0x0152, "IRMALAN Gateway" },
|
||||
{ 0x0154, "NamedPipeServer" },
|
||||
{ 0x0166, "NetWareManagement" },
|
||||
{ 0x0168, "Intel PICKIT CommServer/Intel CAS TalkServer" },
|
||||
{ 0x0173, "Compaq" },
|
||||
{ 0x0174, "Compaq SNMP Agent" },
|
||||
{ 0x0175, "Compaq" },
|
||||
{ 0x0180, "XTreeServer/XTreeTools" },
|
||||
{ 0x018A, "NASI ServicesBroadcastServer" },
|
||||
{ 0x01b0, "GARP Gateway" },
|
||||
{ 0x01b1, "Binfview" },
|
||||
{ 0x01bf, "IntelLanDeskManager" },
|
||||
{ 0x01ca, "AXTEC" },
|
||||
{ 0x01cb, "ShivaNetModem/E" },
|
||||
{ 0x01cc, "ShivaLanRover/E" },
|
||||
{ 0x01cd, "ShivaLanRover/T" },
|
||||
{ 0x01ce, "ShivaUniversal" },
|
||||
{ 0x01d8, "CastelleFAXPressServer" },
|
||||
{ 0x01da, "CastelleLANPressPrintServer" },
|
||||
{ 0x01dc, "CastelleFAX/Xerox7033 FaxServer/ExcelLanFax" },
|
||||
{ 0x01f0, "LEGATO" },
|
||||
{ 0x01f5, "LEGATO" },
|
||||
{ 0x0233, "NMS Agent/NetwareManagementAgent" },
|
||||
{ 0x0237, "NMS IPX Discovery/LANternReadWriteChannel" },
|
||||
{ 0x0238, "NMS IP Discovery/LANternTrapAlarmChannel" },
|
||||
{ 0x023a, "LANtern" },
|
||||
{ 0x023c, "MAVERICK" },
|
||||
{ 0x023f, "NovellSMDR" },
|
||||
{ 0x024e, "NetwareConnect" },
|
||||
{ 0x024f, "NASI ServerBroadcast Cisco" },
|
||||
{ 0x026a, "NMS ServiceConsole" },
|
||||
{ 0x026b, "TimeSynchronizationServer Netware 4.x" },
|
||||
{ 0x0278, "DirectoryServer Netware 4.x" },
|
||||
{ 0x027b, "NetwareManagementAgent" },
|
||||
{ 0x0280, "Novell File and Printer Sharing Service for PC" },
|
||||
{ 0x0304, "NovellSAA Gateway" },
|
||||
{ 0x0308, "COM/VERMED" },
|
||||
{ 0x030a, "GalacticommWorldgroupServer" },
|
||||
{ 0x030c, "IntelNetport2/HP JetDirect/HP Quicksilver" },
|
||||
{ 0x0320, "AttachmateGateway" },
|
||||
{ 0x0327, "MicrosoftDiagnostiocs" },
|
||||
{ 0x0328, "WATCOM SQL Server" },
|
||||
{ 0x0335, "MultiTechSystems MultisynchCommServer" },
|
||||
{ 0x0343, "Xylogics RemoteAccessServer/LANModem" },
|
||||
{ 0x0355, "ArcadaBackupExec" },
|
||||
{ 0x0358, "MSLCD1" },
|
||||
{ 0x0361, "NETINELO" },
|
||||
{ 0x037e, "Powerchute UPS Monitoring" },
|
||||
{ 0x037f, "ViruSafeNotify" },
|
||||
{ 0x0386, "HP Bridge" },
|
||||
{ 0x0387, "HP Hub" },
|
||||
{ 0x0394, "NetWare SAA Gateway" },
|
||||
{ 0x039b, "LotusNotes" },
|
||||
{ 0x03b7, "CertusAntiVirus" },
|
||||
{ 0x03c4, "ARCserve4.0" },
|
||||
{ 0x03c7, "LANspool3.5" },
|
||||
{ 0x03d7, "LexmarkPrinterServer" },
|
||||
{ 0x03d8, "LexmarkXLE PrinterServer" },
|
||||
{ 0x03dd, "BanyanENS NetwareClient" },
|
||||
{ 0x03de, "GuptaSequelBaseServer/NetWareSQL" },
|
||||
{ 0x03e1, "UnivelUnixware" },
|
||||
{ 0x03e4, "UnivelUnixware" },
|
||||
{ 0x03fc, "IntelNetport" },
|
||||
{ 0x03fd, "PrintServerQueue" },
|
||||
{ 0x040A, "ipnServer" },
|
||||
{ 0x040D, "LVERRMAN" },
|
||||
{ 0x040E, "LVLIC" },
|
||||
{ 0x0414, "NET Silicon (DPI)/Kyocera" },
|
||||
{ 0x0429, "SiteLockVirus" },
|
||||
{ 0x0432, "UFHELPR???" },
|
||||
{ 0x0433, "Synoptics281xAdvancedSNMPAgent" },
|
||||
{ 0x0444, "MicrosoftNT SNA Server" },
|
||||
{ 0x0448, "Oracle" },
|
||||
{ 0x044c, "ARCserve5.01" },
|
||||
{ 0x0457, "CanonGP55" },
|
||||
{ 0x045a, "QMS Printers" },
|
||||
{ 0x045b, "DellSCSI Array" },
|
||||
{ 0x0491, "NetBlazerModems" },
|
||||
{ 0x04ac, "OnTimeScheduler" },
|
||||
{ 0x04b0, "CD-Net" },
|
||||
{ 0x0513, "EmulexNQA" },
|
||||
{ 0x0520, "SiteLockChecks" },
|
||||
{ 0x0529, "SiteLockChecks" },
|
||||
{ 0x052d, "CitrixOS2 AppServer" },
|
||||
{ 0x0535, "Tektronix" },
|
||||
{ 0x0536, "Milan" },
|
||||
{ 0x055d, "Attachmate SNA gateway" },
|
||||
{ 0x056b, "IBM8235 ModemServer" },
|
||||
{ 0x056c, "ShivaLanRover/E PLUS" },
|
||||
{ 0x056d, "ShivaLanRover/T PLUS" },
|
||||
{ 0x0580, "McAfeeNetShield" },
|
||||
{ 0x05B8, "NLM to workstation communication (Revelation Software)" },
|
||||
{ 0x05BA, "CompatibleSystemsRouters" },
|
||||
{ 0x05BE, "CheyenneHierarchicalStorageManager" },
|
||||
{ 0x0606, "JCWatermarkImaging" },
|
||||
{ 0x060c, "AXISNetworkPrinter" },
|
||||
{ 0x0610, "AdaptecSCSIManagement" },
|
||||
{ 0x0621, "IBM AntiVirus" },
|
||||
{ 0x0640, "Windows95 RemoteRegistryService" },
|
||||
{ 0x064e, "MicrosoftIIS" },
|
||||
{ 0x067b, "Microsoft Win95/98 File and Print Sharing for NetWare" },
|
||||
{ 0x067c, "Microsoft Win95/98 File and Print Sharing for NetWare" },
|
||||
{ 0x076C, "Xerox" },
|
||||
{ 0x079b, "ShivaLanRover/E 115" },
|
||||
{ 0x079c, "ShivaLanRover/T 115" },
|
||||
{ 0x07B4, "CubixWorldDesk" },
|
||||
{ 0x07c2, "Quarterdeck IWare Connect V2.x NLM" },
|
||||
{ 0x07c1, "Quarterdeck IWare Connect V3.x NLM" },
|
||||
{ 0x0810, "ELAN License Server Demo" },
|
||||
{ 0x0824, "ShivaLanRoverAccessSwitch/E" },
|
||||
{ 0x086a, "ISSC Collector" },
|
||||
{ 0x087f, "ISSC DAS AgentAIX" },
|
||||
{ 0x0880, "Intel Netport PRO" },
|
||||
{ 0x0881, "Intel Netport PRO" },
|
||||
{ 0x0b29, "SiteLock" },
|
||||
{ 0x0c29, "SiteLockApplications" },
|
||||
{ 0x0c2c, "LicensingServer" },
|
||||
{ 0x2101, "PerformanceTechnologyInstantInternet" },
|
||||
{ 0x2380, "LAI SiteLock" },
|
||||
{ 0x238c, "MeetingMaker" },
|
||||
{ 0x4808, "SiteLockServer/SiteLockMetering" },
|
||||
{ 0x5555, "SiteLockUser" },
|
||||
{ 0x6312, "Tapeware" },
|
||||
{ 0x6f00, "RabbitGateway" },
|
||||
{ 0x7703, "MODEM" },
|
||||
{ 0x8002, "NetPortPrinters" },
|
||||
{ 0x8008, "WordPerfectNetworkVersion" },
|
||||
{ 0x85BE, "Cisco EIGRP" },
|
||||
{ 0x8888, "WordPerfectNetworkVersion/QuickNetworkManagement" },
|
||||
{ 0x9000, "McAfeeNetShield" },
|
||||
{ 0x9604, "CSA-NT_MON" },
|
||||
{ 0xb6a8, "OceanIsleReachoutRemoteControl" },
|
||||
{ 0xf11f, "SiteLockMetering" },
|
||||
{ 0xf1ff, "SiteLock" },
|
||||
{ 0xf503, "Microsoft SQL Server" },
|
||||
{ 0xF905, "IBM TimeAndPlace" },
|
||||
{ 0xfbfb, "TopCallIII FaxServer" },
|
||||
{ 0xffff, "AnyService/Wildcard" },
|
||||
{ 0, (char *)0 }
|
||||
};
|
||||
|
||||
static void
|
||||
init_ipxsaparray(void)
|
||||
{
|
||||
register int i;
|
||||
register struct hnamemem *table;
|
||||
|
||||
for (i = 0; ipxsap_db[i].s != NULL; i++) {
|
||||
int j = htons(ipxsap_db[i].v) & (HASHNAMESIZE-1);
|
||||
table = &ipxsaptable[j];
|
||||
while (table->name)
|
||||
table = table->nxt;
|
||||
table->name = ipxsap_db[i].s;
|
||||
table->addr = htons(ipxsap_db[i].v);
|
||||
table->nxt = newhnamemem();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the address to name translation machinery. We map all
|
||||
* non-local IP addresses to numeric addresses if fflag is true (i.e.,
|
||||
|
@ -839,6 +1102,7 @@ init_addrtoname(u_int32_t localnet, u_int32_t mask)
|
|||
init_eprotoarray();
|
||||
init_llcsaparray();
|
||||
init_protoidarray();
|
||||
init_ipxsaparray();
|
||||
}
|
||||
|
||||
const char *
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: interface.h,v 1.3 2002/02/18 09:37:05 itojun Exp $ */
|
||||
/* $NetBSD: interface.h,v 1.4 2002/05/31 09:45:44 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-2002
|
||||
|
@ -20,7 +20,7 @@
|
|||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) Header: /tcpdump/master/tcpdump/interface.h,v 1.178 2002/01/21 11:39:58 mcr Exp (LBL)
|
||||
* @(#) Header: /tcpdump/master/tcpdump/interface.h,v 1.184 2002/05/29 10:32:01 guy Exp (LBL)
|
||||
*/
|
||||
|
||||
#ifndef tcpdump_interface_h
|
||||
|
@ -81,10 +81,8 @@ extern int uflag; /* Print undecoded NFS handles */
|
|||
extern int vflag; /* verbose */
|
||||
extern int xflag; /* print packet in hex */
|
||||
extern int Xflag; /* print packet in hex/ascii */
|
||||
|
||||
extern int Aflag; /* print packet only in ascii observing TAB, LF, CR and SPACE as graphical chars */
|
||||
extern char *espsecret;
|
||||
extern struct esp_algorithm *espsecret_xform; /* cache of decoded alg. */
|
||||
extern char *espsecret_key;
|
||||
|
||||
extern int packettype; /* as specified by -T */
|
||||
#define PT_VAT 1 /* Visual Audio Tool */
|
||||
|
@ -206,12 +204,17 @@ extern void default_print(const u_char *, u_int);
|
|||
extern void default_print_unaligned(const u_char *, u_int);
|
||||
extern void dvmrp_print(const u_char *, u_int);
|
||||
extern void egp_print(const u_char *, u_int, const u_char *);
|
||||
extern void pflog_if_print(u_char *, const struct pcap_pkthdr *,
|
||||
const u_char *);
|
||||
extern void arcnet_if_print(u_char *, const struct pcap_pkthdr *,
|
||||
const u_char *);
|
||||
extern void ether_print(const u_char *, u_int, u_int);
|
||||
extern void ether_if_print(u_char *, const struct pcap_pkthdr *,
|
||||
const u_char *);
|
||||
extern u_int token_print(const u_char *, u_int, u_int);
|
||||
extern void token_if_print(u_char *, const struct pcap_pkthdr *,
|
||||
const u_char *);
|
||||
extern void fddi_print(const u_char *, u_int, u_int);
|
||||
extern void fddi_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern void ieee802_11_if_print(u_char *, const struct pcap_pkthdr *,
|
||||
const u_char *);
|
||||
|
@ -239,8 +242,8 @@ extern void pimv1_print(const u_char *, u_int);
|
|||
extern void cisco_autorp_print(const u_char *, u_int);
|
||||
extern void mobile_print(const u_char *, u_int);
|
||||
extern void pim_print(const u_char *, u_int);
|
||||
extern void pppoe_print(const u_char *, u_int);
|
||||
extern void ppp_print(register const u_char *, u_int);
|
||||
extern u_int pppoe_print(const u_char *, u_int);
|
||||
extern u_int ppp_print(register const u_char *, u_int);
|
||||
extern void ppp_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
|
||||
extern void ppp_hdlc_if_print(u_char *, const struct pcap_pkthdr *,
|
||||
const u_char *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: parsenfsfh.c,v 1.3 2002/02/18 09:37:05 itojun Exp $ */
|
||||
/* $NetBSD: parsenfsfh.c,v 1.4 2002/05/31 09:45:44 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993, 1994 Jeffrey C. Mogul, Digital Equipment Corporation,
|
||||
|
@ -46,9 +46,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.23 2001/09/17 21:57:53 fenner Exp (LBL)";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.24 2002/04/24 06:27:06 guy Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: parsenfsfh.c,v 1.3 2002/02/18 09:37:05 itojun Exp $");
|
||||
__RCSID("$NetBSD: parsenfsfh.c,v 1.4 2002/05/31 09:45:44 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -115,11 +115,11 @@ __RCSID("$NetBSD: parsenfsfh.c,v 1.3 2002/02/18 09:37:05 itojun Exp $");
|
|||
((lsb) + ((e)<<8) + ((d)<<16) + ((c)<<24))
|
||||
#endif
|
||||
|
||||
static int is_UCX(unsigned char *);
|
||||
static int is_UCX(const unsigned char *);
|
||||
|
||||
void
|
||||
Parse_fh(fh, len, fsidp, inop, osnamep, fsnamep, ourself)
|
||||
register caddr_t *fh;
|
||||
register const unsigned char *fh;
|
||||
int len;
|
||||
my_fsid *fsidp;
|
||||
ino_t *inop;
|
||||
|
@ -127,7 +127,7 @@ const char **osnamep; /* if non-NULL, return OS name here */
|
|||
const char **fsnamep; /* if non-NULL, return server fs name here (for VMS) */
|
||||
int ourself; /* true if file handle was generated on this host */
|
||||
{
|
||||
register unsigned char *fhp = (unsigned char *)fh;
|
||||
register const unsigned char *fhp = fh;
|
||||
u_int32_t temp;
|
||||
int fhtype = FHT_UNKNOWN;
|
||||
int i;
|
||||
|
@ -443,7 +443,7 @@ int ourself; /* true if file handle was generated on this host */
|
|||
*/
|
||||
static int
|
||||
is_UCX(fhp)
|
||||
unsigned char *fhp;
|
||||
const unsigned char *fhp;
|
||||
{
|
||||
register int i;
|
||||
int seen_null = 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-802_11.c,v 1.3 2002/02/18 09:37:05 itojun Exp $ */
|
||||
/* $NetBSD: print-802_11.c,v 1.4 2002/05/31 09:45:44 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001
|
||||
|
@ -26,9 +26,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.6 2001/09/17 21:57:53 fenner Exp (LBL)";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.7 2002/05/13 08:30:19 guy Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-802_11.c,v 1.3 2002/02/18 09:37:05 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-802_11.c,v 1.4 2002/05/31 09:45:44 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -54,11 +54,16 @@ __RCSID("$NetBSD: print-802_11.c,v 1.3 2002/02/18 09:37:05 itojun Exp $");
|
|||
|
||||
#include "ieee802_11.h"
|
||||
|
||||
#define RATEStoBUF(p, buf) \
|
||||
#define PRINT_RATES(p) \
|
||||
do { \
|
||||
int z = 0; \
|
||||
for (z = 0 ; z < p.rates.length ; z++) \
|
||||
snprintf(buf, sizeof(buf), "%s %2.1f", buf, (.5 * (p.rates.rate[z] & 0x7f))); \
|
||||
int z; \
|
||||
char *sep = " ["; \
|
||||
for (z = 0; z < p.rates.length ; z++) { \
|
||||
printf("%s%2.1f", sep, (.5 * (p.rates.rate[z] & 0x7f))); \
|
||||
sep = " "; \
|
||||
} \
|
||||
if (p.rates.length != 0) \
|
||||
printf(" Mbit]"); \
|
||||
} while (0)
|
||||
|
||||
static const char *auth_alg_text[]={"Open System","Shared Key","EAP"};
|
||||
|
@ -138,9 +143,7 @@ static int parse_elements(struct mgmt_body_t *pbody,const u_char *p,int offset)
|
|||
{
|
||||
for (;;) {
|
||||
if (!TTEST2(*(p + offset), 1))
|
||||
return 0;
|
||||
if (*(p + offset) == 0xff)
|
||||
break;
|
||||
return 1;
|
||||
switch (*(p + offset)) {
|
||||
case E_SSID:
|
||||
if (!TTEST2(*(p+offset), 2))
|
||||
|
@ -223,9 +226,7 @@ static int handle_beacon(u_int16_t fc, const struct mgmt_header_t *pmh,
|
|||
{
|
||||
struct mgmt_body_t pbody;
|
||||
int offset = 0;
|
||||
char buf[128];
|
||||
|
||||
memset(buf, 0, sizeof(buf));
|
||||
memset(&pbody, 0, sizeof(pbody));
|
||||
|
||||
if (!TTEST2(*p, 12))
|
||||
|
@ -240,10 +241,11 @@ static int handle_beacon(u_int16_t fc, const struct mgmt_header_t *pmh,
|
|||
if (!parse_elements(&pbody,p,offset))
|
||||
return 0;
|
||||
|
||||
RATEStoBUF(pbody, buf);
|
||||
|
||||
printf("%s (%s) [%s Mbit] %s CH: %x %s",
|
||||
subtype_text[FC_SUBTYPE(fc)], pbody.ssid.ssid, buf,
|
||||
printf("%s (", subtype_text[FC_SUBTYPE(fc)]);
|
||||
fn_print(pbody.ssid.ssid, NULL);
|
||||
printf(")");
|
||||
PRINT_RATES(pbody);
|
||||
printf(" %s CH: %u %s",
|
||||
CAPABILITY_ESS(pbody.capability_info) ? "ESS" : "IBSS",
|
||||
pbody.ds.channel,
|
||||
CAPABILITY_PRIVACY(pbody.capability_info) ? ", PRIVACY" : "" );
|
||||
|
@ -256,9 +258,7 @@ static int handle_assoc_request(u_int16_t fc, const struct mgmt_header_t *pmh,
|
|||
{
|
||||
struct mgmt_body_t pbody;
|
||||
int offset = 0;
|
||||
char buf[128];
|
||||
|
||||
memset(buf, 0, sizeof(buf));
|
||||
memset(&pbody, 0, sizeof(pbody));
|
||||
|
||||
if (!TTEST2(*p, 4))
|
||||
|
@ -271,10 +271,10 @@ static int handle_assoc_request(u_int16_t fc, const struct mgmt_header_t *pmh,
|
|||
if (!parse_elements(&pbody,p,offset))
|
||||
return 0;
|
||||
|
||||
RATEStoBUF(pbody,buf);
|
||||
|
||||
printf("%s (%s) [%s Mbit] ",
|
||||
subtype_text[FC_SUBTYPE(fc)], pbody.ssid.ssid,buf);
|
||||
printf("%s (", subtype_text[FC_SUBTYPE(fc)]);
|
||||
fn_print(pbody.ssid.ssid, NULL);
|
||||
printf(")");
|
||||
PRINT_RATES(pbody);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -298,7 +298,7 @@ static int handle_assoc_response(u_int16_t fc, const struct mgmt_header_t *pmh,
|
|||
if (!parse_elements(&pbody,p,offset))
|
||||
return 0;
|
||||
|
||||
printf("%s AID(%x) :%s: %s ", subtype_text[FC_SUBTYPE(fc)],
|
||||
printf("%s AID(%x) :%s: %s", subtype_text[FC_SUBTYPE(fc)],
|
||||
((u_int16_t)(pbody.aid << 2 )) >> 2 ,
|
||||
CAPABILITY_PRIVACY(pbody.capability_info) ? " PRIVACY " : "",
|
||||
(pbody.status_code < 19 ? status_text[pbody.status_code] : "n/a"));
|
||||
|
@ -327,7 +327,9 @@ static int handle_reassoc_request(u_int16_t fc, const struct mgmt_header_t *pmh,
|
|||
if (!parse_elements(&pbody,p,offset))
|
||||
return 0;
|
||||
|
||||
printf("%s (%s) AP : %s",subtype_text[FC_SUBTYPE(fc)], pbody.ssid.ssid, etheraddr_string( pbody.ap ));
|
||||
printf("%s (", subtype_text[FC_SUBTYPE(fc)]);
|
||||
fn_print(pbody.ssid.ssid, NULL);
|
||||
printf(") AP : %s", etheraddr_string( pbody.ap ));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -344,19 +346,16 @@ static int handle_probe_request(u_int16_t fc, const struct mgmt_header_t *pmh,
|
|||
{
|
||||
struct mgmt_body_t pbody;
|
||||
int offset = 0;
|
||||
char buf[128];
|
||||
|
||||
memset(buf, 0, sizeof(buf));
|
||||
|
||||
memset(&pbody, 0, sizeof(pbody));
|
||||
|
||||
if (!parse_elements(&pbody, p, offset))
|
||||
return 0;
|
||||
|
||||
RATEStoBUF(pbody, buf);
|
||||
|
||||
printf("%s (%s) [%s Mbit] ", subtype_text[FC_SUBTYPE(fc)],
|
||||
pbody.ssid.ssid,buf);
|
||||
printf("%s (", subtype_text[FC_SUBTYPE(fc)]);
|
||||
fn_print(pbody.ssid.ssid, NULL);
|
||||
printf(")");
|
||||
PRINT_RATES(pbody);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -366,9 +365,6 @@ static int handle_probe_response(u_int16_t fc, const struct mgmt_header_t *pmh,
|
|||
{
|
||||
struct mgmt_body_t pbody;
|
||||
int offset = 0;
|
||||
char buf[128];
|
||||
|
||||
memset(buf, 0, sizeof(buf));
|
||||
|
||||
memset(&pbody, 0, sizeof(pbody));
|
||||
|
||||
|
@ -384,8 +380,12 @@ static int handle_probe_response(u_int16_t fc, const struct mgmt_header_t *pmh,
|
|||
if (!parse_elements(&pbody, p, offset))
|
||||
return 0;
|
||||
|
||||
printf("%s (%s) CH: %x %s", subtype_text[FC_SUBTYPE(fc)], pbody.ssid.ssid,pbody.ds.channel,
|
||||
CAPABILITY_PRIVACY(pbody.capability_info) ? ",PRIVACY " : "" );
|
||||
printf("%s (", subtype_text[FC_SUBTYPE(fc)]);
|
||||
fn_print(pbody.ssid.ssid, NULL);
|
||||
printf(") ");
|
||||
PRINT_RATES(pbody);
|
||||
printf(" CH: %u%s", pbody.ds.channel,
|
||||
CAPABILITY_PRIVACY(pbody.capability_info) ? ", PRIVACY" : "" );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -411,7 +411,7 @@ static int handle_disassoc(u_int16_t fc, const struct mgmt_header_t *pmh,
|
|||
pbody.reason_code = EXTRACT_LE_16BITS(p);
|
||||
offset += 2;
|
||||
|
||||
printf("%s: %s ", subtype_text[FC_SUBTYPE(fc)],
|
||||
printf("%s: %s", subtype_text[FC_SUBTYPE(fc)],
|
||||
pbody.reason_code < 10 ? reason_text[pbody.reason_code] : "Reserved" );
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-arp.c,v 1.3 2002/02/18 09:37:05 itojun Exp $ */
|
||||
/* $NetBSD: print-arp.c,v 1.4 2002/05/31 09:45:44 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
|
@ -25,9 +25,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-arp.c,v 1.51 2001/09/17 21:57:54 fenner Exp (LBL)";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-arp.c,v 1.53 2002/04/25 04:37:31 guy Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-arp.c,v 1.3 2002/02/18 09:37:05 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-arp.c,v 1.4 2002/05/31 09:45:44 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -59,7 +59,7 @@ __RCSID("$NetBSD: print-arp.c,v 1.3 2002/02/18 09:37:05 itojun Exp $");
|
|||
* arp_tha and arp_tpa in that order, according to the lengths
|
||||
* specified. Field names used correspond to RFC 826.
|
||||
*/
|
||||
struct arphdr {
|
||||
struct arp_pkthdr {
|
||||
u_short ar_hrd; /* format of hardware address */
|
||||
#define ARPHRD_ETHER 1 /* ethernet hardware format */
|
||||
#define ARPHRD_IEEE802 6 /* token-ring hardware format */
|
||||
|
@ -87,10 +87,10 @@ struct arphdr {
|
|||
u_char ar_tha[]; /* target hardware address */
|
||||
u_char ar_tpa[]; /* target protocol address */
|
||||
#endif
|
||||
#define ar_sha(ap) (((const caddr_t)((ap)+1))+0)
|
||||
#define ar_spa(ap) (((const caddr_t)((ap)+1))+ (ap)->ar_hln)
|
||||
#define ar_tha(ap) (((const caddr_t)((ap)+1))+ (ap)->ar_hln+(ap)->ar_pln)
|
||||
#define ar_tpa(ap) (((const caddr_t)((ap)+1))+2*(ap)->ar_hln+(ap)->ar_pln)
|
||||
#define ar_sha(ap) (((const u_char *)((ap)+1))+0)
|
||||
#define ar_spa(ap) (((const u_char *)((ap)+1))+ (ap)->ar_hln)
|
||||
#define ar_tha(ap) (((const u_char *)((ap)+1))+ (ap)->ar_hln+(ap)->ar_pln)
|
||||
#define ar_tpa(ap) (((const u_char *)((ap)+1))+2*(ap)->ar_hln+(ap)->ar_pln)
|
||||
};
|
||||
|
||||
#define ARP_HDRLEN 8
|
||||
|
@ -110,10 +110,10 @@ static u_char ezero[6];
|
|||
void
|
||||
arp_print(const u_char *bp, u_int length, u_int caplen)
|
||||
{
|
||||
const struct arphdr *ap;
|
||||
const struct arp_pkthdr *ap;
|
||||
u_short pro, hrd, op;
|
||||
|
||||
ap = (const struct arphdr *)bp;
|
||||
ap = (const struct arp_pkthdr *)bp;
|
||||
TCHECK(*ap);
|
||||
if ((const u_char *)(ar_tpa(ap) + PLN(ap)) > snapend) {
|
||||
(void)printf("truncated-arp");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-ascii.c,v 1.2 2001/06/25 19:59:57 itojun Exp $ */
|
||||
/* $NetBSD: print-ascii.c,v 1.3 2002/05/31 09:45:44 itojun Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -44,9 +44,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-ascii.c,v 1.6 2000/01/29 16:47:46 itojun Exp";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-ascii.c,v 1.7 2002/04/24 06:55:55 guy Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-ascii.c,v 1.2 2001/06/25 19:59:57 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-ascii.c,v 1.3 2002/05/31 09:45:44 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
@ -55,6 +55,7 @@ __RCSID("$NetBSD: print-ascii.c,v 1.2 2001/06/25 19:59:57 itojun Exp $");
|
|||
|
||||
#include "interface.h"
|
||||
|
||||
#define ASCII_LINELENGTH 300
|
||||
#define HEXDUMP_BYTES_PER_LINE 16
|
||||
#define HEXDUMP_SHORTS_PER_LINE (HEXDUMP_BYTES_PER_LINE / 2)
|
||||
#define HEXDUMP_HEXSTUFF_PER_SHORT 5 /* 4 hex digits and a space */
|
||||
|
@ -69,41 +70,64 @@ ascii_print_with_offset(register const u_char *cp, register u_int length,
|
|||
register int s1, s2;
|
||||
register int nshorts;
|
||||
char hexstuff[HEXDUMP_SHORTS_PER_LINE*HEXDUMP_HEXSTUFF_PER_SHORT+1], *hsp;
|
||||
char asciistuff[HEXDUMP_BYTES_PER_LINE+1], *asp;
|
||||
char asciistuff[ASCII_LINELENGTH+1], *asp;
|
||||
int maxlength = (Aflag ? ASCII_LINELENGTH : HEXDUMP_SHORTS_PER_LINE);
|
||||
|
||||
nshorts = length / sizeof(u_short);
|
||||
i = 0;
|
||||
hsp = hexstuff; asp = asciistuff;
|
||||
if (Aflag) *(asp++) = '\n';
|
||||
while (--nshorts >= 0) {
|
||||
s1 = *cp++;
|
||||
s2 = *cp++;
|
||||
(void)snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff),
|
||||
" %02x%02x", s1, s2);
|
||||
hsp += HEXDUMP_HEXSTUFF_PER_SHORT;
|
||||
*(asp++) = (isgraph(s1) ? s1 : '.');
|
||||
*(asp++) = (isgraph(s2) ? s2 : '.');
|
||||
if (++i >= HEXDUMP_SHORTS_PER_LINE) {
|
||||
*hsp = *asp = '\0';
|
||||
(void)printf("\n0x%04x\t%-*s\t%s",
|
||||
oset, HEXDUMP_HEXSTUFF_PER_LINE,
|
||||
hexstuff, asciistuff);
|
||||
i = 0; hsp = hexstuff; asp = asciistuff;
|
||||
oset += HEXDUMP_BYTES_PER_LINE;
|
||||
if (Aflag) {
|
||||
i += 2;
|
||||
*(asp++) = (isgraph(s1) ? s1 : (s1 != '\t' && s1 != ' ' && s1 != '\n' && s1 != '\r' ? '.' : s1) );
|
||||
*(asp++) = (isgraph(s2) ? s2 : (s2 != '\t' && s2 != ' ' && s2 != '\n' && s2 != '\r' ? '.' : s2) );
|
||||
if (s1 == '\n' || s2 == '\n') i = maxlength;
|
||||
|
||||
} else {
|
||||
(void)snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff),
|
||||
" %02x%02x", s1, s2);
|
||||
hsp += HEXDUMP_HEXSTUFF_PER_SHORT;
|
||||
*(asp++) = (isgraph(s1) ? s1 : '.');
|
||||
*(asp++) = (isgraph(s2) ? s2 : '.');
|
||||
i++;
|
||||
}
|
||||
if (i >= maxlength) {
|
||||
*hsp = *asp = '\0';
|
||||
if (Aflag) {
|
||||
(void)printf("%s", asciistuff);
|
||||
} else {
|
||||
(void)printf("\n0x%04x\t%-*s\t%s",
|
||||
oset, HEXDUMP_HEXSTUFF_PER_LINE,
|
||||
hexstuff, asciistuff);
|
||||
}
|
||||
i = 0; hsp = hexstuff; asp = asciistuff;
|
||||
oset += HEXDUMP_BYTES_PER_LINE;
|
||||
}
|
||||
}
|
||||
if (length & 1) {
|
||||
s1 = *cp++;
|
||||
(void)snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff),
|
||||
" %02x", s1);
|
||||
hsp += 3;
|
||||
*(asp++) = (isgraph(s1) ? s1 : '.');
|
||||
if (Aflag) {
|
||||
*(asp++) = (isgraph(s1) ? s1 : (s1 != '\t' && s1 != ' ' && s1 != '\n' && s1 != '\r' ? '.' : s1) );
|
||||
} else {
|
||||
(void)snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff),
|
||||
" %02x", s1);
|
||||
hsp += 3;
|
||||
*(asp++) = (isgraph(s1) ? s1 : '.');
|
||||
}
|
||||
++i;
|
||||
}
|
||||
if (i > 0) {
|
||||
*hsp = *asp = '\0';
|
||||
(void)printf("\n0x%04x\t%-*s\t%s",
|
||||
if (Aflag) {
|
||||
(void)printf("\n%s", asciistuff);
|
||||
} else {
|
||||
(void)printf("\n0x%04x\t%-*s\t%s",
|
||||
oset, HEXDUMP_HEXSTUFF_PER_LINE,
|
||||
hexstuff, asciistuff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-atalk.c,v 1.3 2002/02/18 09:37:05 itojun Exp $ */
|
||||
/* $NetBSD: print-atalk.c,v 1.4 2002/05/31 09:45:44 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
|
@ -27,9 +27,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.70 2001/11/15 08:23:12 itojun Exp (LBL)";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.71 2002/02/05 10:03:34 guy Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-atalk.c,v 1.3 2002/02/18 09:37:05 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-atalk.c,v 1.4 2002/05/31 09:45:44 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -119,6 +119,14 @@ llap_print(register const u_char *bp, u_int length)
|
|||
register const struct atShortDDP *sdp;
|
||||
u_short snet;
|
||||
|
||||
/*
|
||||
* Our packet is on a 4-byte boundary, as we're either called
|
||||
* directly from a top-level link-layer printer (ltalk_if_print)
|
||||
* or from the UDP printer. The LLAP+DDP header is a multiple
|
||||
* of 4 bytes in length, so the DDP payload is also on a 4-byte
|
||||
* boundary, and we don't need to align it before calling
|
||||
* "ddp_print()".
|
||||
*/
|
||||
lp = (const struct LAP *)bp;
|
||||
bp += sizeof(*lp);
|
||||
length -= sizeof(*lp);
|
||||
|
@ -401,6 +409,11 @@ nbp_print(register const struct atNBP *np, u_int length, register u_short snet,
|
|||
int i;
|
||||
const u_char *ep;
|
||||
|
||||
if (length < nbpHeaderSize) {
|
||||
(void)printf(" truncated-nbp %d", length);
|
||||
return;
|
||||
}
|
||||
|
||||
length -= nbpHeaderSize;
|
||||
if (length < 8) {
|
||||
/* must be room for at least one tuple */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-atm.c,v 1.3 2002/02/18 09:37:05 itojun Exp $ */
|
||||
/* $NetBSD: print-atm.c,v 1.4 2002/05/31 09:45:45 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995, 1996, 1997
|
||||
|
@ -24,9 +24,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-atm.c,v 1.21 2001/07/05 18:54:14 guy Exp (LBL)";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-atm.c,v 1.23 2002/04/07 10:05:40 guy Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-atm.c,v 1.3 2002/02/18 09:37:05 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-atm.c,v 1.4 2002/05/31 09:45:45 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -42,11 +42,58 @@ __RCSID("$NetBSD: print-atm.c,v 1.3 2002/02/18 09:37:05 itojun Exp $");
|
|||
|
||||
#include <stdio.h>
|
||||
#include <pcap.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "ethertype.h"
|
||||
|
||||
#include "ether.h"
|
||||
|
||||
/*
|
||||
* Print an RFC 1483 LLC-encapsulated ATM frame.
|
||||
*/
|
||||
static void
|
||||
atm_llc_print(const u_char *p, int length, int caplen)
|
||||
{
|
||||
struct ether_header ehdr;
|
||||
u_short ether_type;
|
||||
u_short extracted_ethertype;
|
||||
|
||||
ether_type = p[6] << 8 | p[7];
|
||||
|
||||
/*
|
||||
* Fake up an Ethernet header for the benefit of printers that
|
||||
* insist on "packetp" pointing to an Ethernet header.
|
||||
*/
|
||||
memset(&ehdr, '\0', sizeof ehdr);
|
||||
|
||||
/*
|
||||
* Some printers want to get back at the ethernet addresses,
|
||||
* and/or check that they're not walking off the end of the packet.
|
||||
* Rather than pass them all the way down, we set these globals.
|
||||
*/
|
||||
snapend = p + caplen;
|
||||
/*
|
||||
* Actually, the only printers that use packetp are print-arp.c
|
||||
* and print-bootp.c, and they assume that packetp points to an
|
||||
* Ethernet header. The right thing to do is to fix them to know
|
||||
* which link type is in use when they excavate. XXX
|
||||
*/
|
||||
packetp = (u_char *)&ehdr;
|
||||
|
||||
if (!llc_print(p, length, caplen, ESRC(&ehdr), EDST(&ehdr),
|
||||
&extracted_ethertype)) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (extracted_ethertype) {
|
||||
printf("(LLC %s) ",
|
||||
etherproto_string(htons(extracted_ethertype)));
|
||||
}
|
||||
if (!xflag && !qflag)
|
||||
default_print(p, caplen);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the top level routine of the printer. 'p' is the points
|
||||
* to the LLC/SNAP header of the packet, 'tvp' is the timestamp,
|
||||
|
@ -58,7 +105,6 @@ atm_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
|||
{
|
||||
u_int caplen = h->caplen;
|
||||
u_int length = h->len;
|
||||
u_short ethertype;
|
||||
|
||||
++infodelay;
|
||||
ts_print(&h->ts);
|
||||
|
@ -68,7 +114,12 @@ atm_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
|||
goto out;
|
||||
}
|
||||
if (p[0] != 0xaa || p[1] != 0xaa || p[2] != 0x03) {
|
||||
/*XXX assume 802.6 MAC header from fore driver */
|
||||
/*
|
||||
* XXX - assume 802.6 MAC header from Fore driver.
|
||||
* XXX - should we also assume it's not a MAC header
|
||||
* if it begins with 0xfe 0xfe 0x03, for RFC 2684
|
||||
* routed NLPID-formatted PDUs?
|
||||
*/
|
||||
if (eflag)
|
||||
printf("%04x%04x %04x%04x ",
|
||||
p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3],
|
||||
|
@ -79,72 +130,7 @@ atm_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
|||
length -= 20;
|
||||
caplen -= 20;
|
||||
}
|
||||
ethertype = p[6] << 8 | p[7];
|
||||
if (eflag)
|
||||
printf("%02x %02x %02x %02x-%02x-%02x %04x: ",
|
||||
p[0], p[1], p[2], /* dsap/ssap/ctrl */
|
||||
p[3], p[4], p[5], /* manufacturer's code */
|
||||
ethertype);
|
||||
|
||||
/*
|
||||
* Some printers want to get back at the ethernet addresses,
|
||||
* and/or check that they're not walking off the end of the packet.
|
||||
* Rather than pass them all the way down, we set these globals.
|
||||
*/
|
||||
packetp = p;
|
||||
snapend = p + caplen;
|
||||
|
||||
length -= 8;
|
||||
caplen -= 8;
|
||||
p += 8;
|
||||
|
||||
switch (ethertype) {
|
||||
|
||||
case ETHERTYPE_IP:
|
||||
ip_print(p, length);
|
||||
break;
|
||||
|
||||
#ifdef INET6
|
||||
case ETHERTYPE_IPV6:
|
||||
ip6_print(p, length);
|
||||
break;
|
||||
#endif /*INET6*/
|
||||
|
||||
/*XXX this probably isn't right */
|
||||
case ETHERTYPE_ARP:
|
||||
case ETHERTYPE_REVARP:
|
||||
arp_print(p, length, caplen);
|
||||
break;
|
||||
#ifdef notyet
|
||||
case ETHERTYPE_DN:
|
||||
decnet_print(p, length, caplen);
|
||||
break;
|
||||
|
||||
case ETHERTYPE_ATALK:
|
||||
if (vflag)
|
||||
fputs("et1 ", stdout);
|
||||
atalk_print(p, length);
|
||||
break;
|
||||
|
||||
case ETHERTYPE_AARP:
|
||||
aarp_print(p, length);
|
||||
break;
|
||||
|
||||
case ETHERTYPE_LAT:
|
||||
case ETHERTYPE_MOPRC:
|
||||
case ETHERTYPE_MOPDL:
|
||||
/* default_print for now */
|
||||
#endif
|
||||
default:
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag)
|
||||
printf("%02x %02x %02x %02x-%02x-%02x %04x: ",
|
||||
packetp[0], packetp[1], packetp[2], /* dsap/ssap/ctrl */
|
||||
packetp[3], packetp[4], packetp[5], /* manufacturer's code */
|
||||
ethertype);
|
||||
if (!xflag && !qflag)
|
||||
default_print(p, caplen);
|
||||
}
|
||||
atm_llc_print(p, length, caplen);
|
||||
if (xflag)
|
||||
default_print(p, caplen);
|
||||
out:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-bgp.c,v 1.3 2002/02/18 09:37:05 itojun Exp $ */
|
||||
/* $NetBSD: print-bgp.c,v 1.4 2002/05/31 09:45:45 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1999 WIDE Project.
|
||||
|
@ -37,9 +37,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.27 2001/10/18 09:52:17 itojun Exp";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.29 2002/05/24 17:49:29 hannes Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-bgp.c,v 1.3 2002/02/18 09:37:05 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-bgp.c,v 1.4 2002/05/31 09:45:45 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -201,8 +201,15 @@ static const char *bgpattr_type[] = {
|
|||
sizeof(bgpattr_type)/sizeof(bgpattr_type[0]), (x))
|
||||
|
||||
/* Subsequent address family identifier, RFC2283 section 7 */
|
||||
#define SAFNUM_RES 0
|
||||
#define SAFNUM_UNICAST 1
|
||||
#define SAFNUM_MULTICAST 2
|
||||
#define SAFNUM_UNIMULTICAST 3
|
||||
/* labeled BGP RFC3107 */
|
||||
#define SAFNUM_LABUNICAST 4
|
||||
|
||||
static const char *bgpattr_nlri_safi[] = {
|
||||
"Reserved", "Unicast", "Multicast", "Unicast+Multicast",
|
||||
"Reserved", "Unicast", "Multicast", "Unicast+Multicast", "labeled Unicast"
|
||||
};
|
||||
#define bgp_attr_nlri_safi(x) \
|
||||
num_or_str(bgpattr_nlri_safi, \
|
||||
|
@ -299,6 +306,43 @@ decode_prefix4(const u_char *pd, char *buf, u_int buflen)
|
|||
return 1 + (plen + 7) / 8;
|
||||
}
|
||||
|
||||
static int
|
||||
decode_labeled_prefix4(const u_char *pd, char *buf, u_int buflen)
|
||||
{
|
||||
struct in_addr addr;
|
||||
u_int plen;
|
||||
|
||||
plen = pd[0]; /* get prefix length */
|
||||
|
||||
/* this is one of the weirdnesses of rfc3107
|
||||
the label length (actually the label + COS bits)
|
||||
is added of the prefix length;
|
||||
we also do only read out just one label -
|
||||
there is no real application for advertisment of
|
||||
stacked labels in a asingle BGP message
|
||||
*/
|
||||
|
||||
plen-=24; /* adjust prefixlen - labellength */
|
||||
|
||||
if (plen < 0 || 32 < plen)
|
||||
return -1;
|
||||
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
memcpy(&addr, &pd[4], (plen + 7) / 8);
|
||||
if (plen % 8) {
|
||||
((u_char *)&addr)[(plen + 7) / 8 - 1] &=
|
||||
((0xff00 >> (plen % 8)) & 0xff);
|
||||
}
|
||||
/* the label may get offsetted by 4 bits so lets shift it right */
|
||||
snprintf(buf, buflen, "%s/%d label:%u %s",
|
||||
getname((u_char *)&addr),
|
||||
plen,
|
||||
EXTRACT_24BITS(pd+1)>>4,
|
||||
((pd[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" );
|
||||
|
||||
return 4 + (plen + 7) / 8;
|
||||
}
|
||||
|
||||
#ifdef INET6
|
||||
static int
|
||||
decode_prefix6(const u_char *pd, char *buf, u_int buflen)
|
||||
|
@ -420,7 +464,7 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *dat, int len)
|
|||
if (safi >= 128)
|
||||
printf(" %s vendor specific,", af_name(af));
|
||||
else {
|
||||
printf(" %s %s,", af_name(af),
|
||||
printf(" AFI %s SAFI %s,", af_name(af),
|
||||
bgp_attr_nlri_safi(safi));
|
||||
}
|
||||
p += 3;
|
||||
|
@ -469,26 +513,34 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *dat, int len)
|
|||
p += p[0] + 1;
|
||||
}
|
||||
printf(",");
|
||||
}
|
||||
} else {
|
||||
printf(" no spna,");
|
||||
}
|
||||
|
||||
printf(" NLRI");
|
||||
while (len - (p - dat) > 0) {
|
||||
switch (af) {
|
||||
case AFNUM_INET:
|
||||
if(safi==SAFNUM_LABUNICAST) {
|
||||
advance = decode_labeled_prefix4(p, buf, sizeof(buf));
|
||||
} else {
|
||||
advance = decode_prefix4(p, buf, sizeof(buf));
|
||||
printf(" %s", buf);
|
||||
break;
|
||||
}
|
||||
if (advance<0)
|
||||
break;
|
||||
printf(" %s", buf);
|
||||
break;
|
||||
#ifdef INET6
|
||||
case AFNUM_INET6:
|
||||
advance = decode_prefix6(p, buf, sizeof(buf));
|
||||
printf(" %s", buf);
|
||||
break;
|
||||
advance = decode_prefix6(p, buf, sizeof(buf));
|
||||
printf(" %s", buf);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
printf(" (unknown af)");
|
||||
advance = 0;
|
||||
p = dat + len;
|
||||
break;
|
||||
printf(" (unknown af)");
|
||||
advance = 0;
|
||||
p = dat + len;
|
||||
break;
|
||||
}
|
||||
|
||||
p += advance;
|
||||
|
@ -502,7 +554,7 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *dat, int len)
|
|||
if (safi >= 128)
|
||||
printf(" %s vendor specific,", af_name(af));
|
||||
else {
|
||||
printf(" %s %s,", af_name(af),
|
||||
printf(" AFI %s SAFI %s,", af_name(af),
|
||||
bgp_attr_nlri_safi(safi));
|
||||
}
|
||||
p += 3;
|
||||
|
@ -511,9 +563,15 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *dat, int len)
|
|||
while (len - (p - dat) > 0) {
|
||||
switch (af) {
|
||||
case AFNUM_INET:
|
||||
if(safi==SAFNUM_LABUNICAST) {
|
||||
advance = decode_labeled_prefix4(p, buf, sizeof(buf));
|
||||
} else {
|
||||
advance = decode_prefix4(p, buf, sizeof(buf));
|
||||
printf(" %s", buf);
|
||||
break;
|
||||
}
|
||||
if (advance<0)
|
||||
break;
|
||||
printf(" %s", buf);
|
||||
break;
|
||||
#ifdef INET6
|
||||
case AFNUM_INET6:
|
||||
advance = decode_prefix6(p, buf, sizeof(buf));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-bootp.c,v 1.3 2002/02/18 09:37:05 itojun Exp $ */
|
||||
/* $NetBSD: print-bootp.c,v 1.4 2002/05/31 09:45:45 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
|
||||
|
@ -26,9 +26,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.60 2001/09/17 21:57:56 fenner Exp (LBL)";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.61 2002/04/26 04:59:08 guy Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-bootp.c,v 1.3 2002/02/18 09:37:05 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-bootp.c,v 1.4 2002/05/31 09:45:45 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -356,13 +356,14 @@ static struct tok arp2str[] = {
|
|||
static void
|
||||
rfc1048_print(register const u_char *bp)
|
||||
{
|
||||
register u_char tag;
|
||||
register u_int16_t tag;
|
||||
register u_int len, size;
|
||||
register const char *cp;
|
||||
register char c;
|
||||
int first;
|
||||
u_int32_t ul;
|
||||
u_short us;
|
||||
u_int16_t us;
|
||||
u_int8_t uc;
|
||||
|
||||
printf(" vend-rfc1048");
|
||||
|
||||
|
@ -383,9 +384,9 @@ rfc1048_print(register const u_char *bp)
|
|||
* preclude overlap of 1-byte and 2-byte spaces.
|
||||
* If not, we need to offset tag after this step.
|
||||
*/
|
||||
cp = tok2str(xtag2str, "?xT%d", tag);
|
||||
cp = tok2str(xtag2str, "?xT%u", tag);
|
||||
} else
|
||||
cp = tok2str(tag2str, "?T%d", tag);
|
||||
cp = tok2str(tag2str, "?T%u", tag);
|
||||
c = *cp++;
|
||||
printf(" %s:", cp);
|
||||
|
||||
|
@ -401,8 +402,8 @@ rfc1048_print(register const u_char *bp)
|
|||
}
|
||||
|
||||
if (tag == TAG_DHCP_MESSAGE && len == 1) {
|
||||
c = *bp++;
|
||||
switch (c) {
|
||||
uc = *bp++;
|
||||
switch (uc) {
|
||||
case DHCPDISCOVER: printf("DISCOVER"); break;
|
||||
case DHCPOFFER: printf("OFFER"); break;
|
||||
case DHCPREQUEST: printf("REQUEST"); break;
|
||||
|
@ -411,7 +412,7 @@ rfc1048_print(register const u_char *bp)
|
|||
case DHCPNAK: printf("NACK"); break;
|
||||
case DHCPRELEASE: printf("RELEASE"); break;
|
||||
case DHCPINFORM: printf("INFORM"); break;
|
||||
default: printf("%u", c); break;
|
||||
default: printf("%u", uc); break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -419,8 +420,8 @@ rfc1048_print(register const u_char *bp)
|
|||
if (tag == TAG_PARM_REQUEST) {
|
||||
first = 1;
|
||||
while (len-- > 0) {
|
||||
c = *bp++;
|
||||
cp = tok2str(tag2str, "?T%d", c);
|
||||
uc = *bp++;
|
||||
cp = tok2str(tag2str, "?T%u", uc);
|
||||
if (!first)
|
||||
putchar('+');
|
||||
printf("%s", cp + 1);
|
||||
|
@ -432,9 +433,9 @@ rfc1048_print(register const u_char *bp)
|
|||
first = 1;
|
||||
while (len > 1) {
|
||||
len -= 2;
|
||||
c = EXTRACT_16BITS(bp);
|
||||
us = EXTRACT_16BITS(bp);
|
||||
bp += 2;
|
||||
cp = tok2str(xtag2str, "?xT%d", c);
|
||||
cp = tok2str(xtag2str, "?xT%u", us);
|
||||
if (!first)
|
||||
putchar('+');
|
||||
printf("%s", cp + 1);
|
||||
|
@ -509,7 +510,7 @@ rfc1048_print(register const u_char *bp)
|
|||
if (!first)
|
||||
putchar(',');
|
||||
us = EXTRACT_16BITS(bp);
|
||||
printf("%d", us);
|
||||
printf("%u", us);
|
||||
bp += sizeof(us);
|
||||
size -= sizeof(us);
|
||||
first = 0;
|
||||
|
@ -529,7 +530,7 @@ rfc1048_print(register const u_char *bp)
|
|||
putchar('Y');
|
||||
break;
|
||||
default:
|
||||
printf("%d?", *bp);
|
||||
printf("%u?", *bp);
|
||||
break;
|
||||
}
|
||||
++bp;
|
||||
|
@ -548,7 +549,7 @@ rfc1048_print(register const u_char *bp)
|
|||
if (c == 'x')
|
||||
printf("%02x", *bp);
|
||||
else
|
||||
printf("%d", *bp);
|
||||
printf("%u", *bp);
|
||||
++bp;
|
||||
--size;
|
||||
first = 0;
|
||||
|
@ -575,7 +576,7 @@ rfc1048_print(register const u_char *bp)
|
|||
if (*bp++)
|
||||
printf("[svrreg]");
|
||||
if (*bp)
|
||||
printf("%d/%d/", *bp, *(bp+1));
|
||||
printf("%u/%u/", *bp, *(bp+1));
|
||||
bp += 2;
|
||||
putchar('"');
|
||||
(void)fn_printn(bp, size - 3, NULL);
|
||||
|
@ -607,7 +608,7 @@ rfc1048_print(register const u_char *bp)
|
|||
}
|
||||
|
||||
default:
|
||||
printf("[unknown special tag %d, size %d]",
|
||||
printf("[unknown special tag %u, size %u]",
|
||||
tag, size);
|
||||
bp += size;
|
||||
size = 0;
|
||||
|
@ -617,7 +618,7 @@ rfc1048_print(register const u_char *bp)
|
|||
}
|
||||
/* Data left over? */
|
||||
if (size)
|
||||
printf("[len %d]", len);
|
||||
printf("[len %u]", len);
|
||||
}
|
||||
return;
|
||||
trunc:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-cdp.c,v 1.3 2002/02/18 09:37:06 itojun Exp $ */
|
||||
/* $NetBSD: print-cdp.c,v 1.4 2002/05/31 09:45:45 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993, 1994, 1995, 1996, 1997
|
||||
|
@ -30,9 +30,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-cdp.c,v 1.11 2001/09/17 21:57:56 fenner Exp";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-cdp.c,v 1.13 2002/04/26 09:51:34 guy Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-cdp.c,v 1.3 2002/02/18 09:37:06 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-cdp.c,v 1.4 2002/05/31 09:45:45 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -56,6 +56,7 @@ __RCSID("$NetBSD: print-cdp.c,v 1.3 2002/02/18 09:37:06 itojun Exp $");
|
|||
|
||||
static int cdp_print_addr(const u_char *, int);
|
||||
static int cdp_print_prefixes(const u_char *, int);
|
||||
static unsigned long cdp_get_number(const u_char *, int);
|
||||
|
||||
void
|
||||
cdp_print(const u_char *p, u_int length, u_int caplen,
|
||||
|
@ -121,17 +122,56 @@ cdp_print(const u_char *p, u_int length, u_int caplen,
|
|||
if (cdp_print_prefixes(p + i + 4, len - 4) < 0)
|
||||
goto trunc;
|
||||
break;
|
||||
case 0x08: /* guess - not documented */
|
||||
printf(" Protocol-Hello option" );
|
||||
break;
|
||||
case 0x09: /* guess - not documented */
|
||||
printf(" VTP Management Domain: '%.*s'", len - 4,
|
||||
p + i + 4);
|
||||
break;
|
||||
case 0x0a: /* guess - not documented */
|
||||
printf(" Native VLAN ID: %d",
|
||||
(p[i + 4] << 8) + p[i + 4 + 1] - 1);
|
||||
(p[i + 4] << 8) + p[i + 4 + 1] );
|
||||
break;
|
||||
case 0x0b: /* guess - not documented */
|
||||
printf(" Duplex: %s", p[i + 4] ? "full": "half");
|
||||
break;
|
||||
/* http://www.cisco.com/univercd/cc/td/doc/product/voice/ata/atarn/186rn21m.htm
|
||||
* plus more details from other sources
|
||||
*/
|
||||
case 0x0e: /* incomplete doc. */
|
||||
printf(" ATA-186 VoIP VLAN request, app %d, vlan %d",
|
||||
p[i + 4], EXTRACT_16BITS(&p[i+4+1]));
|
||||
break;
|
||||
case 0x0f: /* incomplete doc. */
|
||||
printf(" ATA-186 VoIP VLAN assignment" );
|
||||
break;
|
||||
case 0x10: /* incomplete doc. */
|
||||
printf(" power consumption: %1.2fW",
|
||||
cdp_get_number(p+i+4, len-4)/1000.0 );
|
||||
break;
|
||||
case 0x11: /* guess - not documented */
|
||||
printf(" MTU %u bytes", EXTRACT_32BITS(&p[i+4]));
|
||||
break;
|
||||
case 0x12: /* guess - not documented */
|
||||
printf(" AVVID trust bitmap 0x%02x", p[i+4] );
|
||||
break;
|
||||
case 0x13: /* guess - not documented */
|
||||
printf(" AVVID untrusted ports CoS: 0x%02x", p[i+4]);
|
||||
break;
|
||||
case 0x14: /* guess - not documented */
|
||||
printf(" sysName='%.*s'", len - 4, p + i + 4 );
|
||||
break;
|
||||
case 0x15: /* guess - not documented */
|
||||
printf(" sysObjectID" ); /* TODO */
|
||||
break;
|
||||
case 0x16: /* guess - not documented */
|
||||
printf(" management address(es)" );
|
||||
break;
|
||||
case 0x17: /* guess - not documented */
|
||||
printf(" phys. location 0x%02x/%.*s",
|
||||
p[i+4], len - 5, p + i + 5 );
|
||||
break;
|
||||
default:
|
||||
printf(" unknown field type %02x, len %d", type, len);
|
||||
break;
|
||||
|
@ -267,3 +307,17 @@ cdp_print_prefixes(const u_char * p, int l)
|
|||
trunc:
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* read in a <n>-byte number, MSB first
|
||||
* (of course this can handle max sizeof(long))
|
||||
*/
|
||||
static unsigned long cdp_get_number(const u_char * p, int l)
|
||||
{
|
||||
unsigned long res=0;
|
||||
while( l>0 )
|
||||
{
|
||||
res = (res<<8) + *p;
|
||||
p++; l--;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-decnet.c,v 1.3 2002/02/18 09:37:06 itojun Exp $ */
|
||||
/* $NetBSD: print-decnet.c,v 1.4 2002/05/31 09:45:45 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993, 1994, 1995, 1996, 1997
|
||||
|
@ -25,9 +25,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-decnet.c,v 1.33 2001/09/17 21:57:59 fenner Exp (LBL)";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-decnet.c,v 1.34 2002/04/07 02:09:05 guy Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-decnet.c,v 1.3 2002/02/18 09:37:06 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-decnet.c,v 1.4 2002/05/31 09:45:45 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -42,7 +42,7 @@ __RCSID("$NetBSD: print-decnet.c,v 1.3 2002/02/18 09:37:06 itojun Exp $");
|
|||
struct mbuf;
|
||||
struct rtentry;
|
||||
|
||||
#ifdef HAVE_LIBDNET
|
||||
#ifdef HAVE_NETDNET_DNETDB_H
|
||||
#include <netdnet/dnetdb.h>
|
||||
#endif
|
||||
|
||||
|
@ -70,7 +70,7 @@ static void print_reason(int);
|
|||
static void pdata(u_char *, int);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBDNET
|
||||
#ifndef HAVE_NETDNET_DNETDB_H_DNET_HTOA
|
||||
extern char *dnet_htoa(struct dn_naddr *);
|
||||
#endif
|
||||
|
||||
|
@ -755,7 +755,7 @@ dnnum_string(u_short dnaddr)
|
|||
const char *
|
||||
dnname_string(u_short dnaddr)
|
||||
{
|
||||
#ifdef HAVE_LIBDNET
|
||||
#ifdef HAVE_DNET_HTOA
|
||||
struct dn_naddr dna;
|
||||
|
||||
dna.a_len = sizeof(short);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-dhcp6.c,v 1.3 2002/02/18 09:37:06 itojun Exp $ */
|
||||
/* $NetBSD: print-dhcp6.c,v 1.4 2002/05/31 09:45:45 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1998 and 1999 WIDE Project.
|
||||
|
@ -28,14 +28,17 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
/*
|
||||
* draft-ietf-dhc-dhcpv6-22.txt
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-dhcp6.c,v 1.14 2001/09/17 21:57:59 fenner Exp";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-dhcp6.c,v 1.16 2002/01/19 08:05:54 guy Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-dhcp6.c,v 1.3 2002/02/18 09:37:06 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-dhcp6.c,v 1.4 2002/05/31 09:45:45 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -59,172 +62,125 @@ struct rtentry;
|
|||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "dhcp6.h"
|
||||
#include "dhcp6opt.h"
|
||||
|
||||
#if 0
|
||||
static void dhcp6opttab_init(void);
|
||||
static struct dhcp6_opt *dhcp6opttab_byname(char *);
|
||||
#endif
|
||||
static struct dhcp6_opt *dhcp6opttab_bycode(u_int);
|
||||
/* Error Values */
|
||||
#define DH6ERR_FAILURE 16
|
||||
#define DH6ERR_AUTHFAIL 17
|
||||
#define DH6ERR_POORLYFORMED 18
|
||||
#define DH6ERR_UNAVAIL 19
|
||||
#define DH6ERR_OPTUNAVAIL 20
|
||||
|
||||
static const char tstr[] = " [|dhcp6]";
|
||||
/* Message type */
|
||||
#define DH6_REPLY 7
|
||||
#define DH6_INFORM_REQ 11
|
||||
|
||||
static struct dhcp6_opt dh6opttab[] = {
|
||||
/* IP Address Extension */
|
||||
{ 1, OL6_N, "IP Address", OT6_NONE, },
|
||||
/* DHCP6 base packet format */
|
||||
struct dhcp6 {
|
||||
union {
|
||||
u_int8_t m;
|
||||
u_int32_t x;
|
||||
} dh6_msgtypexid;
|
||||
struct in6_addr dh6_servaddr;
|
||||
/* options follow */
|
||||
} __attribute__ ((__packed__));
|
||||
#define dh6_msgtype dh6_msgtypexid.m
|
||||
#define dh6_xid dh6_msgtypexid.x
|
||||
#define DH6_XIDMASK 0x00ffffff
|
||||
|
||||
/* General Extension */
|
||||
{ 8193, OL6_N, "IEEE 1003.1 POSIX Timezone", OT6_STR, },
|
||||
{ 8194, OL6_16N, "Domain Name Server", OT6_V6, },
|
||||
{ 8195, OL6_N, "Domain Name", OT6_STR, },
|
||||
|
||||
{ 8196, OL6_N, "SLP Agent", OT6_NONE, },
|
||||
{ 8197, OL6_N, "SLP Scope" , OT6_NONE, },
|
||||
{ 8198, OL6_16N, "Network Time Protocol Servers", OT6_V6, },
|
||||
{ 8199, OL6_N, "NIS Domain", OT6_STR, },
|
||||
{ 8200, OL6_16N, "NIS Servers", OT6_V6, },
|
||||
{ 8201, OL6_N, "NIS+ Domain", OT6_STR, },
|
||||
{ 8202, OL6_16N, "NIS+ Servers", OT6_V6, },
|
||||
|
||||
/* TCP Parameters */
|
||||
{ 8203, 4, "TCP Keepalive Interval", OT6_NUM, },
|
||||
|
||||
/* DHCPv6 Extensions */
|
||||
{ 8204, 4, "Maximum DHCPv6 Message Size", OT6_NUM, },
|
||||
{ 8205, OL6_N, "DHCP Retransmission and Configuration Parameter",
|
||||
OT6_NONE, },
|
||||
{ 8206, OL6_N, "Extension Request", OT6_NONE, },
|
||||
{ 8207, OL6_N, "Subnet Prefix", OT6_NONE, },
|
||||
{ 8208, OL6_N, "Platform Specific Information", OT6_NONE, },
|
||||
{ 8209, OL6_N, "Platform Class Identifier", OT6_STR, },
|
||||
{ 8210, OL6_N, "Class Identifier", OT6_STR, },
|
||||
{ 8211, 16, "Reconfigure Multicast Address", OT6_V6, },
|
||||
{ 8212, 16, "Renumber DHCPv6 Server Address",
|
||||
OT6_V6, },
|
||||
{ 8213, OL6_N, "Client-Server Authentication", OT6_NONE, },
|
||||
{ 8214, 4, "Client Key Selection", OT6_NUM, },
|
||||
|
||||
/* End Extension */
|
||||
{ 65536, OL6_Z, "End", OT6_NONE, },
|
||||
|
||||
{ 0 },
|
||||
};
|
||||
|
||||
#if 0
|
||||
static struct dhcp6_opt *dh6o_pad;
|
||||
static struct dhcp6_opt *dh6o_end;
|
||||
/* option */
|
||||
#define DH6OPT_DUID 1 /* TBD */
|
||||
#define DH6OPT_DNS 11 /* TBD */
|
||||
struct dhcp6opt {
|
||||
u_int16_t dh6opt_type;
|
||||
u_int16_t dh6opt_len;
|
||||
/* type-dependent data follows */
|
||||
} __attribute__ ((__packed__));
|
||||
|
||||
static void
|
||||
dhcp6opttab_init()
|
||||
dhcp6opt_print(u_char *cp, u_char *ep)
|
||||
{
|
||||
dh6o_pad = dhcp6opttab_bycode(0);
|
||||
dh6o_end = dhcp6opttab_bycode(65536);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
static struct dhcp6_opt *
|
||||
dhcp6opttab_byname(name)
|
||||
char *name;
|
||||
{
|
||||
struct dhcp6_opt *p;
|
||||
|
||||
for (p = dh6opttab; p->code; p++)
|
||||
if (strcmp(name, p->name) == 0)
|
||||
return p;
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct dhcp6_opt *
|
||||
dhcp6opttab_bycode(code)
|
||||
u_int code;
|
||||
{
|
||||
struct dhcp6_opt *p;
|
||||
|
||||
for (p = dh6opttab; p->code; p++)
|
||||
if (p->code == code)
|
||||
return p;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
dhcp6ext_print(u_char *cp, u_char *ep)
|
||||
{
|
||||
u_int16_t code, len;
|
||||
struct dhcp6_opt *p;
|
||||
char buf[BUFSIZ];
|
||||
struct dhcp6opt *dh6o;
|
||||
u_char *tp;
|
||||
int i;
|
||||
size_t optlen;
|
||||
|
||||
if (cp == ep)
|
||||
return;
|
||||
while (cp < ep) {
|
||||
if (ep - cp < sizeof(u_int16_t))
|
||||
break;
|
||||
code = ntohs(*(u_int16_t *)&cp[0]);
|
||||
if (ep - cp < sizeof(u_int16_t) * 2)
|
||||
break;
|
||||
if (code != 65535)
|
||||
len = ntohs(*(u_int16_t *)&cp[2]);
|
||||
else
|
||||
len = 0;
|
||||
if (ep - cp < len + 4)
|
||||
break;
|
||||
p = dhcp6opttab_bycode(code);
|
||||
if (p == NULL) {
|
||||
printf("(unknown, len=%d)", len);
|
||||
cp += len + 4;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* sanity check on length */
|
||||
switch (p->len) {
|
||||
case OL6_N:
|
||||
break;
|
||||
case OL6_16N:
|
||||
if (len % 16 != 0)
|
||||
goto trunc;
|
||||
break;
|
||||
case OL6_Z:
|
||||
if (len != 0)
|
||||
goto trunc;
|
||||
break;
|
||||
default:
|
||||
if (len != p->len)
|
||||
goto trunc;
|
||||
break;
|
||||
}
|
||||
if (cp + 4 + len > ep) {
|
||||
printf(" [|%s]", p->name);
|
||||
return;
|
||||
}
|
||||
|
||||
printf(" (%s, ", p->name);
|
||||
switch (p->type) {
|
||||
case OT6_V6:
|
||||
for (i = 0; i < len; i += 16) {
|
||||
inet_ntop(AF_INET6, &cp[4 + i], buf,
|
||||
sizeof(buf));
|
||||
if (i != 0)
|
||||
printf(",");
|
||||
printf("%s", buf);
|
||||
if (ep - cp < sizeof(*dh6o))
|
||||
goto trunc;
|
||||
dh6o = (struct dhcp6opt *)cp;
|
||||
optlen = ntohs(dh6o->dh6opt_len);
|
||||
if (ep - cp < sizeof(*dh6o) + optlen)
|
||||
goto trunc;
|
||||
switch (ntohs(dh6o->dh6opt_type)) {
|
||||
case DH6OPT_DUID:
|
||||
printf(" (duid"); /*)*/
|
||||
if (optlen < 2) {
|
||||
/*(*/
|
||||
printf(" ??)");
|
||||
break;
|
||||
}
|
||||
tp = (u_char *)(dh6o + 1);
|
||||
switch (ntohs(*(u_int16_t *)tp)) {
|
||||
case 1:
|
||||
if (optlen >= 2 + 6) {
|
||||
printf(" hwaddr/time time %u type %u ",
|
||||
ntohl(*(u_int32_t *)&tp[2]),
|
||||
ntohs(*(u_int16_t *)&tp[6]));
|
||||
for (i = 8; i < optlen; i++)
|
||||
printf("%02x", tp[i]);
|
||||
/*(*/
|
||||
printf(")");
|
||||
} else {
|
||||
/*(*/
|
||||
printf(" ??)");
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (optlen >= 2 + 8) {
|
||||
printf(" vid ");
|
||||
for (i = 2; i < 2 + 8; i++)
|
||||
printf("%02x", tp[i]);
|
||||
/*(*/
|
||||
printf(")");
|
||||
} else {
|
||||
/*(*/
|
||||
printf(" ??)");
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (optlen >= 2 + 2) {
|
||||
printf(" hwaddr type %u ",
|
||||
ntohs(*(u_int16_t *)&tp[2]));
|
||||
for (i = 4; i < optlen; i++)
|
||||
printf("%02x", tp[i]);
|
||||
/*(*/
|
||||
printf(")");
|
||||
} else {
|
||||
/*(*/
|
||||
printf(" ??)");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OT6_STR:
|
||||
memset(&buf, 0, sizeof(buf));
|
||||
strncpy(buf, &cp[4], len);
|
||||
printf("%s", buf);
|
||||
break;
|
||||
case OT6_NUM:
|
||||
printf("%d", (u_int32_t)ntohl(*(u_int32_t *)&cp[4]));
|
||||
break;
|
||||
case DH6OPT_DNS:
|
||||
printf(" (dnsserver"); /*)*/
|
||||
if (optlen % 16) {
|
||||
/*(*/
|
||||
printf(" ??)");
|
||||
break;
|
||||
}
|
||||
tp = (u_char *)(dh6o + 1);
|
||||
for (i = 0; i < optlen; i += 16)
|
||||
printf(" %s", ip6addr_string(&tp[i]));
|
||||
/*(*/
|
||||
printf(")");
|
||||
default:
|
||||
for (i = 0; i < len; i++)
|
||||
printf("%02x", cp[4 + i] & 0xff);
|
||||
printf(" (opt-%u)", ntohs(dh6o->dh6opt_type));
|
||||
break;
|
||||
}
|
||||
printf(")");
|
||||
cp += len + 4;
|
||||
|
||||
cp += sizeof(*dh6o) + optlen;
|
||||
}
|
||||
return;
|
||||
|
||||
|
@ -233,128 +189,57 @@ trunc:
|
|||
}
|
||||
|
||||
/*
|
||||
* Print dhcp6 requests
|
||||
* Print dhcp6 packets
|
||||
*/
|
||||
void
|
||||
dhcp6_print(register const u_char *cp, u_int length,
|
||||
u_int16_t sport, u_int16_t dport)
|
||||
{
|
||||
union dhcp6 *dh6;
|
||||
struct dhcp6 *dh6;
|
||||
u_char *ep;
|
||||
u_char *extp;
|
||||
u_int16_t field16;
|
||||
const char *name;
|
||||
|
||||
printf("dhcp6");
|
||||
|
||||
ep = (u_char *)snapend;
|
||||
|
||||
dh6 = (union dhcp6 *)cp;
|
||||
TCHECK(dh6->dh6_msgtype);
|
||||
dh6 = (struct dhcp6 *)cp;
|
||||
TCHECK(dh6->dh6_servaddr);
|
||||
switch (dh6->dh6_msgtype) {
|
||||
case DH6_SOLICIT:
|
||||
if (!(vflag && TTEST(dh6->dh6_sol.dh6sol_relayaddr))) {
|
||||
printf(" solicit");
|
||||
break;
|
||||
}
|
||||
|
||||
printf(" solicit ("); /*)*/
|
||||
if (dh6->dh6_sol.dh6sol_flags != 0) {
|
||||
u_int8_t f = dh6->dh6_sol.dh6sol_flags;
|
||||
printf("%s%s ",
|
||||
(f & DH6SOL_PREFIX) ? "P" : "",
|
||||
(f & DH6SOL_CLOSE) ? "C" : "");
|
||||
}
|
||||
|
||||
memcpy(&field16, &dh6->dh6_sol.dh6sol_plen_id,
|
||||
sizeof(field16));
|
||||
field16 = ntohs(field16);
|
||||
if (field16 & ~DH6SOL_SOLICIT_PLEN_MASK)
|
||||
printf("plen=%d ", DH6SOL_SOLICIT_PLEN(field16));
|
||||
printf("solicit-ID=%d", DH6SOL_SOLICIT_ID(field16));
|
||||
|
||||
printf(" cliaddr=%s",
|
||||
ip6addr_string(&dh6->dh6_sol.dh6sol_cliaddr));
|
||||
printf(" relayaddr=%s",
|
||||
ip6addr_string(&dh6->dh6_sol.dh6sol_relayaddr));
|
||||
/*(*/
|
||||
printf(")");
|
||||
break;
|
||||
case DH6_ADVERT:
|
||||
if (!(vflag && TTEST(dh6->dh6_adv.dh6adv_serveraddr))) {
|
||||
printf(" advert");
|
||||
break;
|
||||
}
|
||||
printf(" advert ("); /*)*/
|
||||
memcpy(&field16, &dh6->dh6_adv.dh6adv_rsv_id, sizeof(field16));
|
||||
printf("solicit-ID=%d",
|
||||
ntohs(field16) & DH6SOL_SOLICIT_ID_MASK);
|
||||
printf(" pref=%u", dh6->dh6_adv.dh6adv_pref);
|
||||
printf(" cliaddr=%s",
|
||||
ip6addr_string(&dh6->dh6_adv.dh6adv_cliaddr));
|
||||
printf(" relayaddr=%s",
|
||||
ip6addr_string(&dh6->dh6_adv.dh6adv_relayaddr));
|
||||
printf(" servaddr=%s",
|
||||
ip6addr_string(&dh6->dh6_adv.dh6adv_serveraddr));
|
||||
extp = (u_char *)((&dh6->dh6_adv) + 1);
|
||||
dhcp6ext_print(extp, ep);
|
||||
/*(*/
|
||||
printf(")");
|
||||
break;
|
||||
case DH6_REQUEST:
|
||||
if (!(vflag && TTEST(dh6->dh6_req.dh6req_relayaddr))) {
|
||||
printf(" request");
|
||||
break;
|
||||
}
|
||||
printf(" request ("); /*)*/
|
||||
if (dh6->dh6_req.dh6req_flags != 0) {
|
||||
u_int8_t f = dh6->dh6_req.dh6req_flags;
|
||||
printf("%s%s ",
|
||||
(f & DH6REQ_CLOSE) ? "C" : "",
|
||||
(f & DH6REQ_REBOOT) ? "R" : "");
|
||||
}
|
||||
printf("xid=0x%04x", dh6->dh6_req.dh6req_xid);
|
||||
printf(" cliaddr=%s",
|
||||
ip6addr_string(&dh6->dh6_req.dh6req_cliaddr));
|
||||
printf(" relayaddr=%s",
|
||||
ip6addr_string(&dh6->dh6_req.dh6req_relayaddr));
|
||||
printf(" servaddr=%s",
|
||||
ip6addr_string(&dh6->dh6_req.dh6req_serveraddr));
|
||||
dhcp6ext_print((char *)(&dh6->dh6_req + 1), ep);
|
||||
/*(*/
|
||||
printf(")");
|
||||
break;
|
||||
case DH6_REPLY:
|
||||
if (!(vflag && TTEST(dh6->dh6_rep.dh6rep_xid))) {
|
||||
printf(" reply");
|
||||
break;
|
||||
}
|
||||
printf(" reply ("); /*)*/
|
||||
if ((dh6->dh6_rep.dh6rep_flagandstat & DH6REP_RELAYPRESENT) != 0)
|
||||
printf("R ");
|
||||
printf("stat=0x%02x",
|
||||
dh6->dh6_rep.dh6rep_flagandstat & DH6REP_STATMASK);
|
||||
printf(" xid=0x%04x", dh6->dh6_rep.dh6rep_xid);
|
||||
printf(" cliaddr=%s",
|
||||
ip6addr_string(&dh6->dh6_rep.dh6rep_cliaddr));
|
||||
extp = (u_char *)((&dh6->dh6_rep) + 1);
|
||||
if ((dh6->dh6_rep.dh6rep_flagandstat & DH6REP_RELAYPRESENT) !=
|
||||
0) {
|
||||
printf(" relayaddr=%s", ip6addr_string(extp));
|
||||
extp += sizeof(struct in6_addr);
|
||||
}
|
||||
dhcp6ext_print(extp, ep);
|
||||
/*(*/
|
||||
printf(")");
|
||||
name = "reply";
|
||||
break;
|
||||
case DH6_RELEASE:
|
||||
printf(" release");
|
||||
case DH6_INFORM_REQ:
|
||||
name= "inf-req";
|
||||
break;
|
||||
case DH6_RECONFIG:
|
||||
printf(" reconfig");
|
||||
default:
|
||||
name = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!vflag) {
|
||||
if (name)
|
||||
printf(" %s", name);
|
||||
else
|
||||
printf(" msgtype-%u", dh6->dh6_msgtype);
|
||||
return;
|
||||
}
|
||||
|
||||
/* XXX relay agent messages have to be handled differently */
|
||||
|
||||
if (name)
|
||||
printf(" %s (", name); /*)*/
|
||||
else
|
||||
printf(" msgtype-%u (", dh6->dh6_msgtype); /*)*/
|
||||
printf("xid=%x", ntohl(dh6->dh6_xid) & DH6_XIDMASK);
|
||||
printf(" server=%s", ip6addr_string(&dh6->dh6_servaddr));
|
||||
extp = (u_char *)(dh6 + 1);
|
||||
dhcp6opt_print(extp, ep);
|
||||
/*(*/
|
||||
printf(")");
|
||||
return;
|
||||
|
||||
trunc:
|
||||
printf("%s", tstr);
|
||||
printf("[|dhcp6]");
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-esp.c,v 1.3 2002/02/18 09:37:06 itojun Exp $ */
|
||||
/* $NetBSD: print-esp.c,v 1.4 2002/05/31 09:45:45 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994
|
||||
|
@ -25,9 +25,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-esp.c,v 1.20 2002/01/21 11:39:59 mcr Exp (LBL)";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-esp.c,v 1.24 2002/04/07 02:16:03 guy Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-esp.c,v 1.3 2002/02/18 09:37:06 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-esp.c,v 1.4 2002/05/31 09:45:45 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -47,10 +47,10 @@ __RCSID("$NetBSD: print-esp.c,v 1.3 2002/02/18 09:37:06 itojun Exp $");
|
|||
#ifdef HAVE_LIBCRYPTO
|
||||
#include <openssl/des.h>
|
||||
#include <openssl/blowfish.h>
|
||||
#ifdef HAVE_RC5_H
|
||||
#ifdef HAVE_OPENSSL_RC5_H
|
||||
#include <openssl/rc5.h>
|
||||
#endif
|
||||
#ifdef HAVE_CAST_H
|
||||
#ifdef HAVE_OPENSSL_CAST_H
|
||||
#include <openssl/cast.h>
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-ether.c,v 1.4 2002/02/18 09:37:06 itojun Exp $ */
|
||||
/* $NetBSD: print-ether.c,v 1.5 2002/05/31 09:45:45 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000
|
||||
|
@ -24,9 +24,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-ether.c,v 1.65 2001/07/04 22:03:14 fenner Exp (LBL)";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-ether.c,v 1.68 2002/05/29 10:06:26 guy Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-ether.c,v 1.4 2002/02/18 09:37:06 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-ether.c,v 1.5 2002/05/31 09:45:45 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -56,7 +56,7 @@ const u_char *packetp;
|
|||
const u_char *snapend;
|
||||
|
||||
static inline void
|
||||
ether_print(register const u_char *bp, u_int length)
|
||||
ether_hdr_print(register const u_char *bp, u_int length)
|
||||
{
|
||||
register const struct ether_header *ep;
|
||||
|
||||
|
@ -74,31 +74,20 @@ ether_print(register const u_char *bp, u_int length)
|
|||
length);
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the top level routine of the printer. 'p' is the points
|
||||
* to the ether header of the packet, 'h->tv' is the timestamp,
|
||||
* 'h->length' is the length of the packet off the wire, and 'h->caplen'
|
||||
* is the number of bytes actually captured.
|
||||
*/
|
||||
void
|
||||
ether_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
ether_print(const u_char *p, u_int length, u_int caplen)
|
||||
{
|
||||
u_int caplen = h->caplen;
|
||||
u_int length = h->len;
|
||||
struct ether_header *ep;
|
||||
u_short ether_type;
|
||||
u_short extracted_ethertype;
|
||||
|
||||
++infodelay;
|
||||
ts_print(&h->ts);
|
||||
|
||||
if (caplen < ETHER_HDRLEN) {
|
||||
printf("[|ether]");
|
||||
goto out;
|
||||
return;
|
||||
}
|
||||
|
||||
if (eflag)
|
||||
ether_print(p, length);
|
||||
ether_hdr_print(p, length);
|
||||
|
||||
/*
|
||||
* Some printers want to get back at the ethernet addresses,
|
||||
|
@ -125,7 +114,7 @@ ether_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
|||
&extracted_ethertype) == 0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag)
|
||||
ether_print((u_char *)ep, length + ETHER_HDRLEN);
|
||||
ether_hdr_print((u_char *)ep, length + ETHER_HDRLEN);
|
||||
if (extracted_ethertype) {
|
||||
printf("(LLC %s) ",
|
||||
etherproto_string(htons(extracted_ethertype)));
|
||||
|
@ -137,14 +126,38 @@ ether_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
|||
&extracted_ethertype) == 0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag)
|
||||
ether_print((u_char *)ep, length + ETHER_HDRLEN);
|
||||
ether_hdr_print((u_char *)ep, length + ETHER_HDRLEN);
|
||||
if (!xflag && !qflag)
|
||||
default_print(p, caplen);
|
||||
}
|
||||
if (xflag)
|
||||
default_print(p, caplen);
|
||||
out:
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the top level routine of the printer. 'p' is the points
|
||||
* to the ether header of the packet, 'h->tv' is the timestamp,
|
||||
* 'h->length' is the length of the packet off the wire, and 'h->caplen'
|
||||
* is the number of bytes actually captured.
|
||||
*/
|
||||
void
|
||||
ether_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
{
|
||||
u_int caplen = h->caplen;
|
||||
u_int length = h->len;
|
||||
|
||||
++infodelay;
|
||||
ts_print(&h->ts);
|
||||
|
||||
ether_print(p, length, caplen);
|
||||
|
||||
/*
|
||||
* If "-x" was specified, print stuff past the Ethernet header,
|
||||
* if there's anything to print.
|
||||
*/
|
||||
if (xflag && caplen > ETHER_HDRLEN)
|
||||
default_print(p + ETHER_HDRLEN, caplen - ETHER_HDRLEN);
|
||||
|
||||
putchar('\n');
|
||||
|
||||
--infodelay;
|
||||
if (infoprint)
|
||||
info(0);
|
||||
|
@ -201,6 +214,7 @@ ether_encap_print(u_short ethertype, const u_char *p,
|
|||
return (1);
|
||||
|
||||
case ETHERTYPE_IPX:
|
||||
printf("(NOV-ETHII) ");
|
||||
ipx_print(p, length);
|
||||
return (1);
|
||||
|
||||
|
@ -222,7 +236,7 @@ ether_encap_print(u_short ethertype, const u_char *p,
|
|||
extracted_ethertype) == 0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag)
|
||||
ether_print(p - 18, length + 4);
|
||||
ether_hdr_print(p - 18, length + 4);
|
||||
if (*extracted_ethertype) {
|
||||
printf("(LLC %s) ",
|
||||
etherproto_string(htons(*extracted_ethertype)));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-fddi.c,v 1.3 2002/02/18 09:37:06 itojun Exp $ */
|
||||
/* $NetBSD: print-fddi.c,v 1.4 2002/05/31 09:45:45 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
|
@ -25,9 +25,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.53 2001/11/14 16:46:34 fenner Exp (LBL)";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.55 2002/05/29 10:06:27 guy Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-fddi.c,v 1.3 2002/02/18 09:37:06 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-fddi.c,v 1.4 2002/05/31 09:45:45 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -226,7 +226,7 @@ extract_fddi_addrs(const struct fddi_header *fddip, char *fsrc, char *fdst)
|
|||
* Print the FDDI MAC header
|
||||
*/
|
||||
static inline void
|
||||
fddi_print(register const struct fddi_header *fddip, register u_int length,
|
||||
fddi_hdr_print(register const struct fddi_header *fddip, register u_int length,
|
||||
register const u_char *fsrc, register const u_char *fdst)
|
||||
{
|
||||
const char *srcname, *dstname;
|
||||
|
@ -253,28 +253,16 @@ fddi_smt_print(const u_char *p, u_int length)
|
|||
printf("<SMT printer not yet implemented>");
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the top level routine of the printer. 'sp' is the points
|
||||
* to the FDDI header of the packet, 'tvp' is the timestamp,
|
||||
* 'length' is the length of the packet off the wire, and 'caplen'
|
||||
* is the number of bytes actually captured.
|
||||
*/
|
||||
void
|
||||
fddi_if_print(u_char *pcap, const struct pcap_pkthdr *h,
|
||||
register const u_char *p)
|
||||
fddi_print(const u_char *p, u_int length, u_int caplen)
|
||||
{
|
||||
u_int caplen = h->caplen;
|
||||
u_int length = h->len;
|
||||
const struct fddi_header *fddip = (const struct fddi_header *)p;
|
||||
struct ether_header ehdr;
|
||||
u_short extracted_ethertype;
|
||||
|
||||
++infodelay;
|
||||
ts_print(&h->ts);
|
||||
|
||||
if (caplen < FDDI_HDRLEN) {
|
||||
printf("[|fddi]");
|
||||
goto out;
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* Get the FDDI addresses into a canonical form
|
||||
|
@ -295,7 +283,7 @@ fddi_if_print(u_char *pcap, const struct pcap_pkthdr *h,
|
|||
packetp = (u_char *)&ehdr;
|
||||
|
||||
if (eflag)
|
||||
fddi_print(fddip, length, ESRC(&ehdr), EDST(&ehdr));
|
||||
fddi_hdr_print(fddip, length, ESRC(&ehdr), EDST(&ehdr));
|
||||
|
||||
/* Skip over FDDI MAC header */
|
||||
length -= FDDI_HDRLEN;
|
||||
|
@ -313,7 +301,7 @@ fddi_if_print(u_char *pcap, const struct pcap_pkthdr *h,
|
|||
* handle intelligently
|
||||
*/
|
||||
if (!eflag)
|
||||
fddi_print(fddip, length + FDDI_HDRLEN,
|
||||
fddi_hdr_print(fddip, length + FDDI_HDRLEN,
|
||||
ESRC(&ehdr), EDST(&ehdr));
|
||||
if (extracted_ethertype) {
|
||||
printf("(LLC %s) ",
|
||||
|
@ -327,15 +315,40 @@ fddi_if_print(u_char *pcap, const struct pcap_pkthdr *h,
|
|||
else {
|
||||
/* Some kinds of FDDI packet we cannot handle intelligently */
|
||||
if (!eflag)
|
||||
fddi_print(fddip, length + FDDI_HDRLEN, ESRC(&ehdr),
|
||||
fddi_hdr_print(fddip, length + FDDI_HDRLEN, ESRC(&ehdr),
|
||||
EDST(&ehdr));
|
||||
if (!xflag && !qflag)
|
||||
default_print(p, caplen);
|
||||
}
|
||||
if (xflag)
|
||||
default_print(p, caplen);
|
||||
out:
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the top level routine of the printer. 'sp' is the points
|
||||
* to the FDDI header of the packet, 'tvp' is the timestamp,
|
||||
* 'length' is the length of the packet off the wire, and 'caplen'
|
||||
* is the number of bytes actually captured.
|
||||
*/
|
||||
void
|
||||
fddi_if_print(u_char *pcap, const struct pcap_pkthdr *h,
|
||||
register const u_char *p)
|
||||
{
|
||||
u_int caplen = h->caplen;
|
||||
u_int length = h->len;
|
||||
|
||||
++infodelay;
|
||||
ts_print(&h->ts);
|
||||
|
||||
fddi_print(p, length, caplen);
|
||||
|
||||
/*
|
||||
* If "-x" was specified, print stuff past the FDDI header,
|
||||
* if there's anything to print.
|
||||
*/
|
||||
if (xflag && caplen > FDDI_HDRLEN)
|
||||
default_print(p + FDDI_HDRLEN, caplen - FDDI_HDRLEN);
|
||||
|
||||
putchar('\n');
|
||||
|
||||
--infodelay;
|
||||
if (infoprint)
|
||||
info(0);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-hsrp.c,v 1.2 2002/04/09 02:53:20 thorpej Exp $ */
|
||||
/* $NetBSD: print-hsrp.c,v 1.3 2002/05/31 09:45:45 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001 Julian Cowley
|
||||
|
@ -35,9 +35,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-hsrp.c,v 1.2 2001/10/08 16:12:37 fenner Exp";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-hsrp.c,v 1.3 2002/05/07 18:31:49 fenner Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-hsrp.c,v 1.2 2002/04/09 02:53:20 thorpej Exp $");
|
||||
__RCSID("$NetBSD: print-hsrp.c,v 1.3 2002/05/31 09:45:45 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -126,7 +126,7 @@ hsrp_print(register const u_char *bp, register u_int len)
|
|||
if (hp->hsrp_reserved != 0) {
|
||||
printf("[reserved=%d!] ", hp->hsrp_reserved);
|
||||
}
|
||||
TCHECK2(hp->hsrp_virtaddr, sizeof(hp->hsrp_virtaddr));
|
||||
TCHECK(hp->hsrp_virtaddr);
|
||||
printf("addr=%s", ipaddr_string(&hp->hsrp_virtaddr));
|
||||
if (vflag) {
|
||||
printf(" hellotime=");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-icmp.c,v 1.3 2002/02/18 09:37:06 itojun Exp $ */
|
||||
/* $NetBSD: print-icmp.c,v 1.4 2002/05/31 09:45:45 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994, 1995, 1996
|
||||
|
@ -25,9 +25,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.62 2001/07/24 16:56:11 fenner Exp (LBL)";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.63 2001/10/27 07:21:34 guy Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-icmp.c,v 1.3 2002/02/18 09:37:06 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-icmp.c,v 1.4 2002/05/31 09:45:45 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -292,6 +292,18 @@ icmp_print(const u_char *bp, u_int plen, const u_char *bp2)
|
|||
|
||||
TCHECK(dp->icmp_code);
|
||||
switch (dp->icmp_type) {
|
||||
|
||||
case ICMP_ECHO:
|
||||
TCHECK(dp->icmp_seq);
|
||||
(void)snprintf(buf, sizeof(buf), "echo request seq %u",
|
||||
(unsigned)ntohs(dp->icmp_seq));
|
||||
break;
|
||||
|
||||
case ICMP_ECHOREPLY:
|
||||
TCHECK(dp->icmp_seq);
|
||||
(void)snprintf(buf, sizeof(buf), "echo reply seq %u",
|
||||
(unsigned)ntohs(dp->icmp_seq));
|
||||
break;
|
||||
|
||||
case ICMP_UNREACH:
|
||||
TCHECK(dp->icmp_ip.ip_dst);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-icmp6.c,v 1.4 2002/02/18 09:37:07 itojun Exp $ */
|
||||
/* $NetBSD: print-icmp6.c,v 1.5 2002/05/31 09:45:45 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994
|
||||
|
@ -25,9 +25,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.56 2001/06/27 02:48:43 itojun Exp";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.60 2002/05/30 22:01:34 itojun Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-icmp6.c,v 1.4 2002/02/18 09:37:07 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-icmp6.c,v 1.5 2002/05/31 09:45:45 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -363,6 +363,28 @@ icmp6_print(const u_char *bp, const u_char *bp2)
|
|||
case ICMP6_NI_REPLY:
|
||||
icmp6_nodeinfo_print(icmp6len, bp, ep);
|
||||
break;
|
||||
case ICMP6_HADISCOV_REQUEST:
|
||||
case ICMP6_HADISCOV_REPLY:
|
||||
{
|
||||
struct in6_addr *in6;
|
||||
u_int32_t *res;
|
||||
u_char *cp;
|
||||
printf("icmp6: ha discovery %s: ",
|
||||
dp->icmp6_type == ICMP6_HADISCOV_REQUEST ?
|
||||
"request" : "reply");
|
||||
TCHECK(dp->icmp6_data16[0]);
|
||||
printf("id=%d", ntohs(dp->icmp6_data16[0]));
|
||||
cp = (u_char *)dp + icmp6len;
|
||||
res = (u_int32_t *)(dp + 1);
|
||||
in6 = (struct in6_addr *)(res + 2);
|
||||
for (; (u_char *)in6 < cp; in6++) {
|
||||
TCHECK(*in6);
|
||||
printf(", %s", ip6addr_string(in6));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ICMP6_MOBILEPREFIX_SOLICIT:
|
||||
case ICMP6_MOBILEPREFIX_ADVERT:
|
||||
default:
|
||||
printf("icmp6: type-#%d", dp->icmp6_type);
|
||||
break;
|
||||
|
@ -454,6 +476,7 @@ icmp6_opt_print(const u_char *bp, int resid)
|
|||
const struct icmp6_opts_redirect *opr;
|
||||
const struct nd_opt_mtu *opm;
|
||||
const struct nd_opt_advinterval *opa;
|
||||
const struct nd_opt_homeagent_info *oph;
|
||||
const struct nd_opt_route_info *opri;
|
||||
const u_char *cp, *ep;
|
||||
struct in6_addr in6, *in6p;
|
||||
|
@ -552,6 +575,14 @@ icmp6_opt_print(const u_char *bp, int resid)
|
|||
/*(*/
|
||||
printf(")");
|
||||
break;
|
||||
case ND_OPT_HOMEAGENT_INFO:
|
||||
oph = (struct nd_opt_homeagent_info *)op;
|
||||
TCHECK(oph->nd_opt_hai_lifetime);
|
||||
printf("(ha info:"); /*)*/
|
||||
printf(" pref=%d", ntohs(oph->nd_opt_hai_preference));
|
||||
printf(", lifetime=%u", ntohs(oph->nd_opt_hai_lifetime));
|
||||
printf(")");
|
||||
break;
|
||||
case ND_OPT_ROUTE_INFO:
|
||||
opri = (struct nd_opt_route_info *)op;
|
||||
TCHECK(opri->nd_opt_rti_lifetime);
|
||||
|
@ -581,7 +612,7 @@ icmp6_opt_print(const u_char *bp, int resid)
|
|||
printf(")");
|
||||
break;
|
||||
default:
|
||||
printf("(unknwon opt_type=%d, opt_len=%d)",
|
||||
printf("(unknown opt_type=%d, opt_len=%d)",
|
||||
op->nd_opt_type, op->nd_opt_len);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-ip.c,v 1.3 2002/02/18 09:37:07 itojun Exp $ */
|
||||
/* $NetBSD: print-ip.c,v 1.4 2002/05/31 09:45:45 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
|
@ -25,9 +25,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-ip.c,v 1.100 2001/09/17 21:58:03 fenner Exp (LBL)";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-ip.c,v 1.104 2002/05/29 09:47:04 guy Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-ip.c,v 1.3 2002/02/18 09:37:07 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-ip.c,v 1.4 2002/05/31 09:45:45 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -41,6 +41,7 @@ __RCSID("$NetBSD: print-ip.c,v 1.3 2002/02/18 09:37:07 itojun Exp $");
|
|||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -264,13 +265,12 @@ ip_print(register const u_char *bp, register u_int length)
|
|||
register const u_char *cp;
|
||||
u_char nh;
|
||||
int advance;
|
||||
struct protoent *proto;
|
||||
|
||||
ip = (const struct ip *)bp;
|
||||
#ifdef LBL_ALIGN
|
||||
/*
|
||||
* If the IP header is not aligned, copy into abuf.
|
||||
* This will never happen with BPF. It does happen raw packet
|
||||
* dumps from -r.
|
||||
*/
|
||||
if ((long)ip & 3) {
|
||||
static u_char *abuf = NULL;
|
||||
|
@ -468,7 +468,11 @@ again:
|
|||
break;
|
||||
|
||||
default:
|
||||
(void)printf(" ip-proto-%d %d", nh, len);
|
||||
if ((proto = getprotobynumber(nh)) != NULL)
|
||||
(void)printf(" %s", proto->p_name);
|
||||
else
|
||||
(void)printf(" ip-proto-%d", nh);
|
||||
printf(" %d", len);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -487,11 +491,17 @@ again:
|
|||
if (off & 0x3fff) {
|
||||
/*
|
||||
* if this isn't the first frag, we're missing the
|
||||
* next level protocol header. print the ip addr.
|
||||
* next level protocol header. print the ip addr
|
||||
* and the protocol.
|
||||
*/
|
||||
if (off & 0x1fff)
|
||||
if (off & 0x1fff) {
|
||||
(void)printf("%s > %s:", ipaddr_string(&ip->ip_src),
|
||||
ipaddr_string(&ip->ip_dst));
|
||||
if ((proto = getprotobynumber(ip->ip_p)) != NULL)
|
||||
(void)printf(" %s", proto->p_name);
|
||||
else
|
||||
(void)printf(" ip-proto-%d", ip->ip_p);
|
||||
}
|
||||
#ifndef IP_MF
|
||||
#define IP_MF 0x2000
|
||||
#endif /* IP_MF */
|
||||
|
@ -544,8 +554,9 @@ again:
|
|||
if ((u_char *)ip + hlen <= snapend) {
|
||||
sum = in_cksum((const u_short *)ip, hlen, 0);
|
||||
if (sum != 0) {
|
||||
(void)printf("%sbad cksum %x!", sep,
|
||||
ntohs(ip->ip_sum));
|
||||
(void)printf("%sbad cksum %x (->%x)!", sep,
|
||||
ntohs(ip->ip_sum),
|
||||
ntohs(ip->ip_sum)-sum);
|
||||
sep = ", ";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-ip6opts.c,v 1.2 2001/06/25 19:59:58 itojun Exp $ */
|
||||
/* $NetBSD: print-ip6opts.c,v 1.3 2002/05/31 09:45:45 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1998 WIDE Project.
|
||||
|
@ -37,9 +37,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-ip6opts.c,v 1.9 2001/05/09 02:47:26 itojun Exp";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-ip6opts.c,v 1.10 2002/03/28 10:02:35 guy Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-ip6opts.c,v 1.2 2001/06/25 19:59:58 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-ip6opts.c,v 1.3 2002/05/31 09:45:45 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -71,10 +71,12 @@ __RCSID("$NetBSD: print-ip6opts.c,v 1.2 2001/06/25 19:59:58 itojun Exp $");
|
|||
#define IP6OPT_BU_MINLEN 10
|
||||
#define IP6OPT_BA_MINLEN 13
|
||||
#define IP6OPT_BR_MINLEN 2
|
||||
#define IP6SOPT_ALTCOA 0x4
|
||||
#define IP6SOPT_ALTCOA_MINLEN 18
|
||||
#define IP6SOPT_UI 0x2
|
||||
#define IP6SOPT_UI_MINLEN 4
|
||||
#define IP6SOPT_ALTCOA 0x3
|
||||
#define IP6SOPT_ALTCOA_MINLEN 18
|
||||
#define IP6SOPT_AUTH 0x4
|
||||
#define IP6SOPT_AUTH_MINLEN 6
|
||||
|
||||
static void ip6_sopt_print(const u_char *, int);
|
||||
|
||||
|
@ -107,6 +109,13 @@ ip6_sopt_print(const u_char *bp, int len)
|
|||
}
|
||||
printf(", padn");
|
||||
break;
|
||||
case IP6SOPT_UI:
|
||||
if (len - i < IP6SOPT_UI_MINLEN) {
|
||||
printf(", ui: trunc");
|
||||
goto trunc;
|
||||
}
|
||||
printf(", ui: 0x%04x ", ntohs(*(u_int16_t *)&bp[i + 2]));
|
||||
break;
|
||||
case IP6SOPT_ALTCOA:
|
||||
if (len - i < IP6SOPT_ALTCOA_MINLEN) {
|
||||
printf(", altcoa: trunc");
|
||||
|
@ -114,12 +123,13 @@ ip6_sopt_print(const u_char *bp, int len)
|
|||
}
|
||||
printf(", alt-CoA: %s", ip6addr_string(&bp[i+2]));
|
||||
break;
|
||||
case IP6SOPT_UI:
|
||||
if (len - i < IP6SOPT_UI_MINLEN) {
|
||||
printf(", ui: trunc");
|
||||
case IP6SOPT_AUTH:
|
||||
if (len - i < IP6SOPT_AUTH_MINLEN) {
|
||||
printf(", auth: trunc");
|
||||
goto trunc;
|
||||
}
|
||||
printf("(ui: 0x%04x) ", ntohs(*(u_int16_t *)&bp[i + 2]));
|
||||
printf(", auth spi: 0x%08x",
|
||||
(u_int32_t)ntohl(*(u_int32_t *)&bp[i + 2]));
|
||||
break;
|
||||
default:
|
||||
if (len - i < IP6OPT_MINLEN) {
|
||||
|
@ -218,16 +228,14 @@ ip6_opt_print(const u_char *bp, int len)
|
|||
if (bp[i + 2] & 0x40)
|
||||
printf("H");
|
||||
if (bp[i + 2] & 0x20)
|
||||
printf("R");
|
||||
printf("S");
|
||||
if (bp[i + 2] & 0x10)
|
||||
printf("D");
|
||||
if (bp[i + 2] & 0x0f)
|
||||
if ((bp[i + 2] & 0x0f) || bp[i + 3] || bp[i + 4])
|
||||
printf("res");
|
||||
printf(", prefixlen: %u", bp[i + 3]);
|
||||
printf(", sequence: %u",
|
||||
(u_int16_t)ntohs(*(u_int16_t *)&bp[i + 4]));
|
||||
printf(", sequence: %u", bp[i + 5]);
|
||||
printf(", lifetime: %u",
|
||||
(u_int32_t)ntohs(*(u_int32_t *)&bp[i + 8]));
|
||||
(u_int32_t)ntohl(*(u_int32_t *)&bp[i + 6]));
|
||||
|
||||
if (bp[i + 1] > IP6OPT_BU_MINLEN - 2) {
|
||||
ip6_sopt_print(&bp[i + IP6OPT_BU_MINLEN],
|
||||
|
@ -246,12 +254,13 @@ ip6_opt_print(const u_char *bp, int len)
|
|||
}
|
||||
printf("(ba: ");
|
||||
printf("status: %u", bp[i + 2]);
|
||||
printf(", sequence: %u",
|
||||
(u_int16_t)ntohs(*(u_int16_t *)&bp[i + 3]));
|
||||
if (bp[i + 3])
|
||||
printf("res");
|
||||
printf(", sequence: %u", bp[i + 4]);
|
||||
printf(", lifetime: %u",
|
||||
(u_int32_t)ntohs(*(u_int32_t *)&bp[i + 7]));
|
||||
(u_int32_t)ntohl(*(u_int32_t *)&bp[i + 5]));
|
||||
printf(", refresh: %u",
|
||||
(u_int32_t)ntohs(*(u_int32_t *)&bp[i + 11]));
|
||||
(u_int32_t)ntohl(*(u_int32_t *)&bp[i + 9]));
|
||||
|
||||
if (bp[i + 1] > IP6OPT_BA_MINLEN - 2) {
|
||||
ip6_sopt_print(&bp[i + IP6OPT_BA_MINLEN],
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-ipx.c,v 1.4 2002/02/18 09:37:07 itojun Exp $ */
|
||||
/* $NetBSD: print-ipx.c,v 1.5 2002/05/31 09:45:45 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995, 1996
|
||||
|
@ -28,9 +28,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-ipx.c,v 1.32 2001/10/08 21:25:20 fenner Exp";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-ipx.c,v 1.33 2001/11/25 01:48:48 guy Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-ipx.c,v 1.4 2002/02/18 09:37:07 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-ipx.c,v 1.5 2002/05/31 09:45:45 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -68,11 +68,11 @@ ipx_print(const u_char *p, u_int length)
|
|||
const struct ipxHdr *ipx = (const struct ipxHdr *)p;
|
||||
|
||||
TCHECK(ipx->srcSkt);
|
||||
(void)printf("%s.%x > ",
|
||||
(void)printf("%s.%04x > ",
|
||||
ipxaddr_string(EXTRACT_32BITS(ipx->srcNet), ipx->srcNode),
|
||||
EXTRACT_16BITS(&ipx->srcSkt));
|
||||
|
||||
(void)printf("%s.%x:",
|
||||
(void)printf("%s.%04x:",
|
||||
ipxaddr_string(EXTRACT_32BITS(ipx->dstNet), ipx->dstNode),
|
||||
EXTRACT_16BITS(&ipx->dstSkt));
|
||||
|
||||
|
@ -91,7 +91,7 @@ ipxaddr_string(u_int32_t net, const u_char *node)
|
|||
{
|
||||
static char line[256];
|
||||
|
||||
snprintf(line, sizeof(line), "%x.%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
snprintf(line, sizeof(line), "%08x.%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
net, node[0], node[1], node[2], node[3], node[4], node[5]);
|
||||
|
||||
return line;
|
||||
|
@ -156,7 +156,7 @@ ipx_sap_print(const u_short *ipx, u_int length)
|
|||
(void)printf("ipx-sap-nearest-req");
|
||||
|
||||
TCHECK(ipx[0]);
|
||||
(void)printf(" %x", EXTRACT_16BITS(&ipx[0]));
|
||||
(void)printf(" %s", ipxsap_string(htons(EXTRACT_16BITS(&ipx[0]))));
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
@ -168,7 +168,7 @@ ipx_sap_print(const u_short *ipx, u_int length)
|
|||
|
||||
for (i = 0; i < 8 && length > 0; i++) {
|
||||
TCHECK2(ipx[25], 10);
|
||||
(void)printf(" %x '", EXTRACT_16BITS(&ipx[0]));
|
||||
(void)printf(" %s '", ipxsap_string(htons(EXTRACT_16BITS(&ipx[0]))));
|
||||
fn_print((u_char *)&ipx[1], (u_char *)&ipx[1] + 48);
|
||||
printf("' addr %s",
|
||||
ipxaddr_string(EXTRACT_32BITS(&ipx[25]), (u_char *)&ipx[27]));
|
||||
|
@ -223,4 +223,3 @@ ipx_rip_print(const u_short *ipx, u_int length)
|
|||
trunc:
|
||||
printf("[|ipx %d]", length);
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-l2tp.c,v 1.3 2002/02/18 09:37:07 itojun Exp $ */
|
||||
/* $NetBSD: print-l2tp.c,v 1.4 2002/05/31 09:45:45 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
|
||||
|
@ -27,9 +27,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-l2tp.c,v 1.10 2001/11/10 21:37:58 guy Exp";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-l2tp.c,v 1.11 2002/05/25 09:41:07 guy Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-l2tp.c,v 1.3 2002/02/18 09:37:07 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-l2tp.c,v 1.4 2002/05/31 09:45:45 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -45,6 +45,7 @@ __RCSID("$NetBSD: print-l2tp.c,v 1.3 2002/02/18 09:37:07 itojun Exp $");
|
|||
|
||||
#include "l2tp.h"
|
||||
#include "interface.h"
|
||||
#include "extract.h"
|
||||
|
||||
static char tstr[] = " [|l2tp]";
|
||||
|
||||
|
@ -270,13 +271,13 @@ print_octets(const u_char *dat, u_int length)
|
|||
static void
|
||||
print_16bits_val(const u_int16_t *dat)
|
||||
{
|
||||
printf("%u", ntohs(*dat));
|
||||
printf("%u", EXTRACT_16BITS(dat));
|
||||
}
|
||||
|
||||
static void
|
||||
print_32bits_val(const u_int32_t *dat)
|
||||
{
|
||||
printf("%lu", (u_long)ntohl(*dat));
|
||||
printf("%lu", (u_long)EXTRACT_32BITS(dat));
|
||||
}
|
||||
|
||||
/***********************************/
|
||||
|
@ -287,7 +288,8 @@ l2tp_msgtype_print(const u_char *dat)
|
|||
{
|
||||
u_int16_t *ptr = (u_int16_t*)dat;
|
||||
|
||||
printf("%s", tok2str(l2tp_msgtype2str, "MSGTYPE-#%u", ntohs(*ptr)));
|
||||
printf("%s", tok2str(l2tp_msgtype2str, "MSGTYPE-#%u",
|
||||
EXTRACT_16BITS(ptr)));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -295,11 +297,11 @@ l2tp_result_code_print(const u_char *dat, u_int length)
|
|||
{
|
||||
u_int16_t *ptr = (u_int16_t *)dat;
|
||||
|
||||
printf("%u", ntohs(*ptr++)); /* Result Code */
|
||||
if (length > 2) { /* Error Code (opt) */
|
||||
printf("/%u", ntohs(*ptr++));
|
||||
printf("%u", EXTRACT_16BITS(ptr)); ptr++; /* Result Code */
|
||||
if (length > 2) { /* Error Code (opt) */
|
||||
printf("/%u", EXTRACT_16BITS(ptr)); ptr++;
|
||||
}
|
||||
if (length > 4) { /* Error Message (opt) */
|
||||
if (length > 4) { /* Error Message (opt) */
|
||||
printf(" ");
|
||||
print_string((u_char *)ptr, length - 4);
|
||||
}
|
||||
|
@ -308,7 +310,8 @@ l2tp_result_code_print(const u_char *dat, u_int length)
|
|||
static void
|
||||
l2tp_proto_ver_print(const u_int16_t *dat)
|
||||
{
|
||||
printf("%u.%u", (ntohs(*dat) >> 8), (ntohs(*dat) & 0xff));
|
||||
printf("%u.%u", (EXTRACT_16BITS(dat) >> 8),
|
||||
(EXTRACT_16BITS(dat) & 0xff));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -316,10 +319,10 @@ l2tp_framing_cap_print(const u_char *dat)
|
|||
{
|
||||
u_int32_t *ptr = (u_int32_t *)dat;
|
||||
|
||||
if (ntohl(*ptr) & L2TP_FRAMING_CAP_ASYNC_MASK) {
|
||||
if (EXTRACT_32BITS(ptr) & L2TP_FRAMING_CAP_ASYNC_MASK) {
|
||||
printf("A");
|
||||
}
|
||||
if (ntohl(*ptr) & L2TP_FRAMING_CAP_SYNC_MASK) {
|
||||
if (EXTRACT_32BITS(ptr) & L2TP_FRAMING_CAP_SYNC_MASK) {
|
||||
printf("S");
|
||||
}
|
||||
}
|
||||
|
@ -329,10 +332,10 @@ l2tp_bearer_cap_print(const u_char *dat)
|
|||
{
|
||||
u_int32_t *ptr = (u_int32_t *)dat;
|
||||
|
||||
if (ntohl(*ptr) & L2TP_BEARER_CAP_ANALOG_MASK) {
|
||||
if (EXTRACT_32BITS(ptr) & L2TP_BEARER_CAP_ANALOG_MASK) {
|
||||
printf("A");
|
||||
}
|
||||
if (ntohl(*ptr) & L2TP_BEARER_CAP_DIGITAL_MASK) {
|
||||
if (EXTRACT_32BITS(ptr) & L2TP_BEARER_CAP_DIGITAL_MASK) {
|
||||
printf("D");
|
||||
}
|
||||
}
|
||||
|
@ -353,10 +356,10 @@ l2tp_bearer_type_print(const u_char *dat)
|
|||
{
|
||||
u_int32_t *ptr = (u_int32_t *)dat;
|
||||
|
||||
if (ntohl(*ptr) & L2TP_BEARER_TYPE_ANALOG_MASK) {
|
||||
if (EXTRACT_32BITS(ptr) & L2TP_BEARER_TYPE_ANALOG_MASK) {
|
||||
printf("A");
|
||||
}
|
||||
if (ntohl(*ptr) & L2TP_BEARER_TYPE_DIGITAL_MASK) {
|
||||
if (EXTRACT_32BITS(ptr) & L2TP_BEARER_TYPE_DIGITAL_MASK) {
|
||||
printf("D");
|
||||
}
|
||||
}
|
||||
|
@ -366,10 +369,10 @@ l2tp_framing_type_print(const u_char *dat)
|
|||
{
|
||||
u_int32_t *ptr = (u_int32_t *)dat;
|
||||
|
||||
if (ntohl(*ptr) & L2TP_FRAMING_TYPE_ASYNC_MASK) {
|
||||
if (EXTRACT_32BITS(ptr) & L2TP_FRAMING_TYPE_ASYNC_MASK) {
|
||||
printf("A");
|
||||
}
|
||||
if (ntohl(*ptr) & L2TP_FRAMING_TYPE_SYNC_MASK) {
|
||||
if (EXTRACT_32BITS(ptr) & L2TP_FRAMING_TYPE_SYNC_MASK) {
|
||||
printf("S");
|
||||
}
|
||||
}
|
||||
|
@ -386,7 +389,7 @@ l2tp_proxy_auth_type_print(const u_char *dat)
|
|||
u_int16_t *ptr = (u_int16_t *)dat;
|
||||
|
||||
printf("%s", tok2str(l2tp_authentype2str,
|
||||
"AuthType-#%u", ntohs(*ptr)));
|
||||
"AuthType-#%u", EXTRACT_16BITS(ptr)));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -394,7 +397,7 @@ l2tp_proxy_auth_id_print(const u_char *dat)
|
|||
{
|
||||
u_int16_t *ptr = (u_int16_t *)dat;
|
||||
|
||||
printf("%u", ntohs(*ptr) & L2TP_PROXY_AUTH_ID_MASK);
|
||||
printf("%u", EXTRACT_16BITS(ptr) & L2TP_PROXY_AUTH_ID_MASK);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -405,28 +408,28 @@ l2tp_call_errors_print(const u_char *dat)
|
|||
|
||||
ptr++; /* skip "Reserved" */
|
||||
|
||||
val_h = ntohs(*ptr++);
|
||||
val_l = ntohs(*ptr++);
|
||||
val_h = EXTRACT_16BITS(ptr); ptr++;
|
||||
val_l = EXTRACT_16BITS(ptr); ptr++;
|
||||
printf("CRCErr=%u ", (val_h<<16) + val_l);
|
||||
|
||||
val_h = ntohs(*ptr++);
|
||||
val_l = ntohs(*ptr++);
|
||||
val_h = EXTRACT_16BITS(ptr); ptr++;
|
||||
val_l = EXTRACT_16BITS(ptr); ptr++;
|
||||
printf("FrameErr=%u ", (val_h<<16) + val_l);
|
||||
|
||||
val_h = ntohs(*ptr++);
|
||||
val_l = ntohs(*ptr++);
|
||||
val_h = EXTRACT_16BITS(ptr); ptr++;
|
||||
val_l = EXTRACT_16BITS(ptr); ptr++;
|
||||
printf("HardOver=%u ", (val_h<<16) + val_l);
|
||||
|
||||
val_h = ntohs(*ptr++);
|
||||
val_l = ntohs(*ptr++);
|
||||
val_h = EXTRACT_16BITS(ptr); ptr++;
|
||||
val_l = EXTRACT_16BITS(ptr); ptr++;
|
||||
printf("BufOver=%u ", (val_h<<16) + val_l);
|
||||
|
||||
val_h = ntohs(*ptr++);
|
||||
val_l = ntohs(*ptr++);
|
||||
val_h = EXTRACT_16BITS(ptr); ptr++;
|
||||
val_l = EXTRACT_16BITS(ptr); ptr++;
|
||||
printf("Timeout=%u ", (val_h<<16) + val_l);
|
||||
|
||||
val_h = ntohs(*ptr++);
|
||||
val_l = ntohs(*ptr++);
|
||||
val_h = EXTRACT_16BITS(ptr); ptr++;
|
||||
val_l = EXTRACT_16BITS(ptr); ptr++;
|
||||
printf("AlignErr=%u ", (val_h<<16) + val_l);
|
||||
}
|
||||
|
||||
|
@ -438,12 +441,12 @@ l2tp_accm_print(const u_char *dat)
|
|||
|
||||
ptr++; /* skip "Reserved" */
|
||||
|
||||
val_h = ntohs(*ptr++);
|
||||
val_l = ntohs(*ptr++);
|
||||
val_h = EXTRACT_16BITS(ptr); ptr++;
|
||||
val_l = EXTRACT_16BITS(ptr); ptr++;
|
||||
printf("send=%08x ", (val_h<<16) + val_l);
|
||||
|
||||
val_h = ntohs(*ptr++);
|
||||
val_l = ntohs(*ptr++);
|
||||
val_h = EXTRACT_16BITS(ptr); ptr++;
|
||||
val_l = EXTRACT_16BITS(ptr); ptr++;
|
||||
printf("recv=%08x ", (val_h<<16) + val_l);
|
||||
}
|
||||
|
||||
|
@ -452,8 +455,8 @@ l2tp_ppp_discon_cc_print(const u_char *dat, u_int length)
|
|||
{
|
||||
u_int16_t *ptr = (u_int16_t *)dat;
|
||||
|
||||
printf("%04x, ", ntohs(*ptr++)); /* Disconnect Code */
|
||||
printf("%04x ", ntohs(*ptr++)); /* Control Protocol Number */
|
||||
printf("%04x, ", EXTRACT_16BITS(ptr)); ptr++; /* Disconnect Code */
|
||||
printf("%04x ", EXTRACT_16BITS(ptr)); ptr++; /* Control Protocol Number */
|
||||
printf("%s", tok2str(l2tp_cc_direction2str,
|
||||
"Direction-#%u", *((u_char *)ptr++)));
|
||||
|
||||
|
@ -478,33 +481,33 @@ l2tp_avp_print(const u_char *dat, int length)
|
|||
printf(" ");
|
||||
|
||||
TCHECK(*ptr); /* Flags & Length */
|
||||
len = ntohs(*ptr) & L2TP_AVP_HDR_LEN_MASK;
|
||||
len = EXTRACT_16BITS(ptr) & L2TP_AVP_HDR_LEN_MASK;
|
||||
|
||||
/* If it is not long enough to decode the entire AVP, we'll
|
||||
abandon. */
|
||||
TCHECK2(*ptr, len);
|
||||
/* After this point, no need to worry about truncation */
|
||||
|
||||
if (ntohs(*ptr) & L2TP_AVP_HDR_FLAG_MANDATORY) {
|
||||
if (EXTRACT_16BITS(ptr) & L2TP_AVP_HDR_FLAG_MANDATORY) {
|
||||
printf("*");
|
||||
}
|
||||
if (ntohs(*ptr) & L2TP_AVP_HDR_FLAG_HIDDEN) {
|
||||
if (EXTRACT_16BITS(ptr) & L2TP_AVP_HDR_FLAG_HIDDEN) {
|
||||
hidden = TRUE;
|
||||
printf("?");
|
||||
}
|
||||
ptr++;
|
||||
|
||||
if (ntohs(*ptr)) {
|
||||
if (EXTRACT_16BITS(ptr)) {
|
||||
/* Vendor Specific Attribute */
|
||||
printf("VENDOR%04x:", ntohs(*ptr++));
|
||||
printf("ATTR%04x", ntohs(*ptr++));
|
||||
printf("VENDOR%04x:", EXTRACT_16BITS(ptr)); ptr++;
|
||||
printf("ATTR%04x", EXTRACT_16BITS(ptr)); ptr++;
|
||||
printf("(");
|
||||
print_octets((u_char *)ptr, len-6);
|
||||
printf(")");
|
||||
} else {
|
||||
/* IETF-defined Attributes */
|
||||
ptr++;
|
||||
attr_type = ntohs(*ptr++);
|
||||
attr_type = EXTRACT_16BITS(ptr); ptr++;
|
||||
printf("%s", tok2str(l2tp_avp2str, "AVP-#%u", attr_type));
|
||||
printf("(");
|
||||
if (hidden) {
|
||||
|
@ -620,9 +623,9 @@ l2tp_print(const u_char *dat, u_int length)
|
|||
flag_t = flag_l = flag_s = flag_o = flag_p = FALSE;
|
||||
|
||||
TCHECK(*ptr); /* Flags & Version */
|
||||
if ((ntohs(*ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2TP) {
|
||||
if ((EXTRACT_16BITS(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2TP) {
|
||||
printf(" l2tp:");
|
||||
} else if ((ntohs(*ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2F) {
|
||||
} else if ((EXTRACT_16BITS(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2F) {
|
||||
printf(" l2f:");
|
||||
return; /* nothing to do */
|
||||
} else {
|
||||
|
@ -631,23 +634,23 @@ l2tp_print(const u_char *dat, u_int length)
|
|||
}
|
||||
|
||||
printf("[");
|
||||
if (ntohs(*ptr) & L2TP_FLAG_TYPE) {
|
||||
if (EXTRACT_16BITS(ptr) & L2TP_FLAG_TYPE) {
|
||||
flag_t = TRUE;
|
||||
printf("T");
|
||||
}
|
||||
if (ntohs(*ptr) & L2TP_FLAG_LENGTH) {
|
||||
if (EXTRACT_16BITS(ptr) & L2TP_FLAG_LENGTH) {
|
||||
flag_l = TRUE;
|
||||
printf("L");
|
||||
}
|
||||
if (ntohs(*ptr) & L2TP_FLAG_SEQUENCE) {
|
||||
if (EXTRACT_16BITS(ptr) & L2TP_FLAG_SEQUENCE) {
|
||||
flag_s = TRUE;
|
||||
printf("S");
|
||||
}
|
||||
if (ntohs(*ptr) & L2TP_FLAG_OFFSET) {
|
||||
if (EXTRACT_16BITS(ptr) & L2TP_FLAG_OFFSET) {
|
||||
flag_o = TRUE;
|
||||
printf("O");
|
||||
}
|
||||
if (ntohs(*ptr) & L2TP_FLAG_PRIORITY) {
|
||||
if (EXTRACT_16BITS(ptr) & L2TP_FLAG_PRIORITY) {
|
||||
flag_p = TRUE;
|
||||
printf("P");
|
||||
}
|
||||
|
@ -658,31 +661,31 @@ l2tp_print(const u_char *dat, u_int length)
|
|||
|
||||
if (flag_l) {
|
||||
TCHECK(*ptr); /* Length */
|
||||
l2tp_len = ntohs(*ptr++);
|
||||
l2tp_len = EXTRACT_16BITS(ptr); ptr++;
|
||||
cnt += 2;
|
||||
} else {
|
||||
l2tp_len = 0;
|
||||
}
|
||||
|
||||
TCHECK(*ptr); /* Tunnel ID */
|
||||
printf("(%u/", ntohs(*ptr++));
|
||||
printf("(%u/", EXTRACT_16BITS(ptr)); ptr++;
|
||||
cnt += 2;
|
||||
TCHECK(*ptr); /* Session ID */
|
||||
printf("%u)", ntohs(*ptr++));
|
||||
printf("%u)", EXTRACT_16BITS(ptr)); ptr++;
|
||||
cnt += 2;
|
||||
|
||||
if (flag_s) {
|
||||
TCHECK(*ptr); /* Ns */
|
||||
printf("Ns=%u,", ntohs(*ptr++));
|
||||
printf("Ns=%u,", EXTRACT_16BITS(ptr)); ptr++;
|
||||
cnt += 2;
|
||||
TCHECK(*ptr); /* Nr */
|
||||
printf("Nr=%u", ntohs(*ptr++));
|
||||
printf("Nr=%u", EXTRACT_16BITS(ptr)); ptr++;
|
||||
cnt += 2;
|
||||
}
|
||||
|
||||
if (flag_o) {
|
||||
TCHECK(*ptr); /* Offset Size */
|
||||
pad = ntohs(*ptr++);
|
||||
pad = EXTRACT_16BITS(ptr); ptr++;
|
||||
ptr += pad / sizeof(*ptr);
|
||||
cnt += (2 + pad);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-llc.c,v 1.4 2002/02/18 09:37:08 itojun Exp $ */
|
||||
/* $NetBSD: print-llc.c,v 1.5 2002/05/31 09:45:45 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993, 1994, 1995, 1996, 1997
|
||||
|
@ -28,9 +28,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-llc.c,v 1.43 2001/10/08 21:25:22 fenner Exp";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-llc.c,v 1.45 2002/04/07 09:50:33 guy Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-llc.c,v 1.4 2002/02/18 09:37:08 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-llc.c,v 1.5 2002/05/31 09:45:45 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -103,6 +103,7 @@ llc_print(const u_char *p, u_int length, u_int caplen,
|
|||
* such as an 802.11 network; this has appeared in at
|
||||
* least one capture file.)
|
||||
*/
|
||||
printf("(NOV-802.3) ");
|
||||
ipx_print(p, length);
|
||||
return (1);
|
||||
}
|
||||
|
@ -121,6 +122,7 @@ llc_print(const u_char *p, u_int length, u_int caplen,
|
|||
*
|
||||
* Skip DSAP, LSAP, and control field.
|
||||
*/
|
||||
printf("(NOV-802.2) ");
|
||||
p += 3;
|
||||
length -= 3;
|
||||
caplen -= 3;
|
||||
|
@ -231,11 +233,78 @@ llc_print(const u_char *p, u_int length, u_int caplen,
|
|||
break;
|
||||
|
||||
case OUI_CISCO:
|
||||
if (et == ETHERTYPE_CISCO_CDP) {
|
||||
if (et == PID_CISCO_CDP) {
|
||||
cdp_print(p, length, caplen, esrc, edst);
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case OUI_RFC2684:
|
||||
switch (et) {
|
||||
|
||||
case PID_RFC2684_ETH_FCS:
|
||||
case PID_RFC2684_ETH_NOFCS:
|
||||
/*
|
||||
* XXX - remove the last two bytes for
|
||||
* PID_RFC2684_ETH_FCS?
|
||||
*/
|
||||
/*
|
||||
* Skip the padding.
|
||||
*/
|
||||
caplen -= 2;
|
||||
length -= 2;
|
||||
p += 2;
|
||||
|
||||
/*
|
||||
* What remains is an Ethernet packet.
|
||||
*/
|
||||
ether_print(p, length, caplen);
|
||||
return (1);
|
||||
|
||||
case PID_RFC2684_802_5_FCS:
|
||||
case PID_RFC2684_802_5_NOFCS:
|
||||
/*
|
||||
* XXX - remove the last two bytes for
|
||||
* PID_RFC2684_ETH_FCS?
|
||||
*/
|
||||
/*
|
||||
* Skip the padding, but not the Access
|
||||
* Control field.
|
||||
*/
|
||||
caplen -= 2;
|
||||
length -= 2;
|
||||
p += 2;
|
||||
|
||||
/*
|
||||
* What remains is an 802.5 Token Ring
|
||||
* packet.
|
||||
*/
|
||||
token_print(p, length, caplen);
|
||||
return (1);
|
||||
|
||||
case PID_RFC2684_FDDI_FCS:
|
||||
case PID_RFC2684_FDDI_NOFCS:
|
||||
/*
|
||||
* XXX - remove the last two bytes for
|
||||
* PID_RFC2684_ETH_FCS?
|
||||
*/
|
||||
/*
|
||||
* Skip the padding.
|
||||
*/
|
||||
caplen -= 3;
|
||||
length -= 3;
|
||||
p += 3;
|
||||
|
||||
/*
|
||||
* What remains is an FDDI packet.
|
||||
*/
|
||||
fddi_print(p, length, caplen);
|
||||
return (1);
|
||||
|
||||
case PID_RFC2684_BPDU:
|
||||
stp_print(p, length);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-mpls.c,v 1.3 2002/02/18 09:37:08 itojun Exp $ */
|
||||
/* $NetBSD: print-mpls.c,v 1.4 2002/05/31 09:45:45 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001 WIDE Project. All rights reserved.
|
||||
|
@ -32,9 +32,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-mpls.c,v 1.2 2001/06/26 06:24:57 guy Exp (LBL)";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-mpls.c,v 1.3 2002/05/07 18:35:39 fenner Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-mpls.c,v 1.3 2002/02/18 09:37:08 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-mpls.c,v 1.4 2002/05/31 09:45:45 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -90,23 +90,24 @@ mpls_print(const u_char *bp, u_int length)
|
|||
|
||||
p = bp;
|
||||
printf("MPLS");
|
||||
TCHECK2(*p, sizeof(v));
|
||||
memcpy(&v, p, sizeof(v));
|
||||
v = (u_int32_t)ntohl(v);
|
||||
printf(" ("); /*)*/
|
||||
printf("label 0x%x", MPLS_LABEL(v));
|
||||
if (vflag &&
|
||||
MPLS_LABEL(v) < sizeof(mpls_labelname) / sizeof(mpls_labelname[0]))
|
||||
printf("(%s)", mpls_labelname[MPLS_LABEL(v)]);
|
||||
if (MPLS_EXP(v))
|
||||
printf(" exp 0x%x", MPLS_EXP(v));
|
||||
if (MPLS_STACK(v))
|
||||
printf("[S]");
|
||||
printf(" TTL %u", MPLS_TTL(v));
|
||||
/*(*/
|
||||
printf(")");
|
||||
do {
|
||||
TCHECK2(*p, sizeof(v));
|
||||
v = EXTRACT_32BITS(p);
|
||||
printf(" ("); /*)*/
|
||||
printf("label 0x%x", MPLS_LABEL(v));
|
||||
if (vflag &&
|
||||
MPLS_LABEL(v) < sizeof(mpls_labelname) / sizeof(mpls_labelname[0]))
|
||||
printf("(%s)", mpls_labelname[MPLS_LABEL(v)]);
|
||||
if (MPLS_EXP(v))
|
||||
printf(" exp 0x%x", MPLS_EXP(v));
|
||||
if (MPLS_STACK(v))
|
||||
printf("[S]");
|
||||
printf(" TTL %u", MPLS_TTL(v));
|
||||
/*(*/
|
||||
printf(")");
|
||||
|
||||
p += sizeof(v);
|
||||
p += sizeof(v);
|
||||
} while (!MPLS_STACK(v));
|
||||
|
||||
switch (MPLS_LABEL(v)) {
|
||||
case 0: /* IPv4 explicit NULL label */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-nfs.c,v 1.4 2002/02/18 09:37:08 itojun Exp $ */
|
||||
/* $NetBSD: print-nfs.c,v 1.5 2002/05/31 09:45:45 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
|
@ -25,9 +25,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.89 2001/07/08 08:01:43 itojun Exp (LBL)";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.91 2002/04/24 06:27:06 guy Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-nfs.c,v 1.4 2002/02/18 09:37:08 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-nfs.c,v 1.5 2002/05/31 09:45:45 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -763,9 +763,10 @@ nfs_printfh(register const u_int32_t *dp, const u_int len)
|
|||
{
|
||||
my_fsid fsid;
|
||||
ino_t ino;
|
||||
char *sfsname = NULL;
|
||||
const char *sfsname = NULL;
|
||||
char *spacep;
|
||||
|
||||
Parse_fh((caddr_t*)dp, len, &fsid, &ino, NULL, (const char **)&sfsname, 0);
|
||||
Parse_fh((const u_char *)dp, len, &fsid, &ino, NULL, &sfsname, 0);
|
||||
|
||||
if (sfsname) {
|
||||
/* file system ID is ASCII, not numeric, for this server OS */
|
||||
|
@ -775,9 +776,9 @@ nfs_printfh(register const u_int32_t *dp, const u_int len)
|
|||
strncpy(temp, sfsname, NFSX_V3FHMAX);
|
||||
temp[sizeof(temp) - 1] = '\0';
|
||||
/* Remove trailing spaces */
|
||||
sfsname = strchr(temp, ' ');
|
||||
if (sfsname)
|
||||
*sfsname = 0;
|
||||
spacep = strchr(temp, ' ');
|
||||
if (spacep)
|
||||
*spacep = '\0';
|
||||
|
||||
(void)printf(" fh %s/", temp);
|
||||
} else {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-ntp.c,v 1.3 2002/02/18 09:37:08 itojun Exp $ */
|
||||
/* $NetBSD: print-ntp.c,v 1.4 2002/05/31 09:45:46 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
|
@ -29,9 +29,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-ntp.c,v 1.32 2001/08/20 15:36:57 fenner Exp (LBL)";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-ntp.c,v 1.33 2002/04/25 04:57:59 guy Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-ntp.c,v 1.3 2002/02/18 09:37:08 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-ntp.c,v 1.4 2002/05/31 09:45:46 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -162,7 +162,7 @@ ntp_print(register const u_char *cp, u_int length)
|
|||
break;
|
||||
|
||||
case PRIM_REF:
|
||||
fn_printn((char *)&(bp->refid), 4, NULL);
|
||||
fn_printn((u_char *)&(bp->refid), 4, NULL);
|
||||
break;
|
||||
|
||||
case INFO_QUERY:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-pim.c,v 1.3 2002/02/18 09:37:08 itojun Exp $ */
|
||||
/* $NetBSD: print-pim.c,v 1.4 2002/05/31 09:45:46 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1996
|
||||
|
@ -25,9 +25,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-pim.c,v 1.29 2001/07/04 21:36:15 fenner Exp (LBL)";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-pim.c,v 1.30 2002/05/07 18:28:38 fenner Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-pim.c,v 1.3 2002/02/18 09:37:08 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-pim.c,v 1.4 2002/05/31 09:45:46 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -591,7 +591,20 @@ pimv2_print(register const u_char *bp, register u_int len)
|
|||
(void)printf(")");
|
||||
break;
|
||||
|
||||
case 18: /* Old DR-Priority */
|
||||
if (olen == 4)
|
||||
(void)printf(" (OLD-DR-Priority: %d)",
|
||||
EXTRACT_32BITS(&bp[4]));
|
||||
else
|
||||
goto unknown;
|
||||
break;
|
||||
|
||||
|
||||
case 19: /* DR-Priority */
|
||||
if (olen == 0) {
|
||||
(void)printf(" (OLD-bidir-capable)");
|
||||
break;
|
||||
}
|
||||
(void)printf(" (DR-Priority: ");
|
||||
if (olen != 4) {
|
||||
(void)printf("!olen=%d!)", olen);
|
||||
|
@ -621,6 +634,7 @@ pimv2_print(register const u_char *bp, register u_int len)
|
|||
break;
|
||||
|
||||
default:
|
||||
unknown:
|
||||
if (vflag)
|
||||
(void)printf(" [Hello option %d]", otype);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-ppp.c,v 1.3 2002/02/18 09:37:08 itojun Exp $ */
|
||||
/* $NetBSD: print-ppp.c,v 1.4 2002/05/31 09:45:46 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
|
||||
|
@ -35,9 +35,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.64 2001/09/09 02:04:19 guy Exp (LBL)";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.66 2002/05/29 10:32:02 guy Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-ppp.c,v 1.3 2002/02/18 09:37:08 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-ppp.c,v 1.4 2002/05/31 09:45:46 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -997,11 +997,12 @@ handle_ppp(u_int proto, const u_char *p, int length)
|
|||
}
|
||||
|
||||
/* Standard PPP printer */
|
||||
void
|
||||
u_int
|
||||
ppp_print(register const u_char *p, u_int length)
|
||||
{
|
||||
u_int proto;
|
||||
u_int full_length = length;
|
||||
u_int hdr_len = 0;
|
||||
|
||||
/*
|
||||
* Here, we assume that p points to the Address and Control
|
||||
|
@ -1012,6 +1013,7 @@ ppp_print(register const u_char *p, u_int length)
|
|||
if (*p == PPP_ADDRESS && *(p + 1) == PPP_CONTROL) {
|
||||
p += 2; /* ACFC not used */
|
||||
length -= 2;
|
||||
hdr_len += 2;
|
||||
}
|
||||
|
||||
if (length < 2)
|
||||
|
@ -1020,19 +1022,21 @@ ppp_print(register const u_char *p, u_int length)
|
|||
proto = *p; /* PFC is used */
|
||||
p++;
|
||||
length--;
|
||||
hdr_len++;
|
||||
} else {
|
||||
proto = EXTRACT_16BITS(p);
|
||||
p += 2;
|
||||
length -= 2;
|
||||
hdr_len += 2;
|
||||
}
|
||||
|
||||
if (eflag)
|
||||
printf("%s %d: ", ppp_protoname(proto), full_length);
|
||||
printf("%s %d: ", ppp_protoname(proto), full_length);
|
||||
|
||||
handle_ppp(proto, p, length);
|
||||
return;
|
||||
return (hdr_len);
|
||||
trunc:
|
||||
printf("[|ppp]");
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1161,8 +1165,7 @@ ppp_hdlc_if_print(u_char *user, const struct pcap_pkthdr *h,
|
|||
proto = EXTRACT_16BITS(p);
|
||||
p += 2;
|
||||
length -= 2;
|
||||
if (eflag)
|
||||
printf("%s: ", ppp_protoname(proto));
|
||||
printf("%s: ", ppp_protoname(proto));
|
||||
|
||||
handle_ppp(proto, p, length);
|
||||
break;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-pppoe.c,v 1.3 2002/02/18 09:37:08 itojun Exp $ */
|
||||
/* $NetBSD: print-pppoe.c,v 1.4 2002/05/31 09:45:46 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
|
@ -25,9 +25,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.15 2001/07/05 18:54:17 guy Exp (LBL)";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.16 2002/05/29 10:32:01 guy Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-pppoe.c,v 1.3 2002/02/18 09:37:08 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-pppoe.c,v 1.4 2002/05/31 09:45:46 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -106,6 +106,7 @@ pppoe_if_print(u_char *user, const struct pcap_pkthdr *h,
|
|||
{
|
||||
register u_int length = h->len;
|
||||
register u_int caplen = h->caplen;
|
||||
u_int hdr_len;
|
||||
|
||||
++infodelay;
|
||||
ts_print(&h->ts);
|
||||
|
@ -118,14 +119,23 @@ pppoe_if_print(u_char *user, const struct pcap_pkthdr *h,
|
|||
packetp = p;
|
||||
snapend = p + caplen;
|
||||
|
||||
pppoe_print(p, length);
|
||||
hdr_len = pppoe_print(p, length);
|
||||
|
||||
/*
|
||||
* If "-x" was specified, print stuff past the PPPoE and PPP headers,
|
||||
* if there's anything to print.
|
||||
*/
|
||||
if (xflag && caplen > hdr_len)
|
||||
default_print(p + hdr_len, caplen - hdr_len);
|
||||
|
||||
putchar('\n');
|
||||
|
||||
--infodelay;
|
||||
if (infoprint)
|
||||
info(0);
|
||||
}
|
||||
|
||||
void
|
||||
u_int
|
||||
pppoe_print(register const u_char *bp, u_int length)
|
||||
{
|
||||
u_short pppoe_ver, pppoe_type, pppoe_code, pppoe_sessionid, pppoe_length;
|
||||
|
@ -134,7 +144,7 @@ pppoe_print(register const u_char *bp, u_int length)
|
|||
pppoe_packet = bp;
|
||||
if (pppoe_packet > snapend) {
|
||||
printf("[|pppoe]");
|
||||
return;
|
||||
return (PPPOE_HDRLEN);
|
||||
}
|
||||
|
||||
pppoe_ver = (pppoe_packet[0] & 0xF0) >> 4;
|
||||
|
@ -146,7 +156,7 @@ pppoe_print(register const u_char *bp, u_int length)
|
|||
|
||||
if (snapend < pppoe_payload) {
|
||||
printf(" truncated PPPoE");
|
||||
return;
|
||||
return (PPPOE_HDRLEN);
|
||||
}
|
||||
|
||||
if (pppoe_ver != 1) {
|
||||
|
@ -218,9 +228,10 @@ pppoe_print(register const u_char *bp, u_int length)
|
|||
p += tag_len;
|
||||
/* p points to next tag */
|
||||
}
|
||||
return (0);
|
||||
} else {
|
||||
/* PPPoE data */
|
||||
printf(" ");
|
||||
ppp_print(pppoe_payload, pppoe_length);
|
||||
return (PPPOE_HDRLEN + ppp_print(pppoe_payload, pppoe_length));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-radius.c,v 1.4 2002/02/18 09:37:09 itojun Exp $ */
|
||||
/* $NetBSD: print-radius.c,v 1.5 2002/05/31 09:45:46 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 Alfredo Andres Omella. All rights reserved.
|
||||
|
@ -48,9 +48,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"Id: print-radius.c,v 1.10 2001/10/22 06:58:33 itojun Exp";
|
||||
"Id: print-radius.c,v 1.11 2002/04/20 09:40:42 guy Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-radius.c,v 1.4 2002/02/18 09:37:09 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-radius.c,v 1.5 2002/05/31 09:45:46 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -66,6 +66,10 @@ __RCSID("$NetBSD: print-radius.c,v 1.4 2002/02/18 09:37:09 itojun Exp $");
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef TIME_WITH_SYS_TIME
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-rx.c,v 1.5 2002/02/18 09:37:09 itojun Exp $ */
|
||||
/* $NetBSD: print-rx.c,v 1.6 2002/05/31 09:45:46 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright: (c) 2000 United States Government as represented by the
|
||||
|
@ -38,9 +38,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-rx.c,v 1.27 2001/10/20 07:41:55 itojun Exp";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-rx.c,v 1.29 2002/04/30 06:45:08 guy Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-rx.c,v 1.5 2002/02/18 09:37:09 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-rx.c,v 1.6 2002/05/31 09:45:46 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -51,7 +51,9 @@ __RCSID("$NetBSD: print-rx.c,v 1.5 2002/02/18 09:37:09 itojun Exp $");
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef TIME_WITH_SYS_TIME
|
||||
#include <time.h>
|
||||
#endif
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -762,15 +764,15 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, int sport,
|
|||
* This is the sickest one of all
|
||||
*/
|
||||
|
||||
#define VECOUT(MAX) { char *sp; \
|
||||
char s[AFSNAMEMAX]; \
|
||||
#define VECOUT(MAX) { u_char *sp; \
|
||||
u_char s[AFSNAMEMAX]; \
|
||||
int k; \
|
||||
if ((MAX) + 1 > sizeof(s)) \
|
||||
goto trunc; \
|
||||
TCHECK2(bp[0], (MAX) * sizeof(int32_t)); \
|
||||
sp = s; \
|
||||
for (k = 0; k < (MAX); k++) { \
|
||||
*sp++ = (char) EXTRACT_32BITS(bp); \
|
||||
*sp++ = (u_char) EXTRACT_32BITS(bp); \
|
||||
bp += sizeof(int32_t); \
|
||||
} \
|
||||
s[(MAX)] = '\0'; \
|
||||
|
@ -1135,7 +1137,7 @@ acl_print(u_char *s, int maxsize, u_char *end)
|
|||
goto finish;
|
||||
s += n;
|
||||
printf(" +{");
|
||||
fn_print(user, NULL);
|
||||
fn_print((u_char *)user, NULL);
|
||||
printf(" ");
|
||||
ACLOUT(acl);
|
||||
printf("}");
|
||||
|
@ -1148,7 +1150,7 @@ acl_print(u_char *s, int maxsize, u_char *end)
|
|||
goto finish;
|
||||
s += n;
|
||||
printf(" -{");
|
||||
fn_print(user, NULL);
|
||||
fn_print((u_char *)user, NULL);
|
||||
printf(" ");
|
||||
ACLOUT(acl);
|
||||
printf("}");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-sctp.c,v 1.4 2002/02/18 09:37:09 itojun Exp $ */
|
||||
/* $NetBSD: print-sctp.c,v 1.5 2002/05/31 09:45:46 itojun Exp $ */
|
||||
|
||||
/* Copyright (c) 2001 NETLAB, Temple University
|
||||
* Copyright (c) 2001 Protocol Engineering Lab, University of Delaware
|
||||
|
@ -39,9 +39,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-sctp.c,v 1.7 2001/12/12 07:16:40 guy Exp (NETLAB/PEL)";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-sctp.c,v 1.8 2002/04/25 04:45:59 guy Exp (NETLAB/PEL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-sctp.c,v 1.4 2002/02/18 09:37:09 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-sctp.c,v 1.5 2002/05/31 09:45:46 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -81,25 +81,25 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
|
|||
const struct ip6_hdr *ip6;
|
||||
#endif
|
||||
const u_char *cp;
|
||||
void *endPacketPtr;
|
||||
const void *endPacketPtr;
|
||||
u_short sourcePort, destPort;
|
||||
int chunkCount;
|
||||
struct sctpChunkDesc *chunkDescPtr;
|
||||
void *nextChunk;
|
||||
const struct sctpChunkDesc *chunkDescPtr;
|
||||
const void *nextChunk;
|
||||
|
||||
sctpPktHdr = (struct sctpHeader*) bp;
|
||||
endPacketPtr = ((u_char*)((u_char*)sctpPktHdr+sctpPacketLength));
|
||||
sctpPktHdr = (const struct sctpHeader*) bp;
|
||||
endPacketPtr = (const u_char*)sctpPktHdr+sctpPacketLength;
|
||||
|
||||
if( (u_long) endPacketPtr > (u_long) snapend)
|
||||
endPacketPtr = (void *) snapend;
|
||||
endPacketPtr = (const void *) snapend;
|
||||
ip = (struct ip *)bp2;
|
||||
#ifdef INET6
|
||||
if (IP_V(ip) == 6)
|
||||
ip6 = (struct ip6_hdr *)bp2;
|
||||
ip6 = (const struct ip6_hdr *)bp2;
|
||||
else
|
||||
ip6 = NULL;
|
||||
#endif /*INET6*/
|
||||
cp = (u_char *)(sctpPktHdr + 1);
|
||||
cp = (const u_char *)(sctpPktHdr + 1);
|
||||
if (cp > snapend)
|
||||
{
|
||||
printf("[|sctp]");
|
||||
|
@ -152,31 +152,32 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
|
|||
|
||||
/* cycle through all chunks, printing information on each one */
|
||||
for (chunkCount = 0,
|
||||
chunkDescPtr = (struct sctpChunkDesc *) ( (u_char*) sctpPktHdr +
|
||||
sizeof(struct sctpHeader));
|
||||
chunkDescPtr = (const struct sctpChunkDesc *)
|
||||
((const u_char*) sctpPktHdr + sizeof(struct sctpHeader));
|
||||
chunkDescPtr != NULL &&
|
||||
( (void *) ((u_char *) chunkDescPtr + sizeof(struct sctpChunkDesc))
|
||||
( (const void *)
|
||||
((const u_char *) chunkDescPtr + sizeof(struct sctpChunkDesc))
|
||||
<= endPacketPtr);
|
||||
|
||||
chunkDescPtr = (struct sctpChunkDesc *) nextChunk, chunkCount++)
|
||||
chunkDescPtr = (const struct sctpChunkDesc *) nextChunk, chunkCount++)
|
||||
{
|
||||
u_short align;
|
||||
u_char *chunkEnd;
|
||||
const u_char *chunkEnd;
|
||||
|
||||
chunkEnd = ((u_char*)chunkDescPtr + ntohs(chunkDescPtr->chunkLength));
|
||||
chunkEnd = ((const u_char*)chunkDescPtr + ntohs(chunkDescPtr->chunkLength));
|
||||
|
||||
align=ntohs(chunkDescPtr->chunkLength) % 4;
|
||||
if (align != 0)
|
||||
align = 4 - align;
|
||||
|
||||
nextChunk = (void *) (chunkEnd + align);
|
||||
nextChunk = (const void *) (chunkEnd + align);
|
||||
|
||||
printf("\n\t%d) ", chunkCount+1);
|
||||
switch (chunkDescPtr->chunkID)
|
||||
{
|
||||
case SCTP_DATA :
|
||||
{
|
||||
struct sctpDataPart *dataHdrPtr;
|
||||
const struct sctpDataPart *dataHdrPtr;
|
||||
|
||||
printf("[DATA] ");
|
||||
|
||||
|
@ -202,7 +203,7 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
|
|||
== SCTP_DATA_LAST_FRAG) )
|
||||
printf(" ");
|
||||
|
||||
dataHdrPtr=(struct sctpDataPart*)(chunkDescPtr+1);
|
||||
dataHdrPtr=(const struct sctpDataPart*)(chunkDescPtr+1);
|
||||
|
||||
printf("[TSN: %u] ", (u_int32_t)ntohl(dataHdrPtr->TSN));
|
||||
printf("[SID: %u] ", ntohs(dataHdrPtr->streamId));
|
||||
|
@ -212,12 +213,12 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
|
|||
|
||||
if (vflag) /* if verbose output is specified */
|
||||
{ /* at the command line */
|
||||
char *payloadPtr;
|
||||
const u_char *payloadPtr;
|
||||
|
||||
printf("[Payload");
|
||||
|
||||
if (!xflag && !qflag) {
|
||||
payloadPtr = (char *) (++dataHdrPtr);
|
||||
payloadPtr = (const u_char *) (++dataHdrPtr);
|
||||
printf(":");
|
||||
default_print(payloadPtr,
|
||||
htons(chunkDescPtr->chunkLength)-1 -
|
||||
|
@ -229,10 +230,10 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
|
|||
}
|
||||
case SCTP_INITIATION :
|
||||
{
|
||||
struct sctpInitiation *init;
|
||||
const struct sctpInitiation *init;
|
||||
|
||||
printf("[INIT] ");
|
||||
init=(struct sctpInitiation*)(chunkDescPtr+1);
|
||||
init=(const struct sctpInitiation*)(chunkDescPtr+1);
|
||||
printf("[init tag: %u] ", (u_int32_t)ntohl(init->initTag));
|
||||
printf("[rwnd: %u] ", (u_int32_t)ntohl(init->rcvWindowCredit));
|
||||
printf("[OS: %u] ", ntohs(init->NumPreopenStreams));
|
||||
|
@ -248,10 +249,10 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
|
|||
}
|
||||
case SCTP_INITIATION_ACK :
|
||||
{
|
||||
struct sctpInitiation *init;
|
||||
const struct sctpInitiation *init;
|
||||
|
||||
printf("[INIT ACK] ");
|
||||
init=(struct sctpInitiation*)(chunkDescPtr+1);
|
||||
init=(const struct sctpInitiation*)(chunkDescPtr+1);
|
||||
printf("[init tag: %u] ", (u_int32_t)ntohl(init->initTag));
|
||||
printf("[rwnd: %u] ", (u_int32_t)ntohl(init->rcvWindowCredit));
|
||||
printf("[OS: %u] ", ntohs(init->NumPreopenStreams));
|
||||
|
@ -267,13 +268,13 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
|
|||
}
|
||||
case SCTP_SELECTIVE_ACK:
|
||||
{
|
||||
struct sctpSelectiveAck *sack;
|
||||
struct sctpSelectiveFrag *frag;
|
||||
const struct sctpSelectiveAck *sack;
|
||||
const struct sctpSelectiveFrag *frag;
|
||||
int fragNo, tsnNo;
|
||||
u_long *dupTSN;
|
||||
const u_long *dupTSN;
|
||||
|
||||
printf("[SACK] ");
|
||||
sack=(struct sctpSelectiveAck*)(chunkDescPtr+1);
|
||||
sack=(const struct sctpSelectiveAck*)(chunkDescPtr+1);
|
||||
printf("[cum ack %u] ", (u_int32_t)ntohl(sack->highestConseqTSN));
|
||||
printf("[a_rwnd %u] ", (u_int32_t)ntohl(sack->updatedRwnd));
|
||||
printf("[#gap acks %u] ", ntohs(sack->numberOfdesc));
|
||||
|
@ -281,10 +282,10 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
|
|||
|
||||
|
||||
/* print gaps */
|
||||
for (frag = ( (struct sctpSelectiveFrag *)
|
||||
((struct sctpSelectiveAck *) sack+1)),
|
||||
for (frag = ( (const struct sctpSelectiveFrag *)
|
||||
((const struct sctpSelectiveAck *) sack+1)),
|
||||
fragNo=0;
|
||||
(void *)frag < nextChunk && fragNo < ntohs(sack->numberOfdesc);
|
||||
(const void *)frag < nextChunk && fragNo < ntohs(sack->numberOfdesc);
|
||||
frag++, fragNo++)
|
||||
printf("\n\t\t[gap ack block #%d: start = %u, end = %u] ",
|
||||
fragNo+1,
|
||||
|
@ -293,8 +294,8 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
|
|||
|
||||
|
||||
/* print duplicate TSNs */
|
||||
for (dupTSN = (u_long*)frag, tsnNo=0;
|
||||
(void *) dupTSN < nextChunk && tsnNo<ntohs(sack->numDupTsns);
|
||||
for (dupTSN = (const u_long*)frag, tsnNo=0;
|
||||
(const void *) dupTSN < nextChunk && tsnNo<ntohs(sack->numDupTsns);
|
||||
dupTSN++, tsnNo++)
|
||||
printf("\n\t\t[dup TSN #%u: %u] ", tsnNo+1,
|
||||
(u_int32_t)ntohl(*dupTSN));
|
||||
|
@ -303,9 +304,9 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
|
|||
}
|
||||
case SCTP_HEARTBEAT_REQUEST :
|
||||
{
|
||||
struct sctpHBsender *hb;
|
||||
const struct sctpHBsender *hb;
|
||||
|
||||
hb=(struct sctpHBsender*)chunkDescPtr;
|
||||
hb=(const struct sctpHBsender*)chunkDescPtr;
|
||||
|
||||
printf("[HB REQ] ");
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-smb.c,v 1.3 2002/02/18 09:37:09 itojun Exp $ */
|
||||
/* $NetBSD: print-smb.c,v 1.4 2002/05/31 09:45:46 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) Andrew Tridgell 1995-1999
|
||||
|
@ -16,9 +16,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-smb.c,v 1.20 2002/01/17 04:38:29 guy Exp";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-smb.c,v 1.23 2002/04/30 09:09:41 guy Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-smb.c,v 1.3 2002/02/18 09:37:09 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-smb.c,v 1.4 2002/05/31 09:45:46 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -26,6 +26,8 @@ __RCSID("$NetBSD: print-smb.c,v 1.3 2002/02/18 09:37:09 itojun Exp $");
|
|||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "extract.h"
|
||||
#include "smb.h"
|
||||
|
@ -180,7 +182,7 @@ print_trans2(const u_char *words, const u_char *dat, const u_char *buf, const u_
|
|||
static struct smbfnsint *fn = &trans2_fns[0];
|
||||
const u_char *data, *param;
|
||||
const u_char *w = words + 1;
|
||||
const u_char *f1 = NULL, *f2 = NULL;
|
||||
const char *f1 = NULL, *f2 = NULL;
|
||||
int pcnt, dcnt;
|
||||
|
||||
TCHECK(words[0]);
|
||||
|
@ -231,8 +233,8 @@ print_trans2(const u_char *words, const u_char *dat, const u_char *buf, const u_
|
|||
if (fn->descript.fn)
|
||||
(*fn->descript.fn)(param, data, pcnt, dcnt);
|
||||
else {
|
||||
smb_fdata(param, f1 ? f1 : (u_char *)"Paramaters=\n", param + pcnt);
|
||||
smb_fdata(data, f2 ? f2 : (u_char *)"Data=\n", data + dcnt);
|
||||
smb_fdata(param, f1 ? f1 : "Parameters=\n", param + pcnt);
|
||||
smb_fdata(data, f2 ? f2 : "Data=\n", data + dcnt);
|
||||
}
|
||||
return;
|
||||
trunc:
|
||||
|
@ -336,7 +338,7 @@ print_ipc(const u_char *param, int paramlen, const u_char *data, int datalen)
|
|||
static void
|
||||
print_trans(const u_char *words, const u_char *data1, const u_char *buf, const u_char *maxbuf)
|
||||
{
|
||||
const u_char *f1, *f2, *f3, *f4;
|
||||
const char *f1, *f2, *f3, *f4;
|
||||
const u_char *data, *param;
|
||||
const u_char *w = words + 1;
|
||||
int datalen, paramlen;
|
||||
|
@ -390,7 +392,7 @@ trunc:
|
|||
static void
|
||||
print_negprot(const u_char *words, const u_char *data, const u_char *buf, const u_char *maxbuf)
|
||||
{
|
||||
u_char *f1 = NULL, *f2 = NULL;
|
||||
const char *f1 = NULL, *f2 = NULL;
|
||||
|
||||
TCHECK(words[0]);
|
||||
if (request)
|
||||
|
@ -425,7 +427,7 @@ static void
|
|||
print_sesssetup(const u_char *words, const u_char *data, const u_char *buf, const u_char *maxbuf)
|
||||
{
|
||||
int wcnt;
|
||||
u_char *f1 = NULL, *f2 = NULL;
|
||||
const char *f1 = NULL, *f2 = NULL;
|
||||
|
||||
TCHECK(words[0]);
|
||||
wcnt = words[0];
|
||||
|
@ -769,7 +771,7 @@ print_smb(const u_char *buf, const u_char *maxbuf)
|
|||
TCHECK(words[0]);
|
||||
|
||||
for (;;) {
|
||||
const u_char *f1, *f2;
|
||||
const char *f1, *f2;
|
||||
int wct;
|
||||
int bcc;
|
||||
|
||||
|
@ -864,9 +866,9 @@ nbt_tcp_print(const u_char *data, int length)
|
|||
return;
|
||||
|
||||
if (vflag > 1)
|
||||
printf ("\n>>> ");
|
||||
printf ("\n>>>");
|
||||
|
||||
printf("NBT Packet");
|
||||
printf(" NBT Packet");
|
||||
|
||||
if (vflag < 2)
|
||||
return;
|
||||
|
@ -956,7 +958,7 @@ nbt_udp137_print(const u_char *data, int length)
|
|||
int name_trn_id, response, opcode, nm_flags, rcode;
|
||||
int qdcount, ancount, nscount, arcount;
|
||||
char *opcodestr;
|
||||
const char *p;
|
||||
const u_char *p;
|
||||
int total, i;
|
||||
|
||||
TCHECK2(data[10], 2);
|
||||
|
@ -1085,14 +1087,14 @@ nbt_udp137_print(const u_char *data, int length)
|
|||
p += 2;
|
||||
}
|
||||
} else {
|
||||
print_data(p, min(rdlen, length - ((const u_char *)p - data)));
|
||||
print_data(p, min(rdlen, length - (p - data)));
|
||||
p += rdlen;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((u_char*)p < maxbuf)
|
||||
if (p < maxbuf)
|
||||
smb_fdata(p, "AdditionalData:\n", maxbuf);
|
||||
|
||||
out:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-snmp.c,v 1.4 2002/02/18 09:37:10 itojun Exp $ */
|
||||
/* $NetBSD: print-snmp.c,v 1.5 2002/05/31 09:45:46 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
|
||||
|
@ -62,9 +62,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-snmp.c,v 1.50 2001/09/17 22:16:53 fenner Exp (LBL)";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-snmp.c,v 1.52 2002/05/07 18:27:40 fenner Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-snmp.c,v 1.4 2002/02/18 09:37:10 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-snmp.c,v 1.5 2002/05/31 09:45:46 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -695,13 +695,17 @@ asn1_print(struct be *elem)
|
|||
|
||||
/*
|
||||
* first subitem encodes two items with 1st*OIDMUX+2nd
|
||||
* (see X.690:1997 clause 8.19 for the details)
|
||||
*/
|
||||
if (first < 0) {
|
||||
int s;
|
||||
if (!nflag)
|
||||
objp = mibroot;
|
||||
first = 0;
|
||||
OBJ_PRINT(o/OIDMUX, first);
|
||||
o %= OIDMUX;
|
||||
s = o / OIDMUX;
|
||||
if (s > 2) s = 2;
|
||||
OBJ_PRINT(s, first);
|
||||
o -= s * OIDMUX;
|
||||
}
|
||||
OBJ_PRINT(o, first);
|
||||
if (--first < 0)
|
||||
|
@ -882,16 +886,19 @@ static void smi_decode_oid(struct be *elem, unsigned int *oid,
|
|||
|
||||
/*
|
||||
* first subitem encodes two items with 1st*OIDMUX+2nd
|
||||
* (see X.690:1997 clause 8.19 for the details)
|
||||
*/
|
||||
if (first < 0) {
|
||||
first = 0;
|
||||
if (*oidlen < oidsize) {
|
||||
oid[(*oidlen)++] = o/OIDMUX;
|
||||
oid[*oidlen] = o / OIDMUX;
|
||||
if (oid[*oidlen] > 2) oid[*oidlen] = 2;
|
||||
}
|
||||
o %= OIDMUX;
|
||||
o -= oid[*oidlen] * OIDMUX;
|
||||
if (*oidlen < oidsize) (*oidlen)++;
|
||||
}
|
||||
if (*oidlen < oidsize) {
|
||||
oid[(*oidlen)++] = o;
|
||||
oid[(*oidlen)++] = o;
|
||||
}
|
||||
o = 0;
|
||||
}
|
||||
|
@ -1462,7 +1469,7 @@ pdu_print(const u_char *np, u_int length, int version)
|
|||
}
|
||||
|
||||
if (vflag) {
|
||||
fputs("} ", stdout);
|
||||
fputs(" } ", stdout);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-stp.c,v 1.2 2001/06/25 20:00:01 itojun Exp $ */
|
||||
/* $NetBSD: print-stp.c,v 1.3 2002/05/31 09:45:46 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 Lennert Buytenhek
|
||||
|
@ -15,9 +15,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-stp.c,v 1.6 2000/09/29 04:58:50 guy Exp";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-stp.c,v 1.7 2002/05/29 09:59:12 guy Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-stp.c,v 1.2 2001/06/25 20:00:01 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-stp.c,v 1.3 2002/05/31 09:45:46 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -103,7 +103,7 @@ stp_print(const u_char *p, u_int length)
|
|||
break;
|
||||
|
||||
default:
|
||||
printf("unknown type %i\n", p[6]);
|
||||
printf("unknown type %i", p[6]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-token.c,v 1.3 2002/02/18 09:37:10 itojun Exp $ */
|
||||
/* $NetBSD: print-token.c,v 1.4 2002/05/31 09:45:46 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
|
||||
|
@ -29,9 +29,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-token.c,v 1.13 2001/09/18 15:46:37 fenner Exp";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-token.c,v 1.15 2002/05/29 10:06:27 guy Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-token.c,v 1.3 2002/02/18 09:37:10 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-token.c,v 1.4 2002/05/31 09:45:46 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -68,7 +68,7 @@ extract_token_addrs(const struct token_header *trp, char *fsrc, char *fdst)
|
|||
* Print the TR MAC header
|
||||
*/
|
||||
static inline void
|
||||
token_print(register const struct token_header *trp, register u_int length,
|
||||
token_hdr_print(register const struct token_header *trp, register u_int length,
|
||||
register const u_char *fsrc, register const u_char *fdst)
|
||||
{
|
||||
const char *srcname, *dstname;
|
||||
|
@ -108,30 +108,19 @@ static const char *largest_frame[] = {
|
|||
"??"
|
||||
};
|
||||
|
||||
/*
|
||||
* This is the top level routine of the printer. 'p' is the points
|
||||
* to the TR header of the packet, 'tvp' is the timestamp,
|
||||
* 'length' is the length of the packet off the wire, and 'caplen'
|
||||
* is the number of bytes actually captured.
|
||||
*/
|
||||
void
|
||||
token_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
u_int
|
||||
token_print(const u_char *p, u_int length, u_int caplen)
|
||||
{
|
||||
u_int caplen = h->caplen;
|
||||
u_int length = h->len;
|
||||
const struct token_header *trp;
|
||||
u_short extracted_ethertype;
|
||||
struct ether_header ehdr;
|
||||
u_int route_len = 0, seg;
|
||||
u_int route_len = 0, hdr_len = TOKEN_HDRLEN, seg;
|
||||
|
||||
trp = (const struct token_header *)p;
|
||||
|
||||
++infodelay;
|
||||
ts_print(&h->ts);
|
||||
|
||||
if (caplen < TOKEN_HDRLEN) {
|
||||
printf("[|token-ring]");
|
||||
goto out;
|
||||
return hdr_len;
|
||||
}
|
||||
/*
|
||||
* Get the TR addresses into a canonical form
|
||||
|
@ -157,7 +146,7 @@ token_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
|||
*ESRC(&ehdr) &= 0x7f;
|
||||
|
||||
if (eflag)
|
||||
token_print(trp, length, ESRC(&ehdr), EDST(&ehdr));
|
||||
token_hdr_print(trp, length, ESRC(&ehdr), EDST(&ehdr));
|
||||
|
||||
route_len = RIF_LENGTH(trp);
|
||||
if (vflag) {
|
||||
|
@ -176,13 +165,14 @@ token_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
|||
printf(" (%s) ", largest_frame[LARGEST_FRAME(trp)]);
|
||||
} else {
|
||||
if (eflag)
|
||||
token_print(trp, length, ESRC(&ehdr), EDST(&ehdr));
|
||||
token_hdr_print(trp, length, ESRC(&ehdr), EDST(&ehdr));
|
||||
}
|
||||
|
||||
/* Skip over token ring MAC header and routing information */
|
||||
length -= TOKEN_HDRLEN + route_len;
|
||||
p += TOKEN_HDRLEN + route_len;
|
||||
caplen -= TOKEN_HDRLEN + route_len;
|
||||
hdr_len += route_len;
|
||||
length -= hdr_len;
|
||||
p += hdr_len;
|
||||
caplen -= hdr_len;
|
||||
|
||||
/* Frame Control field determines interpretation of packet */
|
||||
extracted_ethertype = 0;
|
||||
|
@ -192,7 +182,7 @@ token_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
|||
&extracted_ethertype) == 0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag)
|
||||
token_print(trp,
|
||||
token_hdr_print(trp,
|
||||
length + TOKEN_HDRLEN + route_len,
|
||||
ESRC(&ehdr), EDST(&ehdr));
|
||||
if (extracted_ethertype) {
|
||||
|
@ -206,15 +196,41 @@ token_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
|||
/* Some kinds of TR packet we cannot handle intelligently */
|
||||
/* XXX - dissect MAC packets if frame type is 0 */
|
||||
if (!eflag)
|
||||
token_print(trp, length + TOKEN_HDRLEN + route_len,
|
||||
token_hdr_print(trp, length + TOKEN_HDRLEN + route_len,
|
||||
ESRC(&ehdr), EDST(&ehdr));
|
||||
if (!xflag && !qflag)
|
||||
default_print(p, caplen);
|
||||
}
|
||||
if (xflag)
|
||||
default_print(p, caplen);
|
||||
out:
|
||||
return (hdr_len);
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the top level routine of the printer. 'p' is the points
|
||||
* to the TR header of the packet, 'tvp' is the timestamp,
|
||||
* 'length' is the length of the packet off the wire, and 'caplen'
|
||||
* is the number of bytes actually captured.
|
||||
*/
|
||||
void
|
||||
token_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
{
|
||||
u_int caplen = h->caplen;
|
||||
u_int length = h->len;
|
||||
u_int hdr_len;
|
||||
|
||||
++infodelay;
|
||||
ts_print(&h->ts);
|
||||
|
||||
hdr_len = token_print(p, length, caplen);
|
||||
|
||||
/*
|
||||
* If "-x" was specified, print stuff past the Token Ring header,
|
||||
* if there's anything to print.
|
||||
*/
|
||||
if (xflag && caplen > hdr_len)
|
||||
default_print(p + hdr_len, caplen - hdr_len);
|
||||
|
||||
putchar('\n');
|
||||
|
||||
--infodelay;
|
||||
if (infoprint)
|
||||
info(0);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-udp.c,v 1.4 2002/02/18 09:37:10 itojun Exp $ */
|
||||
/* $NetBSD: print-udp.c,v 1.5 2002/05/31 09:45:46 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
|
@ -25,9 +25,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-udp.c,v 1.101 2001/10/08 21:25:24 fenner Exp (LBL)";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-udp.c,v 1.103 2001/12/03 02:06:10 itojun Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-udp.c,v 1.4 2002/02/18 09:37:10 itojun Exp $");
|
||||
__RCSID("$NetBSD: print-udp.c,v 1.5 2002/05/31 09:45:46 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -402,6 +402,44 @@ static int udp6_cksum(const struct ip6_hdr *ip6, const struct udphdr *up,
|
|||
#define DHCP6_CLI_PORT 547 /*XXX*/
|
||||
#endif
|
||||
|
||||
static void
|
||||
udpipaddr_print(const struct ip *ip, u_int16_t sport, u_int16_t dport)
|
||||
{
|
||||
#ifdef INET6
|
||||
const struct ip6_hdr *ip6;
|
||||
|
||||
if (IP_V(ip) == 6)
|
||||
ip6 = (const struct ip6_hdr *)ip;
|
||||
else
|
||||
ip6 = NULL;
|
||||
|
||||
if (ip6) {
|
||||
if (ip6->ip6_nxt == IPPROTO_UDP) {
|
||||
(void)printf("%s.%s > %s.%s: ",
|
||||
ip6addr_string(&ip6->ip6_src),
|
||||
udpport_string(sport),
|
||||
ip6addr_string(&ip6->ip6_dst),
|
||||
udpport_string(dport));
|
||||
} else {
|
||||
(void)printf("%s > %s: ",
|
||||
udpport_string(sport), udpport_string(dport));
|
||||
}
|
||||
} else
|
||||
#endif /*INET6*/
|
||||
{
|
||||
if (ip->ip_p == IPPROTO_UDP) {
|
||||
(void)printf("%s.%s > %s.%s: ",
|
||||
ipaddr_string(&ip->ip_src),
|
||||
udpport_string(sport),
|
||||
ipaddr_string(&ip->ip_dst),
|
||||
udpport_string(dport));
|
||||
} else {
|
||||
(void)printf("%s > %s: ",
|
||||
udpport_string(sport), udpport_string(dport));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
udp_print(register const u_char *bp, u_int length,
|
||||
register const u_char *bp2, int fragmented)
|
||||
|
@ -456,20 +494,12 @@ udp_print(register const u_char *bp, u_int length,
|
|||
switch (packettype) {
|
||||
|
||||
case PT_VAT:
|
||||
(void)printf("%s.%s > %s.%s: ",
|
||||
ipaddr_string(&ip->ip_src),
|
||||
udpport_string(sport),
|
||||
ipaddr_string(&ip->ip_dst),
|
||||
udpport_string(dport));
|
||||
udpipaddr_print(ip, sport, dport);
|
||||
vat_print((void *)(up + 1), length, up);
|
||||
break;
|
||||
|
||||
case PT_WB:
|
||||
(void)printf("%s.%s > %s.%s: ",
|
||||
ipaddr_string(&ip->ip_src),
|
||||
udpport_string(sport),
|
||||
ipaddr_string(&ip->ip_dst),
|
||||
udpport_string(dport));
|
||||
udpipaddr_print(ip, sport, dport);
|
||||
wb_print((void *)(up + 1), length);
|
||||
break;
|
||||
|
||||
|
@ -485,39 +515,23 @@ udp_print(register const u_char *bp, u_int length,
|
|||
break;
|
||||
|
||||
case PT_RTP:
|
||||
(void)printf("%s.%s > %s.%s: ",
|
||||
ipaddr_string(&ip->ip_src),
|
||||
udpport_string(sport),
|
||||
ipaddr_string(&ip->ip_dst),
|
||||
udpport_string(dport));
|
||||
udpipaddr_print(ip, sport, dport);
|
||||
rtp_print((void *)(up + 1), length, up);
|
||||
break;
|
||||
|
||||
case PT_RTCP:
|
||||
(void)printf("%s.%s > %s.%s:",
|
||||
ipaddr_string(&ip->ip_src),
|
||||
udpport_string(sport),
|
||||
ipaddr_string(&ip->ip_dst),
|
||||
udpport_string(dport));
|
||||
udpipaddr_print(ip, sport, dport);
|
||||
while (cp < ep)
|
||||
cp = rtcp_print(cp, ep);
|
||||
break;
|
||||
|
||||
case PT_SNMP:
|
||||
(void)printf("%s.%s > %s.%s:",
|
||||
ipaddr_string(&ip->ip_src),
|
||||
udpport_string(sport),
|
||||
ipaddr_string(&ip->ip_dst),
|
||||
udpport_string(dport));
|
||||
udpipaddr_print(ip, sport, dport);
|
||||
snmp_print((const u_char *)(up + 1), length);
|
||||
break;
|
||||
|
||||
case PT_CNFP:
|
||||
(void)printf("%s.%s > %s.%s:",
|
||||
ipaddr_string(&ip->ip_src),
|
||||
udpport_string(sport),
|
||||
ipaddr_string(&ip->ip_dst),
|
||||
udpport_string(dport));
|
||||
udpipaddr_print(ip, sport, dport);
|
||||
cnfp_print(cp, length, (const u_char *)ip);
|
||||
break;
|
||||
}
|
||||
|
@ -557,32 +571,7 @@ udp_print(register const u_char *bp, u_int length,
|
|||
return;
|
||||
}
|
||||
}
|
||||
#ifdef INET6
|
||||
if (ip6) {
|
||||
if (ip6->ip6_nxt == IPPROTO_UDP) {
|
||||
(void)printf("%s.%s > %s.%s: ",
|
||||
ip6addr_string(&ip6->ip6_src),
|
||||
udpport_string(sport),
|
||||
ip6addr_string(&ip6->ip6_dst),
|
||||
udpport_string(dport));
|
||||
} else {
|
||||
(void)printf("%s > %s: ",
|
||||
udpport_string(sport), udpport_string(dport));
|
||||
}
|
||||
} else
|
||||
#endif /*INET6*/
|
||||
{
|
||||
if (ip->ip_p == IPPROTO_UDP) {
|
||||
(void)printf("%s.%s > %s.%s: ",
|
||||
ipaddr_string(&ip->ip_src),
|
||||
udpport_string(sport),
|
||||
ipaddr_string(&ip->ip_dst),
|
||||
udpport_string(dport));
|
||||
} else {
|
||||
(void)printf("%s > %s: ",
|
||||
udpport_string(sport), udpport_string(dport));
|
||||
}
|
||||
}
|
||||
udpipaddr_print(ip, sport, dport);
|
||||
|
||||
if (IP_V(ip) == 4 && vflag && !fragmented) {
|
||||
int sum = up->uh_sum;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: print-zephyr.c,v 1.2 2002/04/09 02:53:20 thorpej Exp $ */
|
||||
/* $NetBSD: print-zephyr.c,v 1.3 2002/05/31 09:45:46 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Decode and print Zephyr packets.
|
||||
|
@ -24,9 +24,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-zephyr.c,v 1.2 2001/09/11 02:37:12 guy Exp";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-zephyr.c,v 1.4 2002/04/27 23:39:25 guy Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-zephyr.c,v 1.2 2002/04/09 02:53:20 thorpej Exp $");
|
||||
__RCSID("$NetBSD: print-zephyr.c,v 1.3 2002/05/31 09:45:46 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -63,7 +63,7 @@ struct z_packet {
|
|||
/* Other fields follow here.. */
|
||||
};
|
||||
|
||||
enum {
|
||||
enum z_packet_type {
|
||||
Z_PACKET_UNSAFE = 0,
|
||||
Z_PACKET_UNACKED,
|
||||
Z_PACKET_ACKED,
|
||||
|
@ -73,7 +73,7 @@ enum {
|
|||
Z_PACKET_SERVNAK,
|
||||
Z_PACKET_CLIENTACK,
|
||||
Z_PACKET_STAT
|
||||
} z_packet_type;
|
||||
};
|
||||
|
||||
static struct tok z_types[] = {
|
||||
{ Z_PACKET_UNSAFE, "unsafe" },
|
||||
|
@ -129,7 +129,7 @@ str_to_lower(char *string)
|
|||
|
||||
string = z_buf;
|
||||
while (*string) {
|
||||
*string = tolower(*string);
|
||||
*string = tolower((unsigned char)(*string));
|
||||
string++;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: smbutil.c,v 1.4 2002/02/18 09:37:10 itojun Exp $ */
|
||||
/* $NetBSD: smbutil.c,v 1.5 2002/05/31 09:45:46 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) Andrew Tridgell 1995-1999
|
||||
|
@ -16,9 +16,9 @@
|
|||
#ifndef lint
|
||||
#if 0
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/smbutil.c,v 1.18 2002/01/17 04:38:29 guy Exp";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/smbutil.c,v 1.21 2002/04/26 05:12:40 guy Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: smbutil.c,v 1.4 2002/02/18 09:37:10 itojun Exp $");
|
||||
__RCSID("$NetBSD: smbutil.c,v 1.5 2002/05/31 09:45:46 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -33,7 +33,9 @@ __RCSID("$NetBSD: smbutil.c,v 1.4 2002/02/18 09:37:10 itojun Exp $");
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef TIME_WITH_SYS_TIME
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#include "interface.h"
|
||||
#include "extract.h"
|
||||
|
@ -343,7 +345,7 @@ write_bits(unsigned int val, char *fmt)
|
|||
|
||||
/* convert a UCS2 string into iso-8859-1 string */
|
||||
static const char *
|
||||
unistr(const char *s, int *len)
|
||||
unistr(const u_char *s, int *len)
|
||||
{
|
||||
static char buf[1000];
|
||||
int l=0;
|
||||
|
@ -359,8 +361,8 @@ unistr(const char *s, int *len)
|
|||
|
||||
/* maybe it isn't unicode - a cheap trick */
|
||||
if (!use_unicode || (s[0] && s[1])) {
|
||||
*len = strlen(s) + 1;
|
||||
return s;
|
||||
*len = strlen((const char *)s) + 1;
|
||||
return (const char *)s;
|
||||
}
|
||||
|
||||
*len = 0;
|
||||
|
@ -405,8 +407,11 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
|
|||
case '{':
|
||||
{
|
||||
char bitfmt[128];
|
||||
char *p = strchr(++fmt, '}');
|
||||
int l = PTR_DIFF(p, fmt);
|
||||
char *p;
|
||||
int l;
|
||||
|
||||
p = strchr(++fmt, '}');
|
||||
l = PTR_DIFF(p, fmt);
|
||||
strncpy(bitfmt, fmt, l);
|
||||
bitfmt[l] = 0;
|
||||
fmt = p + 1;
|
||||
|
@ -420,7 +425,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
|
|||
int l = atoi(fmt + 1);
|
||||
buf += l;
|
||||
fmt++;
|
||||
while (isdigit(*fmt))
|
||||
while (isdigit((unsigned char)*fmt))
|
||||
fmt++;
|
||||
break;
|
||||
}
|
||||
|
@ -534,7 +539,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
|
|||
printf("%-*.*s", l, l, buf);
|
||||
buf += l;
|
||||
fmt++;
|
||||
while (isdigit(*fmt))
|
||||
while (isdigit((unsigned char)*fmt))
|
||||
fmt++;
|
||||
break;
|
||||
}
|
||||
|
@ -544,7 +549,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
|
|||
while (l--)
|
||||
printf("%02x", *buf++);
|
||||
fmt++;
|
||||
while (isdigit(*fmt))
|
||||
while (isdigit((unsigned char)*fmt))
|
||||
fmt++;
|
||||
break;
|
||||
}
|
||||
|
@ -576,7 +581,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
|
|||
break;
|
||||
}
|
||||
fmt++;
|
||||
while (isdigit(*fmt))
|
||||
while (isdigit((unsigned char)*fmt))
|
||||
fmt++;
|
||||
break;
|
||||
}
|
||||
|
@ -608,7 +613,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
|
|||
}
|
||||
printf("%s", t ? asctime(localtime(&t)) : "NULL\n");
|
||||
fmt++;
|
||||
while (isdigit(*fmt))
|
||||
while (isdigit((unsigned char)*fmt))
|
||||
fmt++;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
.\" $NetBSD: tcpdump.8,v 1.4 2002/02/18 09:37:11 itojun Exp $
|
||||
.\" @(#) Header: /tcpdump/master/tcpdump/tcpdump.1,v 1.114 2002/01/04 07:37:49 guy Exp (LBL)
|
||||
.\" $NetBSD: tcpdump.8,v 1.5 2002/05/31 09:45:46 itojun Exp $
|
||||
.\" @(#) Header: /tcpdump/master/tcpdump/tcpdump.1,v 1.120 2002/05/17 09:57:50 guy Exp (LBL)
|
||||
.\"
|
||||
.\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1997
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
|
@ -28,7 +28,7 @@ tcpdump \- dump traffic on a network
|
|||
.na
|
||||
.B tcpdump
|
||||
[
|
||||
.B \-adeflnNOpqRStuvxX
|
||||
.B \-aAdeflnNOpqRStuvxX
|
||||
] [
|
||||
.B \-c
|
||||
.I count
|
||||
|
@ -142,6 +142,10 @@ You must have read access to
|
|||
Reading a saved packet file doesn't require special privileges.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.TP
|
||||
.B \-A
|
||||
Print each packet (minus its link level header) in ASCII. Handy for
|
||||
capturing web pages.
|
||||
.B \-a
|
||||
Attempt to convert network and broadcast addresses to names.
|
||||
.TP
|
||||
|
@ -308,6 +312,7 @@ on each dump line.
|
|||
.TP
|
||||
.B \-tttt
|
||||
Print a timestamp in default format proceeded by date on each dump line.
|
||||
.TP
|
||||
.B \-u
|
||||
Print undecoded NFS handles.
|
||||
.TP
|
||||
|
@ -726,9 +731,11 @@ data inside the packet, use the following syntax:
|
|||
\fIproto\fB [ \fIexpr\fB : \fIsize\fB ]\fR
|
||||
.fi
|
||||
.in -.5i
|
||||
\fIProto\fR is one of \fBether, fddi, tr,
|
||||
\fIProto\fR is one of \fBether, fddi, tr, ppp, slip, link,
|
||||
ip, arp, rarp, tcp, udp, icmp\fR or \fBip6\fR, and
|
||||
indicates the protocol layer for the index operation.
|
||||
(\fBether, fddi, tr, ppp, slip\fR and \fBlink\fR all refer to the link
|
||||
layer.)
|
||||
Note that \fItcp, udp\fR and other upper-layer protocol types only
|
||||
apply to IPv4, not IPv6 (this will be fixed in the future).
|
||||
The byte offset, relative to the indicated protocol layer, is
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tcpdump.c,v 1.4 2002/02/18 09:37:11 itojun Exp $ */
|
||||
/* $NetBSD: tcpdump.c,v 1.5 2002/05/31 09:45:47 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000
|
||||
|
@ -34,9 +34,9 @@ static const char copyright[] =
|
|||
"@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
static const char rcsid[] =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.173 2001/12/22 22:12:23 guy Exp (LBL)";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.176 2002/05/16 10:25:58 guy Exp (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: tcpdump.c,v 1.4 2002/02/18 09:37:11 itojun Exp $");
|
||||
__RCSID("$NetBSD: tcpdump.c,v 1.5 2002/05/31 09:45:47 itojun Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -90,6 +90,7 @@ int vflag; /* verbose */
|
|||
int xflag; /* print packet in hex */
|
||||
int Xflag; /* print packet in ascii as well as hex */
|
||||
off_t Cflag = 0; /* rotate dump files after this many bytes */
|
||||
int Aflag = 0; /* print packet only in ascii observing LF, CR, TAB, SPACE */
|
||||
|
||||
char *espsecret = NULL; /* ESP secret key */
|
||||
|
||||
|
@ -164,6 +165,9 @@ static struct printer printers[] = {
|
|||
#endif
|
||||
#ifdef DLT_LTALK
|
||||
{ ltalk_if_print, DLT_LTALK },
|
||||
#endif
|
||||
#ifdef DLT_PFLOG
|
||||
{ pflog_if_print, DLT_PFLOG },
|
||||
#endif
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
@ -225,13 +229,19 @@ main(int argc, char **argv)
|
|||
|
||||
opterr = 0;
|
||||
while (
|
||||
(op = getopt(argc, argv, "ac:C:deE:fF:i:lm:nNOpqr:Rs:StT:uvw:xXY")) != -1)
|
||||
(op = getopt(argc, argv, "aAc:C:deE:fF:i:lm:nNOpqr:Rs:StT:uvw:xXY")) != -1)
|
||||
switch (op) {
|
||||
|
||||
case 'a':
|
||||
++aflag;
|
||||
break;
|
||||
|
||||
case 'A':
|
||||
++xflag;
|
||||
++Xflag;
|
||||
++Aflag;
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
cnt = atoi(optarg);
|
||||
if (cnt <= 0)
|
||||
|
@ -491,6 +501,8 @@ main(int argc, char **argv)
|
|||
if (pcap_loop(pd, cnt, printer, pcap_userdata) < 0) {
|
||||
(void)fprintf(stderr, "%s: pcap_loop: %s\n",
|
||||
program_name, pcap_geterr(pd));
|
||||
cleanup(0);
|
||||
pcap_close(pd);
|
||||
exit(1);
|
||||
}
|
||||
if (RFileName == NULL)
|
||||
|
@ -510,7 +522,8 @@ cleanup(int signo)
|
|||
putc('\n', stderr);
|
||||
info(1);
|
||||
}
|
||||
exit(0);
|
||||
if (signo)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -645,7 +658,7 @@ usage(void)
|
|||
(void)fprintf(stderr, "%s version %s\n", program_name, version);
|
||||
(void)fprintf(stderr, "libpcap version %s\n", pcap_version);
|
||||
(void)fprintf(stderr,
|
||||
"Usage: %s [-adeflnNOpqRStuvxX] [ -c count ] [ -C file_size ]\n", program_name);
|
||||
"Usage: %s [-aAdeflnNOpqRStuvxX] [ -c count ] [ -C file_size ]\n", program_name);
|
||||
(void)fprintf(stderr,
|
||||
"\t\t[ -F file ] [ -i interface ] [ -r file ] [ -s snaplen ]\n");
|
||||
(void)fprintf(stderr,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.27 2002/02/18 09:45:11 itojun Exp $
|
||||
# $NetBSD: Makefile,v 1.28 2002/05/31 09:45:47 itojun Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
|
@ -19,10 +19,10 @@ SRCS= addrtoname.c gmt2local.c machdep.c parsenfsfh.c \
|
|||
print-ipx.c print-isakmp.c print-isoclns.c print-krb.c \
|
||||
print-l2tp.c print-lane.c print-lcp.c print-llc.c print-lwres.c \
|
||||
print-msdp.c print-mobile.c print-mpls.c print-nfs.c \
|
||||
print-ntp.c print-null.c print-ospf.c print-pim.c \
|
||||
print-ppp.c print-pppoe.c print-pptp.c print-radius.c \
|
||||
print-raw.c print-rip.c print-rx.c print-sctp.c \
|
||||
print-sl.c print-sll.c print-snmp.c \
|
||||
print-ntp.c print-null.c print-ospf.c print-pflog.c \
|
||||
print-pim.c print-ppp.c print-pppoe.c print-pptp.c \
|
||||
print-radius.c print-raw.c print-rip.c print-rx.c \
|
||||
print-sctp.c print-sl.c print-sll.c print-snmp.c \
|
||||
print-stp.c print-sunrpc.c print-tcp.c \
|
||||
print-telnet.c print-tftp.c print-timed.c print-token.c \
|
||||
print-udp.c print-vjc.c print-vrrp.c print-wb.c print-zephyr.c \
|
||||
|
|
Loading…
Reference in New Issue