1
0
This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
TP-Link_Archer-XR500v/EN7526G_3.18Kernel_SDK/apps/public/linux-atm/extra/tcpdump-3.4.patch
2024-07-22 01:58:46 -03:00

266 lines
8.9 KiB
Diff
Executable File

diff -u -r --new-file orig/libpcap-0.4/bpf/net/bpf.h hessu/libpcap-0.4/bpf/net/bpf.h
--- orig/libpcap-0.4/bpf/net/bpf.h Sun Jul 12 23:11:25 1998
+++ hessu/libpcap-0.4/bpf/net/bpf.h Thu Feb 4 00:13:18 1999
@@ -172,6 +172,7 @@
#define DLT_RAW 12 /* raw IP */
#define DLT_SLIP_BSDOS 13 /* BSD/OS Serial Line IP */
#define DLT_PPP_BSDOS 14 /* BSD/OS Point-to-point Protocol */
+#define DLT_ATM_CLIP 19 /* Classical-IP over ATM */
/*
* The instruction encondings.
diff -u -r --new-file orig/libpcap-0.4/gencode.c hessu/libpcap-0.4/gencode.c
--- orig/libpcap-0.4/gencode.c Sun Jul 12 23:07:07 1998
+++ hessu/libpcap-0.4/gencode.c Thu Feb 4 00:14:31 1999
@@ -530,6 +530,10 @@
off_linktype = -1;
off_nl = 0;
return;
+ case DLT_ATM_CLIP:
+ off_linktype = 6;
+ off_nl = 8;
+ return;
}
bpf_error("unknown data link type 0x%x", linktype);
/* NOTREACHED */
diff -u -r --new-file orig/libpcap-0.4/pcap-linux.c hessu/libpcap-0.4/pcap-linux.c
--- orig/libpcap-0.4/pcap-linux.c Fri Oct 3 08:39:53 1997
+++ hessu/libpcap-0.4/pcap-linux.c Thu Feb 4 00:40:50 1999
@@ -227,6 +227,12 @@
p->md.skip = 12;
break;
+#ifndef ARPHRD_ATM /* FIXME: How to #include this? */
+#define ARPHRD_ATM 19
+#endif
+ case ARPHRD_ATM:
+ p->linktype = DLT_ATM_CLIP;
+ break;
#ifdef ARPHRD_FDDI
/* Not all versions of the kernel has this define */
case ARPHRD_FDDI:
diff -u -r --new-file orig/tcpdump-3.4/COPYRIGHT.TUT hessu/tcpdump-3.4/COPYRIGHT.TUT
--- orig/tcpdump-3.4/COPYRIGHT.TUT Thu Jan 1 02:00:00 1970
+++ hessu/tcpdump-3.4/COPYRIGHT.TUT Thu Feb 4 00:38:07 1999
@@ -0,0 +1,21 @@
+/*
+ * Marko Kiiskila carnil@cs.tut.fi
+ *
+ * Tampere University of Technology - Telecommunications Laboratory
+ *
+ * Permission to use, copy, modify and distribute this
+ * software and its documentation is hereby granted,
+ * provided that both the copyright notice and this
+ * permission notice appear in all copies of the software,
+ * derivative works or modified versions, and any portions
+ * thereof, that both notices appear in supporting
+ * documentation, and that the use of this software is
+ * acknowledged in any publications resulting from using
+ * the software.
+ *
+ * TUT ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION AND DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS
+ * SOFTWARE.
+ *
+ */
diff -u -r --new-file orig/tcpdump-3.4/INSTALL hessu/tcpdump-3.4/INSTALL
--- orig/tcpdump-3.4/INSTALL Sun Jul 12 23:12:28 1998
+++ hessu/tcpdump-3.4/INSTALL Thu Feb 4 00:41:36 1999
@@ -133,6 +133,7 @@
print-tftp.c - Trivial File Transfer Protocol printer routines
print-udp.c - UDP printer routines
print-wb.c - white board printer routines
+print-cip.c - Classical-IP over ATM routines
savestr.c - savestr prototypes
savestr.h - strdup() replacement
send-ack.awk - unidirectional tcp send/ack awk script
diff -u -r --new-file orig/tcpdump-3.4/Makefile.in hessu/tcpdump-3.4/Makefile.in
--- orig/tcpdump-3.4/Makefile.in Fri Jan 9 05:17:03 1998
+++ hessu/tcpdump-3.4/Makefile.in Wed Feb 3 23:56:52 1999
@@ -71,7 +71,7 @@
print-llc.c print-nfs.c print-ntp.c print-null.c print-ospf.c \
print-pim.c print-ppp.c print-raw.c print-rip.c print-sl.c \
print-snmp.c print-sunrpc.c print-tcp.c print-tftp.c print-udp.c \
- print-wb.c addrtoname.c bpf_dump.c gmt2local.c machdep.c \
+ print-wb.c print-cip.c addrtoname.c bpf_dump.c gmt2local.c machdep.c \
parsenfsfh.c util.c savestr.c setsignal.c
LOCALSRC =
GENSRC = version.c
diff -u -r --new-file orig/tcpdump-3.4/interface.h hessu/tcpdump-3.4/interface.h
--- orig/tcpdump-3.4/interface.h Wed May 28 22:54:45 1997
+++ hessu/tcpdump-3.4/interface.h Wed Feb 3 23:46:30 1999
@@ -206,3 +206,4 @@
extern void tftp_print(const u_char *, u_int);
extern void udp_print(const u_char *, u_int, const u_char *);
extern void wb_print(const void *, u_int);
+extern void cip_if_print(u_char *, const struct pcap_pkthdr *,const u_char *);
diff -u -r --new-file orig/tcpdump-3.4/print-cip.c hessu/tcpdump-3.4/print-cip.c
--- orig/tcpdump-3.4/print-cip.c Thu Jan 1 02:00:00 1970
+++ hessu/tcpdump-3.4/print-cip.c Thu Feb 4 00:02:07 1999
@@ -0,0 +1,153 @@
+/*
+ * Marko Kiiskila carnil@cs.tut.fi
+ *
+ * Tampere University of Technology - Telecommunications Laboratory
+ *
+ * Permission to use, copy, modify and distribute this
+ * software and its documentation is hereby granted,
+ * provided that both the copyright notice and this
+ * permission notice appear in all copies of the software,
+ * derivative works or modified versions, and any portions
+ * thereof, that both notices appear in supporting
+ * documentation, and that the use of this software is
+ * acknowledged in any publications resulting from using
+ * the software.
+ *
+ * TUT ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION AND DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS
+ * SOFTWARE.
+ *
+ */
+
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <net/if.h>
+
+#include <netinet/in.h>
+#include <netinet/if_ether.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <netinet/ip_var.h>
+#include <netinet/udp.h>
+#include <netinet/udp_var.h>
+#include <netinet/tcp.h>
+#include <netinet/tcpip.h>
+
+#include <stdio.h>
+#include <pcap.h>
+
+#include "interface.h"
+#include "addrtoname.h"
+
+const u_char *packetp;
+const u_char *snapend;
+
+#define RFC1483LLC_LEN 8
+
+static unsigned char rfcllc[] = {
+ 0xaa, /* DSAP: non-ISO */
+ 0xaa, /* SSAP: non-ISO */
+ 0x03, /* Ctrl: Unnumbered Information Command PDU */
+ 0x00, /* OUI: EtherType */
+ 0x00,
+ 0x00 };
+
+static inline void
+cip_print(register const u_char *bp, int length)
+{
+ int i;
+
+ if (memcmp(rfcllc, bp, sizeof(rfcllc))) {
+ if (qflag) {
+ for(i=0;i<RFC1483LLC_LEN;i++)
+ (void)printf("%2.2x ",bp[i]);
+ } else {
+ for(i=0;i<RFC1483LLC_LEN-2;i++)
+ (void)printf("%2.2x ",bp[i]);
+ etherproto_string(((u_short*)bp)[3]);
+ }
+ } else {
+ if (qflag)
+ (void)printf("(null encapsulation)");
+ else {
+ (void)printf("(null encap)");
+ etherproto_string(ETHERTYPE_IP);
+ }
+ }
+}
+
+/*
+ * This is the top level routine of the printer. 'p' is the points
+ * to the raw 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
+cip_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
+{
+ int caplen = h->caplen;
+ int length = h->len;
+ u_short ether_type;
+ extern u_short extracted_ethertype;
+ u_short *bp;
+
+ ts_print(&h->ts);
+
+ if (memcmp(rfcllc, p, sizeof(rfcllc))==0 && caplen < RFC1483LLC_LEN) {
+ printf("[|cip]");
+ goto out;
+ }
+
+ if (eflag)
+ cip_print(p, length);
+
+ /*
+ * 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;
+
+ if (memcmp(rfcllc, p, sizeof(rfcllc))==0) {
+ length -= RFC1483LLC_LEN;
+ caplen -= RFC1483LLC_LEN;
+ bp = (u_short*)p;
+ p += RFC1483LLC_LEN;
+ ether_type = ntohs(bp[3]);
+ } else
+ ether_type = ETHERTYPE_IP;
+
+ /*
+ * Is it (gag) an 802.3 encapsulation?
+ */
+ extracted_ethertype = 0;
+ if (ether_type < ETHERMTU) {
+ /* Try to print the LLC-layer header & higher layers */
+ if (llc_print(p, length, caplen, NULL, NULL)==0) {
+ /* ether_type not known, print raw packet */
+ if (!eflag)
+ cip_print((u_char *)bp, length);
+ if (extracted_ethertype) {
+ printf("(LLC %s) ",
+ etherproto_string(htons(extracted_ethertype)));
+ }
+ if (!xflag && !qflag)
+ default_print(p, caplen);
+ }
+ } else if (ether_encap_print(ether_type, p, length, caplen) == 0) {
+ /* ether_type not known, print raw packet */
+ if (!eflag)
+ cip_print((u_char *)bp, length + RFC1483LLC_LEN);
+ if (!xflag && !qflag)
+ default_print(p, caplen);
+ }
+ if (xflag)
+ default_print(p, caplen);
+ out:
+ putchar('\n');
+}
diff -u -r --new-file orig/tcpdump-3.4/tcpdump.c hessu/tcpdump-3.4/tcpdump.c
--- orig/tcpdump-3.4/tcpdump.c Sat Oct 18 23:50:17 1997
+++ hessu/tcpdump-3.4/tcpdump.c Thu Feb 4 00:19:10 1999
@@ -100,6 +100,7 @@
{ null_if_print, DLT_NULL },
{ raw_if_print, DLT_RAW },
{ atm_if_print, DLT_ATM_RFC1483 },
+ { cip_if_print, DLT_ATM_CLIP },
{ NULL, 0 },
};