Updating to the latest LBL release.
authormickey <mickey@openbsd.org>
Mon, 4 Mar 1996 15:58:52 +0000 (15:58 +0000)
committermickey <mickey@openbsd.org>
Mon, 4 Mar 1996 15:58:52 +0000 (15:58 +0000)
Sun's SKIP support added.

59 files changed:
usr.sbin/tcpdump/CHANGES
usr.sbin/tcpdump/Makefile
usr.sbin/tcpdump/README
usr.sbin/tcpdump/addrtoname.c
usr.sbin/tcpdump/addrtoname.h
usr.sbin/tcpdump/appletalk.h
usr.sbin/tcpdump/atime.awk
usr.sbin/tcpdump/bootp.h
usr.sbin/tcpdump/bpf_dump.c
usr.sbin/tcpdump/decnet.h
usr.sbin/tcpdump/ethertype.h
usr.sbin/tcpdump/extract.h
usr.sbin/tcpdump/fddi.h
usr.sbin/tcpdump/interface.h
usr.sbin/tcpdump/ipx.h
usr.sbin/tcpdump/llc.h
usr.sbin/tcpdump/makemib
usr.sbin/tcpdump/md.h
usr.sbin/tcpdump/mib.h
usr.sbin/tcpdump/nfsfh.h
usr.sbin/tcpdump/nfsv2.h
usr.sbin/tcpdump/ntp.h
usr.sbin/tcpdump/os.h
usr.sbin/tcpdump/ospf.h
usr.sbin/tcpdump/packetdat.awk
usr.sbin/tcpdump/parsenfsfh.c
usr.sbin/tcpdump/print-arp.c
usr.sbin/tcpdump/print-atalk.c
usr.sbin/tcpdump/print-bootp.c
usr.sbin/tcpdump/print-decnet.c
usr.sbin/tcpdump/print-domain.c
usr.sbin/tcpdump/print-egp.c
usr.sbin/tcpdump/print-ether.c
usr.sbin/tcpdump/print-fddi.c
usr.sbin/tcpdump/print-icmp.c
usr.sbin/tcpdump/print-ip.c
usr.sbin/tcpdump/print-ipx.c
usr.sbin/tcpdump/print-isoclns.c
usr.sbin/tcpdump/print-llc.c
usr.sbin/tcpdump/print-nfs.c
usr.sbin/tcpdump/print-ntp.c
usr.sbin/tcpdump/print-null.c
usr.sbin/tcpdump/print-ospf.c
usr.sbin/tcpdump/print-ppp.c
usr.sbin/tcpdump/print-rip.c
usr.sbin/tcpdump/print-skip.c [new file with mode: 0644]
usr.sbin/tcpdump/print-sl.c
usr.sbin/tcpdump/print-snmp.c
usr.sbin/tcpdump/print-sunrpc.c
usr.sbin/tcpdump/print-tcp.c
usr.sbin/tcpdump/print-tftp.c
usr.sbin/tcpdump/print-udp.c
usr.sbin/tcpdump/print-wb.c
usr.sbin/tcpdump/send-ack.awk
usr.sbin/tcpdump/stime.awk
usr.sbin/tcpdump/tcpdump.8
usr.sbin/tcpdump/tcpdump.c
usr.sbin/tcpdump/util.c
usr.sbin/tcpdump/version.c

index 7828176..959ea02 100644 (file)
@@ -1,5 +1,31 @@
+$OpenBSD: CHANGES,v 1.2 1996/03/04 15:58:52 mickey Exp $
 $NetBSD: CHANGES,v 1.2 1995/03/06 19:09:42 mycroft Exp $
-@(#) Header: CHANGES,v 1.6 94/06/20 19:34:38 leres Exp (LBL)
+@(#) Header: CHANGES,v 1.6+ 94/06/20 19:34:38 leres Exp $ (LBL)
+
+v3.0.2 Thu Apr 20 21:28:16 PDT 1995
+
+- Change configuration to not use gcc v2 flags with gcc v1.
+
+- Redo gmt2local() so that it works under BSDI (which seems to return
+  an empty timezone struct from gettimeofday()). Based on report from
+  Terry Kennedy (terry@spcvxa.spc.edu).
+
+- Change configure to recognize IP[0-9]* as "mips" SGI hardware. Based
+  on report from Mark Andrews (mandrews@alias.com).
+
+- Don't pass cc flags to gcc. Resulted from a bug report from Rainer
+  Orth (ro@techfak.uni-bielefeld.de).
+
+- Fixed printout of connection id for uncompressed tcp slip packets.
+  Resulted from a bug report from Richard Stevens (rstevens@noao.edu).
+
+- Hack around deficiency in Ultrix's make.
+
+- Add ETHERTYPE_TRAIL define which is missing from irix5.
+
+v3.0.1 Wed Aug 31 22:42:26 PDT 1994
+
+- Fix problems with gcc2 vs. malloc() and read() prototypes under SunOS 4.
 
 v3.0 Mon Jun 20 19:23:27 PDT 1994
 
index 9d9f4dd..a0d4d94 100644 (file)
@@ -1,3 +1,4 @@
+#      $OpenBSD: Makefile,v 1.2 1996/03/04 15:58:53 mickey Exp $
 #      $NetBSD: Makefile,v 1.6 1995/03/07 23:18:39 mycroft Exp $
 #
 #  Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994
@@ -19,7 +20,7 @@
 #  WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 #  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 #
-# @(#) $Header: /home/cvs/src/usr.sbin/tcpdump/Makefile,v 1.1.1.1 1995/10/18 08:48:23 deraadt Exp $ (LBL)
+# @(#) $Header: /home/cvs/src/usr.sbin/tcpdump/Makefile,v 1.2 1996/03/04 15:58:53 mickey Exp $ (LBL)
 
 PROG=  tcpdump
 MAN=   tcpdump.8
@@ -35,7 +36,7 @@ SRCS= tcpdump.c addrtoname.c \
        print-icmp.c print-sl.c print-ppp.c print-rip.c \
        print-snmp.c print-ntp.c print-null.c print-egp.c print-ospf.c \
        print-fddi.c print-llc.c print-sunrpc.c \
-       print-wb.c print-decnet.c print-isoclns.c print-ipx.c \
+       print-wb.c print-decnet.c print-isoclns.c print-ipx.c print-skip.c \
        util.c bpf_dump.c parsenfsfh.c version.c
 
 AWKS = atime.awk packetdat.awk send-ack.awk stime.awk
index b88305f..b3b740d 100644 (file)
@@ -1,7 +1,8 @@
+$OpenBSD: README,v 1.2 1996/03/04 15:58:54 mickey Exp $
 $NetBSD: README,v 1.3 1995/03/07 23:18:35 mycroft Exp $
 @(#) Header: README,v 1.39 94/06/20 20:15:16 leres Exp (LBL)
 
-TCPDUMP 3.0
+TCPDUMP 3.0.2
 Lawrence Berkeley Laboratory
 Network Research Group
 tcpdump@ee.lbl.gov
index d4e3aae..5e26d40 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: addrtoname.c,v 1.2 1996/03/04 15:58:55 mickey Exp $   */
 /*     $NetBSD: addrtoname.c,v 1.4 1995/04/24 13:27:39 cgd Exp $       */
 
 /*
index 74a6ba0..5eeff10 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: addrtoname.h,v 1.2 1996/03/04 15:58:56 mickey Exp $   */
 /*     $NetBSD: addrtoname.h,v 1.2 1995/03/06 19:09:50 mycroft Exp $   */
 
 /*
index d094166..ca92708 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: appletalk.h,v 1.2 1996/03/04 15:58:57 mickey Exp $    */
 /*     $NetBSD: appletalk.h,v 1.2 1995/03/06 19:09:51 mycroft Exp $    */
 
 /*
index 9f5d9d1..377df1c 100644 (file)
@@ -1,3 +1,4 @@
+#      $OpenBSD: atime.awk,v 1.2 1996/03/04 15:58:58 mickey Exp $
 #      $NetBSD: atime.awk,v 1.2 1995/03/06 19:09:52 mycroft Exp $
 
 $6 ~ /^ack/ && $5 !~ /[SFR]/   {
index 6e2a328..5ad4fe9 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: bootp.h,v 1.2 1996/03/04 15:58:59 mickey Exp $        */
 /*     $NetBSD: bootp.h,v 1.2 1995/03/06 19:09:54 mycroft Exp $        */
 
 /* @(#) Header: bootp.h,v 1.6 94/01/13 19:06:29 leres Exp (LBL) */
index 100d147..cb5b6a8 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: bpf_dump.c,v 1.2 1996/03/04 15:59:00 mickey Exp $     */
 /*     $NetBSD: bpf_dump.c,v 1.2 1995/03/06 19:09:55 mycroft Exp $     */
 
 /*
index 5965f77..847a599 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: decnet.h,v 1.2 1996/03/04 15:59:00 mickey Exp $       */
 /*     $NetBSD: decnet.h,v 1.2 1995/03/06 19:09:58 mycroft Exp $       */
 
 /*
index c4ec760..410503e 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: ethertype.h,v 1.2 1996/03/04 15:59:01 mickey Exp $    */
 /*     $NetBSD: ethertype.h,v 1.2 1995/03/06 19:10:06 mycroft Exp $    */
 
 /*
index 2288ca5..ef5ce02 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: extract.h,v 1.2 1996/03/04 15:59:02 mickey Exp $      */
 /*     $NetBSD: extract.h,v 1.2 1995/03/06 19:10:08 mycroft Exp $      */
 
 /*
index 2d91b70..8c25970 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: fddi.h,v 1.2 1996/03/04 15:59:03 mickey Exp $ */
 /*     $NetBSD: fddi.h,v 1.2 1995/03/06 19:10:10 mycroft Exp $ */
 
 /*
index 2e32115..ba0d465 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: interface.h,v 1.2 1996/03/04 15:59:04 mickey Exp $    */
 /*     $NetBSD: interface.h,v 1.2 1995/03/06 19:10:18 mycroft Exp $    */
 
 /*
@@ -135,6 +136,11 @@ extern void sunrpcrequest_print(const u_char *, int, const u_char *);
 extern void tftp_print(const u_char *, int);
 extern void wb_print(const void *, int);
 
+extern void skip_print(const u_char *, int, const u_char *);
+extern void skip_print_old(const u_char *, int, const u_char *);
+extern void ah_print(const u_char *, int, const u_char *);
+extern void esp_print(const u_char *, int, const u_char *);
+
 #define min(a,b) ((a)>(b)?(b):(a))
 #define max(a,b) ((b)>(a)?(b):(a))
 
index e943f6e..00133d3 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: ipx.h,v 1.2 1996/03/04 15:59:05 mickey Exp $  */
 /*     $NetBSD: ipx.h,v 1.2 1995/03/06 19:10:19 mycroft Exp $  */
 
 /*
index 2712fda..0ce8aad 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: llc.h,v 1.2 1996/03/04 15:59:06 mickey Exp $  */
 /*     $NetBSD: llc.h,v 1.2 1995/03/06 19:10:20 mycroft Exp $  */
 
 /*
index debab1f..8203883 100644 (file)
@@ -1,5 +1,6 @@
 #!/bin/sh
 #
+#      $OpenBSD: makemib,v 1.2 1996/03/04 15:59:07 mickey Exp $
 #      $NetBSD: makemib,v 1.2 1995/03/06 19:10:22 mycroft Exp $
 #
 # Copyright (c) 1990, by John Robert LoVerso.
index 3530665..b68ba11 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: md.h,v 1.2 1996/03/04 15:59:08 mickey Exp $   */
 /*     $NetBSD: md.h,v 1.2 1995/03/06 19:10:33 mycroft Exp $   */
 
 /*
index 747af86..0f42c69 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: mib.h,v 1.2 1996/03/04 15:59:08 mickey Exp $  */
 /*     $NetBSD: mib.h,v 1.2 1995/03/06 19:10:34 mycroft Exp $  */
 
 /*
index 5d6ff78..ccbbd57 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: nfsfh.h,v 1.2 1996/03/04 15:59:10 mickey Exp $        */
 /*     $NetBSD: nfsfh.h,v 1.2 1995/03/06 19:10:39 mycroft Exp $        */
 
 /*
index e8cdba9..1df599f 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: nfsv2.h,v 1.2 1996/03/04 15:59:11 mickey Exp $        */
 /*     $NetBSD: nfsv2.h,v 1.2 1995/03/06 19:10:40 mycroft Exp $        */
 
 /*
index 7443ce6..a5442c4 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: ntp.h,v 1.2 1996/03/04 15:59:11 mickey Exp $  */
 /*     $NetBSD: ntp.h,v 1.2 1995/03/06 19:10:41 mycroft Exp $  */
 
 /* Header: ntp.h,v 1.2 93/11/12 21:43:36 mccanne Exp */
index 9f80752..06ade54 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: os.h,v 1.2 1996/03/04 15:59:12 mickey Exp $   */
 /*     $NetBSD: os.h,v 1.2 1995/03/06 19:10:56 mycroft Exp $   */
 
 /*
index 3a6d2b5..588cb9e 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: ospf.h,v 1.2 1996/03/04 15:59:13 mickey Exp $ */
 /*     $NetBSD: ospf.h,v 1.2 1995/03/06 19:10:57 mycroft Exp $ */
 
 /*
index 9774652..bbbf21f 100644 (file)
@@ -1,3 +1,4 @@
+#      $OpenBSD: packetdat.awk,v 1.2 1996/03/04 15:59:15 mickey Exp $
 #      $NetBSD: packetdat.awk,v 1.2 1995/03/06 19:10:59 mycroft Exp $
 
 BEGIN  {
index bff0830..bdebc3f 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: parsenfsfh.c,v 1.2 1996/03/04 15:59:15 mickey Exp $   */
 /*     $NetBSD: parsenfsfh.c,v 1.2 1995/03/06 19:11:00 mycroft Exp $   */
 
 #ifndef lint
index f9636a6..9684807 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-arp.c,v 1.2 1996/03/04 15:59:16 mickey Exp $    */
 /*     $NetBSD: print-arp.c,v 1.2 1995/03/06 19:11:02 mycroft Exp $    */
 
 /*
index 89807fa..dd8afd2 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-atalk.c,v 1.2 1996/03/04 15:59:17 mickey Exp $  */
 /*     $NetBSD: print-atalk.c,v 1.3 1995/03/06 19:11:04 mycroft Exp $  */
 
 /*
index 2e64141..1390396 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-bootp.c,v 1.2 1996/03/04 15:59:18 mickey Exp $  */
 /*     $NetBSD: print-bootp.c,v 1.2 1995/03/06 19:11:05 mycroft Exp $  */
 
 /*
index 2e0a419..018618c 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-decnet.c,v 1.2 1996/03/04 15:59:20 mickey Exp $ */
 /*     $NetBSD: print-decnet.c,v 1.2 1995/03/06 19:11:07 mycroft Exp $ */
 
 /*
index bc2cab3..5897414 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-domain.c,v 1.2 1996/03/04 15:59:21 mickey Exp $ */
 /*
  * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994
  *     The Regents of the University of California.  All rights reserved.
index 97fc2c3..6135ce7 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-egp.c,v 1.2 1996/03/04 15:59:22 mickey Exp $    */
 /*     $NetBSD: print-egp.c,v 1.2 1995/03/06 19:11:09 mycroft Exp $    */
 
 /*
index d32ceca..4d3c549 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-ether.c,v 1.2 1996/03/04 15:59:23 mickey Exp $  */
 /*     $NetBSD: print-ether.c,v 1.3 1995/03/06 19:11:10 mycroft Exp $  */
 
 /*
index 0d5c050..9aedc6d 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-fddi.c,v 1.2 1996/03/04 15:59:24 mickey Exp $   */
 /*     $NetBSD: print-fddi.c,v 1.2 1995/03/06 19:11:12 mycroft Exp $   */
 
 /*
index e415431..202d1be 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-icmp.c,v 1.2 1996/03/04 15:59:25 mickey Exp $   */
 /*     $NetBSD: print-icmp.c,v 1.3 1995/03/06 19:11:13 mycroft Exp $   */
 
 /*
index 4c43bcf..ddb10cf 100644 (file)
@@ -1,4 +1,5 @@
-/*     $NetBSD: print-ip.c,v 1.4 1995/04/24 13:27:43 cgd Exp $ */
+/*     $OpenBSD: print-ip.c,v 1.2 1996/03/04 15:59:26 mickey Exp $     */
+/*     $NetBSD: print-ip.c,v 1.4 1995/04/24 13:27:43 cgd Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
+/*
+ * Copyright (c) 1995 Sun Microsystems, Inc.
+ * All rights reserved.
+ * 
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+
+ * IN NO EVENT SHALL SUN MICROSYSTEMS, INC. BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+ * SUN MICROSYSTEMS, INC. HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+
+ * SUN MICROSYSTEMS, INC. SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+ * THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND SUN
+ * MICROSYSTEMS, INC. HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
+ * UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+*/
+
 #ifndef lint
 static char rcsid[] =
-    "@(#) Header: print-ip.c,v 1.38 94/06/14 20:17:40 leres Exp (LBL)";
+    "@(#) Header: print-ip.c,v 1.38 94/06/14 20:17:40 leres Exp (LBL)";
 #endif
 
 #include <sys/param.h>
@@ -305,6 +330,31 @@ ip_print(register const u_char *bp, register int length)
                                return;
                        }
                        break;
+#ifndef IPPROTO_SKIP_OLD
+#define IPPROTO_SKIP_OLD 79
+#endif
+               case IPPROTO_SKIP_OLD:
+                       skip_print_old(cp, len, (const u_char *) ip);
+                       break;
+#ifndef IPPROTO_ESP
+#define IPPROTO_ESP 50
+#endif
+               case IPPROTO_ESP:
+                       esp_print(cp, len, (const u_char *) ip);
+                       break;
+#ifndef IPPROTO_AH
+#define IPPROTO_AH 51
+#endif
+               case IPPROTO_AH:
+                       ah_print(cp, len, (const u_char *) ip);
+                       break;
+
+#ifndef IPPROTO_SKIP
+#define IPPROTO_SKIP 57
+#endif
+               case IPPROTO_SKIP:
+                       skip_print(cp, len, (const u_char *) ip);
+                       break;
                default:
                        (void)printf("%s > %s:", ipaddr_string(&ip->ip_src),
                                ipaddr_string(&ip->ip_dst));
index 7872e6a..e900616 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-ipx.c,v 1.2 1996/03/04 15:59:27 mickey Exp $    */
 /*     $NetBSD: print-ipx.c,v 1.2 1995/03/06 19:11:16 mycroft Exp $    */
 
 /*
index 670ecaf..7153e74 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-isoclns.c,v 1.2 1996/03/04 15:59:28 mickey Exp $        */
 /*     $NetBSD: print-isoclns.c,v 1.2 1995/03/06 19:11:17 mycroft Exp $        */
 
 /*
index a6c0366..b5b3150 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-llc.c,v 1.2 1996/03/04 15:59:29 mickey Exp $    */
 /*     $NetBSD: print-llc.c,v 1.2 1995/03/06 19:11:19 mycroft Exp $    */
 
 /*
index 5ba11d9..419e097 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-nfs.c,v 1.2 1996/03/04 15:59:30 mickey Exp $    */
 /*     $NetBSD: print-nfs.c,v 1.4 1995/04/24 13:27:45 cgd Exp $        */
 
 /*
index ed92f69..9a7e826 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-ntp.c,v 1.2 1996/03/04 15:59:31 mickey Exp $    */
 /*     $NetBSD: print-ntp.c,v 1.2 1995/03/06 19:11:22 mycroft Exp $    */
 
 /*
index 69a3456..bb56f29 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-null.c,v 1.2 1996/03/04 15:59:32 mickey Exp $   */
 /*     $NetBSD: print-null.c,v 1.3 1995/03/06 19:11:24 mycroft Exp $   */
 
 /*
index 90ffecf..0e5e0b9 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-ospf.c,v 1.2 1996/03/04 15:59:33 mickey Exp $   */
 /*     $NetBSD: print-ospf.c,v 1.3 1995/03/06 19:11:25 mycroft Exp $   */
 
 /*
index 966e9f5..e7eb95f 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-ppp.c,v 1.2 1996/03/04 15:59:34 mickey Exp $    */
 /*     $NetBSD: print-ppp.c,v 1.3 1995/03/06 19:11:27 mycroft Exp $    */
 
 /*
index 1be9c9d..f2ef506 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-rip.c,v 1.2 1996/03/04 15:59:35 mickey Exp $    */
 /*     $NetBSD: print-rip.c,v 1.4 1995/06/20 23:38:49 christos Exp $   */
 
 /*
diff --git a/usr.sbin/tcpdump/print-skip.c b/usr.sbin/tcpdump/print-skip.c
new file mode 100644 (file)
index 0000000..74db846
--- /dev/null
@@ -0,0 +1,919 @@
+/*     $OpenBSD: print-skip.c,v 1.1 1996/03/04 15:59:35 mickey Exp $   */
+/*
+ * Copyright (c) 1995 Sun Microsystems, Inc.
+ * All rights reserved.
+ * 
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+
+ * IN NO EVENT SHALL SUN MICROSYSTEMS, INC. BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+ * SUN MICROSYSTEMS, INC. HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+
+ * SUN MICROSYSTEMS, INC. SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+ * THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND SUN
+ * MICROSYSTEMS, INC. HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
+ * UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+*/
+
+#include <sys/param.h> 
+#include <sys/time.h> 
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <netinet/ip_var.h>
+#include <netinet/tcp.h>
+#include <netinet/tcpip.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "interface.h"
+#include "addrtoname.h"
+
+#define MAX_ALGS               (256)
+
+extern int skipflag;
+
+const int       skip_max_algs = MAX_ALGS;
+
+char            *old_skip_crypt_algs[MAX_ALGS] = {
+                                        "none",         /* 0 */
+                                        "des_cbc",      /* 1 */
+                                        "rc2_cbc",      /* 2 */
+                                        "rc4(40bit)",   /* 3 */
+                                        "rc4(128bit)",  /* 4 */
+                                        "des_ede-2",    /* 5 */
+                                        "des_ede-3",    /* 6 */
+                                        "idea",         /* 7 */
+                                        "",             /* 8 */
+                                        "",             /* 9 */
+                                        "simplecrypt"   /* 10 */
+                };
+
+
+char *
+skip_alg_to_name(char *table[], int alg)
+{
+        if (alg > skip_max_algs) {
+                return ("<invalid>");
+        }
+        if (alg < 0) {
+                return ("<invalid>");
+        }
+        if (table[alg] == NULL) {
+                return ("<unknown>");
+        }
+        if (strlen(table[alg]) == 0) {
+                return ("<unknown>");
+        }
+        return (table[alg]);
+}
+
+/*
+ * This is what an OLD skip encrypted-authenticated packet looks like:
+ *
+ *
+ *                 0       1      2      3
+ *            ---------------------------------
+ *            |                               |
+ *            /      Clear IP Header          /  
+ *            |                               |     IP protocol = IPSP
+ *            ---------------------------------
+ *            |                               |
+ *            |         IPSP header           |  
+ *            |                               |
+ *            ---------------------------------
+ *            |                               |
+ *            /    Protected  IPSP Payload    /
+ *            /                               /
+ *            |                               |
+ *            ---------------------------------
+ *
+ *
+ * The format of the IPSP header for encrypted-encapsulated mode is shown below. * The fields are transmitted from left to right.
+ *
+ *   0                   1                   2                   3
+ *   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *  | Ver.  |E|A|C|S|B|R|               zero                        |
+ *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *  |    Kij alg.   |   Kp alg.     |        reserved               |
+ *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *  |    Optional boxid field                                       |
+ *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *  |    Kp encrypted in Kij...          (typically 8-16 bytes)
+ *  +-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *  |    Message Indicator (e.g IV)...   (typically 8-16 bytes)
+ *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *  |    Protected IPSP Payload...
+ *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *
+ *
+ *   Field values:
+ *   Ver.: protocol version
+ *   E:    1 if packet is encrypted, 0 otherwise
+ *   A:    1 if packet is authenticated, 0 otherwise
+ *   C:    1 if packet is compressed before encryption, 0 otherwise
+ *   S:    1 if packet is sequenced, 0 otherwise
+ *   B:    1 if packet is tunneled (header contains boxid), 0 otherwise
+ *   R:    reserved (should be 0 until specified)
+ *
+ */
+/*
+ * per-algorithm encrytped key sizes...
+ */
+unsigned char   old_skip_ekp_sizes[MAX_ALGS] = {
+                          8,    /* plaintext */
+                          8,    /* DES */
+                          8,    /* RC2 */
+                          8,    /* RC4 (40 bit)  */
+                         16,    /* RC4 (128 bit) */
+                         16,    /* 3DES 2 */
+                         24,    /* 3DES 3 */
+                         16,    /* IDEA */
+                          0,    /* */
+                          0,    /* */
+                          8,    /* simplecrypt */
+                };
+/*
+ * per-algorithm message indicator sizes...
+ */
+unsigned char   old_skip_mid_sizes[MAX_ALGS] = {
+                          8,    /* plaintext */
+                          8,    /* DES */
+                          8,    /* RC2 */
+                          8,    /* RC4 40 bit */
+                          8,    /* RC4 128 bit */
+                          8,    /* 3DES 2 */
+                          8,    /* 3DES 3 */
+                          8,    /* IDEA */
+                          0,    /* */
+                          0,    /* */
+                          8,    /* simplecrypt */
+                };
+
+void skip_print_old(register const u_char *bp, register int length, 
+                                                       const u_char *bp2)
+{
+       struct ip *ip;
+       const u_char *end;
+       u_char *p;
+       unsigned char   kij_alg, kp_alg, *c;
+       unsigned short i;
+       unsigned short len;
+       int boxid;
+       int node;
+
+       ip=(struct ip *)bp2;
+       p=(u_char *)bp;
+       end=bp+length;
+       printf("SKIP: *** OLD SKIP ***\n");
+       printf("OSKIP: %s>%s:%d",ipaddr_string(&ip->ip_src),
+                              ipaddr_string(&ip->ip_dst),length);
+       if (!skipflag)
+               return;
+       printf("\nOSKIP: SAID byte 1= 0x%02x\n",*p);
+       printf("OSKIP:    xxxx .... = version %d\n", (int) (*p & 0xf0) >> 4);
+        if (*p & 0x08) {
+                printf("OSKIP:    .... 1... = encrypted\n");
+        } else {
+                printf("OSKIP:    .... 0... = not encrypted\n");
+        }
+        if (*p & 0x04) {
+                printf("OSKIP:    .... .1.. = authenticated\n");
+        } else {
+                printf("OSKIP:    .... .0.. = not authenticated\n");
+        }
+        if (*p & 0x02) {
+                printf("OSKIP:    .... ..1. = compressed\n");
+        } else {
+                printf("OSKIP:    .... ..0. = not compressed\n");
+        }
+        if (*p & 0x01) {
+                printf("OSKIP:    .... ...1 = sequenced\n");
+        } else {
+                printf("OSKIP:    .... ...0 = not sequenced\n");
+        }
+                           
+        p++;
+
+       printf("OSKIP: SAID byte 2 = 0x%02x\n", *p);
+        if (*p & 0x80) {
+               node=1;
+                printf("OSKIP:    1... .... = Node ID present\n");
+        } else {
+               node=0;
+                printf("OSKIP:    0... .... = no Node ID present\n");
+        }
+        if (*p & 0x40) {
+                printf("OSKIP:    .1.. .... = <reserved should be zero>\n");
+        } else {
+                printf("OSKIP:    .0.. .... = <reserved should be zero>\n");
+        }
+        if (*p & 0x20) {
+                printf("OSKIP:    ..1. .... = <reserved should be zero>\n");
+        } else {
+                printf("OSKIP:    ..0. .... = <reserved should be zero>\n");
+        }
+        if (*p & 0x10) {
+                printf("OSKIP:    ...1 .... = <reserved should be zero>\n");
+        } else {
+                printf("OSKIP:    ...0 .... = <reserved should be zero>\n");
+        }
+         p++;
+        printf("OSKIP: SAID byte 3 = 0x%02x\n", *p);
+        p++;     
+        printf("OSKIP: SAID byte 4 = 0x%02x\n", *p);
+        p++;
+        kij_alg = *p;
+        printf("OSKIP: Kij alg (key encryption algorithm) = 0x%02x (%s)\n",
+                   kij_alg, skip_alg_to_name(old_skip_crypt_algs,kij_alg));
+        p++;
+        kp_alg = *p;
+        printf("OSKIP: Kp alg (traffic encryption algorithm) = 0x%02x (%s)\n",
+                   kp_alg, skip_alg_to_name(old_skip_crypt_algs,kp_alg));
+        p++;
+        /*
+         * the skip reserved field
+         */
+        printf("OSKIP: reserved byte 1 = 0x%02x\n", *p++);
+        printf("OSKIP: reserved byte 2 = 0x%02x\n", *p++);
+
+        if (node) {
+        /*
+         * boxid field
+         */
+           if ((end - p) < sizeof(boxid)) {
+                   return;
+           }
+           c = (unsigned char *) &boxid;
+           *c++ = *p++;
+           *c++ = *p++;
+           *c++ = *p++;
+           *c++ = *p++;
+
+           printf("OSKIP: Node ID = 0x%08x\n", ntohl(boxid));
+        }
+
+        /*
+         * encrypted kp (ekp) field
+         */
+
+        /*
+         * do this with a for-loop to avoid alignment problems and the
+         * overhead of calling bcopy()
+         */
+        len     = old_skip_ekp_sizes[kp_alg];
+        if ((unsigned short) (end - p) < len) {
+                return;
+        }
+
+        printf("OSKIP: encrypted Kp:  ");
+        for (i = 0; i < len; i++) {
+                printf("%02x ", (unsigned char) *p++);
+        }
+        printf("\n");
+
+        /*
+         * message indicator (mid) field
+         */
+        len     = old_skip_mid_sizes[kp_alg];
+        if ((unsigned short) (end - p) < len) {
+                return;
+        }
+        printf("OSKIP: message indicator field:  ");
+        for (i = 0; i < len; i++) {
+                printf("%02x ", (unsigned char) *p++);
+        }
+        printf("\n");
+}
+
+
+
+/* 
+ * The following part is (c) by G. Caronni  -- 29.11.95 
+ *
+ * This code is in the public domain; do with it what you wish.
+ *
+ * NO WARRANTY, NO SUPPORT, NO NOTHING!
+ */
+
+
+/*
+ * This is what a NEW skip encrypted-authenticated packet looks like:
+ *
+ *
+ *                 0       1      2      3
+ *            ---------------------------------
+ *            |                               |
+ *            /      Clear IP Header          /  
+ *            |                               |     IP protocol = SKIP
+ *            ---------------------------------
+ *            |                               |
+ *            |         SKIP header           |  
+ *            |                               |
+ *            ---------------------------------
+ *            |                               |
+ *            |    Auth Header & payload      |  
+ *            |                               |
+ *            ---------------------------------
+ *            |                               |
+ *            |    ESP header and SPI         |  
+ *            |                               |
+ *            ---------------------------------
+ *            |                               |
+ *            /    Protected  ESP Payload     /
+ *            |                               |
+ *            ---------------------------------
+ *
+ *
+ * The format of the SKIP header for encrypted-encapsulated mode is shown below. * The fields are transmitted from left to right.
+ *
+ *    0                   1                   2                   3
+ *    0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+ *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *   |  Ver  | Rsvd  | Source NSID   | Dest NSID     | NEXT HEADER   |
+ *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *   |                    Counter n                                  |
+ *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *   |    Kij Alg    |   Crypt Alg   |  MAC Alg      |  Comp Alg     |
+ *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *   |    Kp encrypted in Kijn...          (typically 8-16 bytes)
+ *   +-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *   |    Source Master Key-ID  (If Source NSID is non-zero)
+ *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *   |    Destination Master Key-ID (If Dest NSID is non-zero)
+ *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *
+ */
+
+
+
+
+
+/*
+ * per name space key ID sizes...
+ */
+unsigned char   skip_nsid_sizes[MAX_ALGS] = {
+                          0,    /* 0  none */
+                          4,    /* 1  IP v4 Address Space */
+                          4,    /* 2  POSIX/XOPEN User Ids */
+                         16,    /* 3  IPv6 Address Space */
+                         16,    /* 4  MD5 of DNS Names */
+                         16,    /* 5  MD5 of ISO ASN.1 DN encoding */
+                         16,    /* 6  MD5 of US Social Security number */
+                          6,    /* 7  802.x MAC Address */
+                         16,    /* 8  MD5 of public Value */
+                         16,    /* 9  MD5 of RFC822 Mailbox Address */
+                         16,    /* 10 MD5 of Bank Account # */
+                         16,    /* 11 MD5 of NIS Name */
+                };
+
+
+/*
+ * per Kp algorithm encrypted Kp sizes... (Kij alg does not matter for now)
+ */
+unsigned char   skip_ekp_sizes[MAX_ALGS] = {
+                          0,    /* 0 plaintext */
+                          8,    /* 1 DES_CBC */
+                          24,   /* 2 3 key triple DES-EDE-CBC */
+                          0,    /* 3  */
+                          0,    /* 4  */
+                          0,    /* 5  */
+                          0,    /* 6  */
+                          0,    /* 7  */
+                          0,    /* 8  */
+                          0,    /* 9  */                        /* 10 .. 249 */
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+                         8,    /* 250 RC4-40 */                          
+                         16,   /* 251 RC4-128 */                          
+                         8,    /* 252 simple crypt */                          
+                         16,   /* 253 IDEA */                          
+                         0,    /* 254 */                          
+                         0     /* 255 */                          
+                };
+
+
+/*
+ * per-algorithm NSID names ...
+ */
+char            *skip_nsid_names[MAX_ALGS] = {
+                                        "none",             /* 0 */
+                                        "IPv4",             /* 1 */
+                                        "Posix/Xopen UID",  /* 2 */
+                                        "IPv6",             /* 3 */
+                                        "MD5 DNS",          /* 4 */
+                                        "MD5 ASN.1 DN",     /* 5 */
+                                        "MD5 U.S. Soc. #",  /* 6 */
+                                        "802.x MAC",        /* 7 */
+                                        "MD5 DH Public Key",/* 8 */
+                                        "MD5 RFC822 Mail",  /* 9 */
+                                        "MD5 Bank Account", /* 10 */
+                                        "MD5 NIS Name",     /* 11 */
+                };
+
+
+/*
+ * per-algorithm Kij alg names ...
+ */
+char            *skip_kij_names[MAX_ALGS] = {
+                                        "none",             /* 0 */
+                                        "DES-CBC",          /* 1 */
+                                        "3DES3-EDE-CBC",    /* 2 */
+                                        "IDEA-CBC",         /* 3 */
+               };
+
+
+/* for padding of ekp */
+
+char            skip_kij_sizes[MAX_ALGS] = {
+                                        0, /* 0 none */
+                                        8, /* 1  des-cbc */
+                                        8, /* 2 3des3-ede-cbc */
+                                        8, /* 3 idea-cbc */
+               };
+
+
+/*
+ * per-algorithm Crypt alg names ...
+ */
+char            *skip_crypt_names[MAX_ALGS] = {
+                                        "none",                      /* 0 */
+                                        "DES-CBC",                   /* 1 */
+                                        "3 key DES-EDE-CBC",         /* 2 */
+                                        "",                          /* 3 */
+                                        "",                          /* 4 */
+                                        "",                          /* 5 */
+                                        "",                          /* 6 */
+                                        "",                          /* 7 */
+                                        "",                          /* 8 */
+                                       "",   /* 9 */        /* 10 .. 249 */
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+                                       "RC4-40",                    /* 250 */ 
+                                       "RC4-128",                   /* 251 */
+                                       "simple crypt",              /* 252 */ 
+                                       "IDEA CBC",                  /* 253 */
+                                       "",                          /* 254 */ 
+                                       ""                           /* 255 */
+                };
+
+
+/*
+ * per-algorithm Auth alg names ...
+ */
+char            *skip_auth_names[MAX_ALGS] = {
+                                        "none",        /* 0 */
+                                        "keyed MD5",   /* 1 */
+                                        "DES-CBC MAC", /* 2 */
+                                        "Keyed SHA",   /* 3 */
+                };
+
+
+char            skip_auth_sizes[MAX_ALGS] = {
+                                        0,             /* 0 none */
+                                       16,             /* 1 keyed MD5 */
+                                        8,             /* 2 DES-CBC MAC */
+                                       20,             /* 3 Keyed SHA */
+                };
+
+
+/*
+ * per-algorithm Crypt alg IV sizes ...
+ */
+char            skip_crypt_sizes[MAX_ALGS] = {
+                                        0, /* 0 none */
+                                        8, /* 1 DES-CBC */
+                                        8, /* 2 3key DES-EDE-CBC */
+                                        0, /* 3 */
+                                        0, /* 4 */
+                                        0, /* 5 */
+                                        0, /* 6 */
+                                        0, /* 7 */
+                                        0, /* 8 */
+                                       0, /* 9 */        /* 10 .. 249 */
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+                                       8, /* 250 RC4-40 */ 
+                                       8, /* 251 RC4-128 */
+                                       8, /* 252 simple crypt */ 
+                                       8, /* 253 IDEA CBC */
+                                       0, /* 254 */ 
+                                       0  /* 255 */
+                };
+
+
+#ifndef IPPROTO_ESP
+#define IPPROTO_ESP 50
+#endif
+#ifndef IPPROTO_AH
+#define IPPROTO_AH 51
+#endif
+#ifndef IPPROTO_SKIP
+#define IPPROTO_SKIP 57
+#endif
+#ifndef IPPROTO_OSKIP
+#define IPPROTO_OSKIP 79
+#endif
+
+static int expected_auth_size=0;
+static int expected_iv_size=0;
+
+char *skip_protocol_name(int p)
+{
+    switch(p) {
+       case IPPROTO_IP:    return "IP";
+       case IPPROTO_ICMP:  return "ICMP";
+       case IPPROTO_IGMP:  return "IGMP";
+       case IPPROTO_ENCAP: return "ENCAP";
+       case IPPROTO_TCP:   return "TCP";
+       case IPPROTO_EGP:   return "EGP";
+       case IPPROTO_UDP:   return "UDP";
+       case IPPROTO_ESP:   return "ESP";
+       case IPPROTO_AH:    return "AH";
+       case IPPROTO_SKIP:  return "SKIP";
+       case IPPROTO_ND:    return "ND";
+       case IPPROTO_OSKIP: return "OLD-SKIP";
+       case IPPROTO_RAW:   return "RAW IP";
+       default:            return "<unknown>";
+    }
+}
+
+void skip_print_next(u_char nxt, const u_char *p, int len, const u_char *bp2)
+{
+    switch(nxt) {
+       case IPPROTO_IP:   ip_print(p,len); break;
+       case IPPROTO_ICMP: icmp_print(p,bp2); break;
+       case IPPROTO_TCP:  tcp_print(p,len,bp2); break;
+       case IPPROTO_UDP:  udp_print(p,len,bp2); break;
+       case IPPROTO_ESP:  esp_print(p,len,bp2); break;
+       case IPPROTO_AH:   ah_print(p,len,bp2); break;
+       case IPPROTO_SKIP: skip_print(p,len,bp2); break;
+       default: break;
+    }
+}
+
+void skip_print(register const u_char *bp, register int length, 
+                                                       const u_char *bp2)
+{
+       struct ip *ip;
+       const u_char *end;
+       const u_char *p;
+       unsigned char   kij_alg, crypt_alg, auth_alg, snsid, dnsid, nxt;
+       unsigned short i;
+       unsigned short len;
+       u_int n;
+       time_t full_n;
+
+       ip=(struct ip *)bp2;
+       p=bp;
+       end=bp+length<snapend?bp+length:snapend;
+
+       printf("%s>%s:%d SKIP",ipaddr_string(&ip->ip_src),
+                              ipaddr_string(&ip->ip_dst),length);
+       if (!skipflag)
+               return;
+
+
+        if ((unsigned short) (end - p) < 4) {
+           printf("[SKIP|] (truncated)\n");
+           return;
+        }
+
+       printf("\nSKIP: version\t\t\t%d\n", (int) (*p & 0xf0) >> 4);
+       if (*p & 0xf) 
+               printf("SKIP: version byte \t\treserved,\tis now 0x%x\n", 
+                                                       (int) (*p & 0xf));
+        p++;
+
+        snsid = *p;
+        printf("SKIP: Source NSID\t\t0x%02x\t\t%s\n",
+                   snsid, skip_alg_to_name(skip_nsid_names,snsid));
+        p++;
+
+        dnsid = *p;
+        printf("SKIP: Destination NSID\t\t0x%02x\t\t%s\n",
+                   dnsid, skip_alg_to_name(skip_nsid_names,dnsid));
+        p++;
+
+        nxt = *p;
+        printf("SKIP: Next Protocol Field\t0x%02x\t\t%s\n", nxt, 
+                                                   skip_protocol_name(nxt));
+        p++;
+
+        if ((unsigned short) (end - p) < 4) {
+           printf("[SKIP|] (truncated)\n");
+           return;
+        }
+
+       n=*p++<<24; 
+       n+=*p++<<16;
+       n+=*p++<<8;
+       n+=*p;
+       full_n=(((365*25+6)*24)+n)*3600;
+        printf("SKIP: Counter n Field\t\t0x%08x\t%s", n, 
+                                               asctime(gmtime(&full_n)));
+        p++;
+
+        if ((unsigned short) (end - p) < 4) {
+           printf("[SKIP|] (truncated)\n");
+           return;
+        }
+
+        kij_alg = *p;
+        printf("SKIP: Kij alg (key encryption)\t0x%02x\t\t%s\n",
+                   kij_alg, skip_alg_to_name(skip_kij_names,kij_alg));
+        p++;
+        crypt_alg = *p;
+       expected_iv_size=skip_crypt_sizes[crypt_alg];
+        printf("SKIP: Crypt Alg\t\t\t0x%02x\t\t%s\n",
+                   crypt_alg, skip_alg_to_name(skip_crypt_names,crypt_alg));
+        p++;
+        auth_alg = *p;
+       expected_auth_size=skip_auth_sizes[auth_alg];
+        printf("SKIP: Auth Alg\t\t\t0x%02x\t\t%s\n",
+                   auth_alg, skip_alg_to_name(skip_auth_names,auth_alg));
+        p++;
+        if (*p) printf("SKIP: compression\t\treserved,\tis now0x%02x\n",
+                                                               (int) *p++);
+        else p++;
+
+        /*
+         * encrypted kp (ekp) field
+         */
+
+       if (kij_alg==0 && (crypt_alg || auth_alg)) {
+           printf("Warning: Kij Alg. undefined, but Auth. or Crypt. used!");
+           printf("Warning: Assuming empty Kp\n");
+           crypt_alg=auth_alg=0;
+       }
+        /*
+         * do this with a for-loop to avoid alignment problems and the
+         * overhead of calling bcopy()
+         */
+        len = skip_ekp_sizes[crypt_alg];
+        len = len>(int)skip_auth_sizes[auth_alg]?len:skip_auth_sizes[auth_alg];
+        if (len && skip_kij_sizes[kij_alg] && len % skip_kij_sizes[kij_alg]) {
+           len += skip_kij_sizes[kij_alg] - (len%skip_kij_sizes[kij_alg]);
+       }
+        if ((unsigned short) (end - p) < len) {
+           printf("[SKIP|] (truncated)\n");
+           return;
+        }
+
+        printf("SKIP: Encrypted Kp\t\t");
+        for (i = 0; i < len; i++) {
+                printf("%02x ", (unsigned char) *p++);
+        }
+        printf("\n");
+
+
+        if (snsid) {
+        /*
+         * Source Master Key-ID field
+         */
+           if ((end - p) < skip_nsid_sizes[snsid]) {
+               printf("[SKIP|] (truncated)\n");
+               return;
+           }
+           printf("SKIP: Source Master Key-ID\t");
+            if (snsid==1) {
+               printf("%s",ipaddr_string(p));
+               p+=skip_nsid_sizes[snsid];
+           } else {
+               for (i = 0; i < skip_nsid_sizes[snsid]; i++) {
+                   printf("%02x ", (unsigned char) *p++);
+               }
+           }
+           printf("\n");
+        }
+
+        if (dnsid) {
+        /*
+         * Destination Master Key-ID field
+         */
+           if ((end - p) < skip_nsid_sizes[dnsid]) {
+               printf("[SKIP|] (truncated)\n");
+               return;
+           }
+           printf("SKIP: Dest. Master Key-ID\t");
+            if (dnsid==1) {
+               printf("%s",ipaddr_string(p));
+               p+=skip_nsid_sizes[dnsid];
+           } else {
+               for (i = 0; i < skip_nsid_sizes[dnsid]; i++) {
+                   printf("%02x ", (unsigned char) *p++);
+               }
+           }
+           printf("\n");
+        }
+        if (p<end) skip_print_next(nxt,p,end-p,bp2);
+        else printf("(truncated)\n");
+}
+
+
+
+void ah_print(register const u_char *bp, register int length, 
+                                                       const u_char *bp2)
+{
+       struct ip *ip;
+       const u_char *end;
+       const u_char *p;
+       u_char  nxt;
+       int len, i;
+       u_int spi;
+
+       ip=(struct ip *)bp2;
+       p=bp;
+       end=bp+length<snapend?bp+length:snapend;
+
+
+       printf("SKIP-AH: %s>%s:%d",ipaddr_string(&ip->ip_src),
+                              ipaddr_string(&ip->ip_dst),length);
+       if (!skipflag)
+               return;
+
+       if (end-p <4) {
+            printf("[SKIP-AH|]\n");
+           return;
+       }
+
+        nxt = *p;
+        printf("\nSKIP-AH: Next Protocol Field\t0x%02x\t\t%s\n", nxt, 
+                                                   skip_protocol_name(nxt));
+        p++;
+
+       len= 4 * (int) *p;
+       printf("SKIP-AH: length\t\t\t%d\n", len);
+
+        p++;
+
+        if (*p) printf("SKIP-AH: byte 3\t\t\treserved,\tis now0x%02x\n",
+                                                               (int) *p++);
+        else p++;
+        if (*p) printf("SKIP-AH: byte 4\t\t\treserved,\tis now0x%02x\n",
+                                                               (int) *p++);
+        else p++;
+
+       if (end-p <4) {
+            printf("[SKIP-AH|]\n");
+           return;
+       }
+
+       spi=*p++<<24; 
+       spi+=*p++<<16;
+       spi+=*p++<<8;
+       spi+=*p;
+        printf("SKIP-AH: SPI\t\t\t0x%08x\t", spi );
+       if (spi==0) {
+           printf("NO association\n");
+       } else if (spi==1) {
+           printf("SKIP association\n");
+           if (expected_auth_size) {
+               if (expected_auth_size != len) {
+                   printf("Warning: Length does not match SKIP Auth Alg!\n");
+               }
+               expected_auth_size=0;
+           }
+       } else if (spi<256) {
+           printf("UNKNOWN association\n");
+       } else {
+           printf("DYNAMIC association\n");
+        }
+
+        p++;
+
+        /*
+         * authentication data
+         */
+
+        if ((unsigned short) (end - p) < len) {
+           printf("[SKIP-AH|] (truncated)\n");
+           return;
+        }
+
+        printf("SKIP-AH: Authentication Data\t");
+        for (i = 0; i < len; i++) {
+                printf("%02x ", (unsigned char) *p++);
+               if (i<len-1 && (i+1)%16==0) printf("\n\t\t\t\t");
+        }
+        printf("\n");
+
+        if (p<end) skip_print_next(nxt,p,end-p,bp2);
+        else printf("(truncated)\n");
+}
+
+
+void esp_print(register const u_char *bp, register int length, 
+                                                       const u_char *bp2)
+{
+       struct ip *ip;
+       const u_char *end;
+       const u_char *p;
+       int len, i;
+       u_int spi;
+
+       ip=(struct ip *)bp2;
+       p=bp;
+       end=bp+length<snapend?bp+length:snapend;
+
+
+       printf("SKIP-ESP: %s>%s:%d",ipaddr_string(&ip->ip_src),
+                              ipaddr_string(&ip->ip_dst),length);
+       if (!skipflag)
+               return;
+
+       if (end-p <4) {
+            printf("[SKIP-ESP|]\n");
+       }
+
+       spi=*p++<<24; 
+       spi+=*p++<<16;
+       spi+=*p++<<8;
+       spi+=*p;
+        printf("\nSKIP-ESP: SPI\t\t\t0x%08x\t", spi );
+       if (spi==0) {
+           printf("NO association\n");
+           len=0;
+       } else if (spi==1) {
+           printf("SKIP association\n");
+           len=expected_iv_size;
+           if (!expected_iv_size) {
+               printf("Warning: IV size not defined by SKIP Crypt Alg!\n");
+           } else expected_iv_size=0;
+       } else if (spi<256) {
+           printf("UNKNOWN association\n");
+           len=0;
+       } else {
+           printf("DYNAMIC association\n");
+           len=0;
+        }
+
+        p++;
+        /*
+         * IV data
+         */
+
+        if ((unsigned short) (end - p) < len) {
+           printf("[SKIP-ESP|] (truncated)\n");
+           return;
+        }
+
+        printf("SKIP-ESP: Initalization Vector\t");
+       if (len) {
+           for (i = 0; i < len; i++) {
+                   printf("%02x ", (unsigned char) *p++);
+                   if (i<len-1 && (i+1)%16==0) printf("\n\t\t\t\t");
+           }
+        } else {
+           printf("UNDEFINED (unknown algorithm)");
+       }
+       printf("\n");
+
+       /* no further analysis is possible without decrypting */
+}
+
index 582e903..400e3f9 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-sl.c,v 1.2 1996/03/04 15:59:36 mickey Exp $     */
 /*     $NetBSD: print-sl.c,v 1.5 1995/03/06 19:11:29 mycroft Exp $     */
 
 /*
@@ -129,9 +130,11 @@ sliplink_print(register const u_char *p, register const struct ip *ip,
 
        case TYPE_UNCOMPRESSED_TCP:
                /*
-                * The connection id is stode in the IP protcol field.
+                * The connection id is stored in the IP protcol field.
+                * Get it from the link layer since sl_uncompress_tcp()
+                * has restored the IP header copy to IPPROTO_TCP.
                 */
-               lastconn = ip->ip_p;
+               lastconn = ((struct ip *)&p[SLX_CHDR])->ip_p;
                hlen = ip->ip_hl;
                hlen += ((struct tcphdr *)&((int *)ip)[hlen])->th_off;
                lastlen[dir][lastconn] = length - (hlen << 2);
index 87bda37..e414fb1 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-snmp.c,v 1.2 1996/03/04 15:59:37 mickey Exp $   */
 /*     $NetBSD: print-snmp.c,v 1.3 1995/03/06 19:11:30 mycroft Exp $   */
 
 /*
index d3e23a3..d0d32a7 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-sunrpc.c,v 1.2 1996/03/04 15:59:39 mickey Exp $ */
 /*     $NetBSD: print-sunrpc.c,v 1.3 1995/03/06 19:11:32 mycroft Exp $ */
 
 /*
index 50545d1..f658dc3 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-tcp.c,v 1.2 1996/03/04 15:59:39 mickey Exp $    */
 /*     $NetBSD: print-tcp.c,v 1.5 1995/03/06 19:11:33 mycroft Exp $    */
 
 /*
@@ -92,7 +93,7 @@ tcp_print(register const u_char *bp, register int length,
        register u_char flags;
        register int hlen;
        u_short sport, dport, win, urp;
-       tcp_seq seq, ack;
+       u_int32 seq, ack;
 
        tp = (struct tcphdr *)bp;
        ip = (struct ip *)bp2;
@@ -180,7 +181,7 @@ tcp_print(register const u_char *bp, register int length,
        hlen = tp->th_off * 4;
        length -= hlen;
        if (length > 0 || flags & (TH_SYN | TH_FIN | TH_RST))
-               (void)printf(" %lu:%lu(%d)", seq, seq + length, length);
+               (void)printf(" %u:%u(%d)", seq, seq + length, length);
        if (flags & TH_ACK)
                (void)printf(" ack %u", ack);
 
index a193832..1c84102 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-tftp.c,v 1.2 1996/03/04 15:59:40 mickey Exp $   */
 /*     $NetBSD: print-tftp.c,v 1.2 1995/03/06 19:11:35 mycroft Exp $   */
 
 /*
index 4758c9d..084c514 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-udp.c,v 1.2 1996/03/04 15:59:41 mickey Exp $    */
 /*     $NetBSD: print-udp.c,v 1.3 1995/03/06 19:11:36 mycroft Exp $    */
 
 /*
index ac7d682..0af3044 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: print-wb.c,v 1.2 1996/03/04 15:59:42 mickey Exp $     */
 /*     $NetBSD: print-wb.c,v 1.2 1995/03/06 19:11:37 mycroft Exp $     */
 
 /*
index 1f98e50..8eb234c 100644 (file)
@@ -1,3 +1,4 @@
+#      $OpenBSD: send-ack.awk,v 1.2 1996/03/04 15:59:43 mickey Exp $
 #      $NetBSD: send-ack.awk,v 1.2 1995/03/06 19:11:42 mycroft Exp $
 
 BEGIN  {
index d57968e..1faa8ff 100644 (file)
@@ -1,3 +1,4 @@
+#      $OpenBSD: stime.awk,v 1.2 1996/03/04 15:59:44 mickey Exp $
 #      $NetBSD: stime.awk,v 1.2 1995/03/06 19:11:43 mycroft Exp $
 
 $6 !~ /^ack/ && $5 !~ /[SFR]/  {
index 01879d3..9e4f20c 100644 (file)
@@ -1,3 +1,4 @@
+.\"    $OpenBSD: tcpdump.8,v 1.2 1996/03/04 15:59:45 mickey Exp $
 .\"    $NetBSD: tcpdump.8,v 1.3 1995/03/06 19:11:46 mycroft Exp $
 .\"
 .\" @(#) Header: tcpdump.1,v 1.45 94/06/20 18:54:27 leres Exp (LBL)
index fc6b153..db5ba53 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: tcpdump.c,v 1.2 1996/03/04 15:59:46 mickey Exp $      */
 /*     $NetBSD: tcpdump.c,v 1.3 1995/04/24 13:27:48 cgd Exp $  */
 
 /*
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
+
+/*
+ * Copyright (c) 1995 Sun Microsystems, Inc.
+ * All rights reserved.
+ * 
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+
+ * IN NO EVENT SHALL SUN MICROSYSTEMS, INC. BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+ * SUN MICROSYSTEMS, INC. HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+
+ * SUN MICROSYSTEMS, INC. SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+ * THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND SUN
+ * MICROSYSTEMS, INC. HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
+ * UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+*/
 #ifndef lint
 char copyright[] =
     "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994\nThe Regents of the University of California.  All rights reserved.\n";
 static  char rcsid[] =
-    "@(#)Header: tcpdump.c,v 1.93 94/06/10 17:01:44 mccanne Exp (LBL)";
+    "@(#)Header: tcpdump.c,v 1.93 94/06/10 17:01:44 mccanne Exp (LBL)";
 #endif
 
 /*
@@ -64,6 +89,7 @@ int xflag;                    /* print packet in hex */
 int Oflag = 1;                 /* run filter code optimizer */
 int Sflag;                     /* print raw TCP sequence numbers */
 int packettype;
+int skipflag;                  /* Print out SKIP packets */
 
 int dflag;                     /* print filter code */
 
@@ -153,7 +179,7 @@ main(int argc, char **argv)
                program_name = argv[0];
 
        opterr = 0;
-       while ((op = getopt(argc, argv, "c:defF:i:lnNOpqr:s:StT:vw:xY")) != EOF)
+       while ((op = getopt(argc, argv, "c:defF:i:klnNOpqr:s:StT:vw:xY")) != EOF)
                switch (op) {
                case 'c':
                        cnt = atoi(optarg);
@@ -179,6 +205,10 @@ main(int argc, char **argv)
                        device = optarg;
                        break;
 
+               case 'k':
+                       skipflag++;
+                       break;
+
                case 'l':
                        setlinebuf(stdout);
                        break;
@@ -323,7 +353,11 @@ main(int argc, char **argv)
                fprintf(stderr, "%s: listening on %s\n", program_name, device);
                fflush(stderr);
        }
-       pcap_loop(pd, cnt, printer, pcap_userdata);
+       if (pcap_loop(pd, cnt, printer, pcap_userdata) < 0) {
+               (void)fprintf(stderr, "%s: pcap_loop: %s\n",
+                   program_name, pcap_geterr(pd));
+               exit(1);
+       }
        pcap_close(pd);
        exit(0);
 }
index 2c456a8..105b6e4 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: util.c,v 1.2 1996/03/04 15:59:47 mickey Exp $ */
 /*     $NetBSD: util.c,v 1.3 1995/03/06 19:11:53 mycroft Exp $ */
 
 /*
@@ -319,16 +320,22 @@ read_infile(char *fname)
 int
 gmt2local()
 {
-#ifndef SOLARIS
-       struct timeval now;
+#ifndef SVR4
+       struct timeval tv;
        struct timezone tz;
-       long t;
+       register struct tm *tm;
+       register int t;
 
-       if (gettimeofday(&now, &tz) < 0)
+       if (gettimeofday(&tv, &tz) < 0)
                error("gettimeofday");
+       tm = localtime((time_t *)&tv.tv_sec);
+#ifndef SUNOS3
+       t = tm->tm_gmtoff;
+#else
        t = tz.tz_minuteswest * -60;
-       if (localtime((time_t *)&now.tv_sec)->tm_isdst)
-               t += 3600;
+       if (tm->tm_isdst)
+               t += 60 * 60;
+#endif
        return (t);
 #else
        tzset();
index 33cc7ff..b24722b 100644 (file)
@@ -1,3 +1,4 @@
+/*     $OpenBSD: version.c,v 1.2 1996/03/04 15:59:48 mickey Exp $      */
 /*     $NetBSD: version.c,v 1.2 1995/03/06 19:11:56 mycroft Exp $      */
 
-char version[] = "3.0";
+char version[] = "3.0.2";