summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorguy <guy>2008-02-06 10:49:22 +0000
committerguy <guy>2008-02-06 10:49:22 +0000
commit48ecdd0e0bb33d17852063fbf839b593f1dfc8bf (patch)
tree678bf55cf0fde339ea2799410b3d16d79295b7e4
parent202e6f729caf900d0fe7ba1d15a0731e6cfd0f8d (diff)
downloadtcpdump-48ecdd0e0bb33d17852063fbf839b593f1dfc8bf.tar.gz
From Andrew Silent: Realtek Remote Control Protocol support (see
OpenRRCP.org.ru for details).
-rw-r--r--CREDITS1
-rw-r--r--FILES1
-rw-r--r--INSTALL.txt3
-rw-r--r--Makefile.in8
-rw-r--r--ethertype.h5
-rw-r--r--netdissect.h5
-rw-r--r--print-ether.c7
-rw-r--r--print-rrcp.c137
-rw-r--r--win32/prj/GNUmakefile1
-rw-r--r--win32/prj/WinDump.dsp4
10 files changed, 163 insertions, 9 deletions
diff --git a/CREDITS b/CREDITS
index 37013ad2..efbcbc4f 100644
--- a/CREDITS
+++ b/CREDITS
@@ -18,6 +18,7 @@ Additional people who have contributed patches:
Andrew Brown <atatat at atatdot dot net>
Andrew Church <andrew at users dot sourceforge dot net>
Andrew Hintz <adhintz at users dot sourceforge dot net>
+ Andrew Silent <nording at users dot sourceforge dot net>
Andrew Tridgell <tridge at linuxcare dot com>
Andy Heffernan <ahh at juniper dot net>
Arkadiusz Miskiewicz <misiek at pld dot org dot pl>
diff --git a/FILES b/FILES
index fd6ee3dd..8329e26d 100644
--- a/FILES
+++ b/FILES
@@ -192,6 +192,7 @@ print-radius.c
print-raw.c
print-rip.c
print-ripng.c
+print-rrcp.c
print-rsvp.c
print-rt6.c
print-rx.c
diff --git a/INSTALL.txt b/INSTALL.txt
index 2a9a5b61..e263f536 100644
--- a/INSTALL.txt
+++ b/INSTALL.txt
@@ -1,4 +1,4 @@
-@(#) $Header: /tcpdump/master/tcpdump/INSTALL.txt,v 1.1 2007-10-05 01:47:40 guy Exp $ (LBL)
+@(#) $Header: /tcpdump/master/tcpdump/INSTALL.txt,v 1.1.2.1 2008-02-06 10:49:22 guy Exp $ (LBL)
If you have not built libpcap, and your system does not have libpcap
installed, install libpcap first. Your system might provide a version
@@ -200,6 +200,7 @@ print-radius.c - Radius protocol printer routines
print-raw.c - Raw IP printer routines
print-rip.c - Routing Information Protocol printer routines
print-ripng.c - IPv6 Routing Information Protocol printer routines
+print-rrcp.c - Realtek Remote Control Protocol routines
print-rsvp.c - Resource reSerVation Protocol (RSVP) printer routines
print-rt6.c - IPv6 routing header printer routines
print-rx.c - AFS RX printer routines
diff --git a/Makefile.in b/Makefile.in
index f2470584..e0332b46 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -17,7 +17,7 @@
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.317.2.1 2008-02-04 20:33:49 guy Exp $ (LBL)
+# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.317.2.2 2008-02-06 10:49:22 guy Exp $ (LBL)
#
# Various configurable paths (remember to edit Makefile.in, not Makefile)
@@ -83,9 +83,9 @@ CSRC = addrtoname.c af.c checksum.c cpack.c gmpls.c oui.c gmt2local.c ipproto.c
print-lmp.c print-lspping.c print-lwapp.c \
print-lwres.c print-mobile.c print-mpcp.c print-mpls.c print-msdp.c \
print-nfs.c print-ntp.c print-null.c print-olsr.c print-ospf.c \
- print-pgm.c print-pim.c print-ppp.c print-pppoe.c \
- print-pptp.c print-radius.c print-raw.c print-rip.c \
- print-rsvp.c print-rx.c print-sctp.c print-sflow.c print-sip.c print-sl.c print-sll.c \
+ print-pgm.c print-pim.c print-ppp.c print-pppoe.c print-pptp.c \
+ print-radius.c print-raw.c print-rip.c print-rrcp.c print-rsvp.c \
+ print-rx.c print-sctp.c print-sflow.c print-sip.c print-sl.c print-sll.c \
print-slow.c print-snmp.c print-stp.c print-sunatm.c print-sunrpc.c \
print-symantec.c print-syslog.c print-tcp.c print-telnet.c print-tftp.c \
print-timed.c print-token.c print-udld.c print-udp.c \
diff --git a/ethertype.h b/ethertype.h
index f358c457..97550c7f 100644
--- a/ethertype.h
+++ b/ethertype.h
@@ -18,7 +18,7 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: /tcpdump/master/tcpdump/ethertype.h,v 1.29 2007-08-03 11:03:19 hannes Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/ethertype.h,v 1.29.2.1 2008-02-06 10:49:22 guy Exp $ (LBL)
*/
/*
@@ -136,6 +136,9 @@
#ifndef ETHERTYPE_EAPOL
#define ETHERTYPE_EAPOL 0x888e
#endif
+#ifndef ETHERTYPE_RRCP
+#define ETHERTYPE_RRCP 0x8899
+#endif
#ifndef ETHERTYPE_LOOPBACK
#define ETHERTYPE_LOOPBACK 0x9000
#endif
diff --git a/netdissect.h b/netdissect.h
index fc8dfbab..c63a940e 100644
--- a/netdissect.h
+++ b/netdissect.h
@@ -21,7 +21,7 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: /tcpdump/master/tcpdump/netdissect.h,v 1.23 2007-01-29 09:59:42 hannes Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/netdissect.h,v 1.23.2.1 2008-02-06 10:49:22 guy Exp $ (LBL)
*/
#ifndef netdissect_h
@@ -250,7 +250,7 @@ extern const char *dnnum_string(netdissect_options *, u_short);
#include <pcap.h>
-extern void eap_print(netdissect_options *,const u_char *, u_int);
+extern void eap_print(netdissect_options *,const u_char *, u_int);
extern int esp_print(netdissect_options *,
register const u_char *bp, int len, register const u_char *bp2,
int *nhdr, int *padlen);
@@ -263,6 +263,7 @@ extern void ip_print(netdissect_options *,const u_char *, u_int);
extern void ip_print_inner(netdissect_options *ndo,
const u_char *bp, u_int length, u_int nh,
const u_char *bp2);
+extern void rrcp_print(netdissect_options *,const u_char *, u_int);
/* stuff that has not yet been rototiled */
#if 0
diff --git a/print-ether.c b/print-ether.c
index 08434b9a..b66e885c 100644
--- a/print-ether.c
+++ b/print-ether.c
@@ -20,7 +20,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.105 2007-08-03 11:03:19 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.105.2.1 2008-02-06 10:49:22 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -70,6 +70,7 @@ const struct tok ethertype_values[] = {
{ ETHERTYPE_PPPOED, "PPPoE D" },
{ ETHERTYPE_PPPOES, "PPPoE S" },
{ ETHERTYPE_EAPOL, "EAPOL" },
+ { ETHERTYPE_RRCP, "RRCP" },
{ ETHERTYPE_JUMBO, "Jumbo" },
{ ETHERTYPE_LOOPBACK, "Loopback" },
{ ETHERTYPE_ISO, "OSI" },
@@ -295,6 +296,10 @@ ether_encap_print(u_short ether_type, const u_char *p,
eap_print(gndo, p, length);
return (1);
+ case ETHERTYPE_RRCP:
+ rrcp_print(gndo, p - 14 , length + 14);
+ return (1);
+
case ETHERTYPE_PPP:
if (length) {
printf(": ");
diff --git a/print-rrcp.c b/print-rrcp.c
new file mode 100644
index 00000000..7f03f189
--- /dev/null
+++ b/print-rrcp.c
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2007 - Andrey "nording" Chernyak <andrew@nording.ru>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code distributions
+ * retain the above copyright notice and this paragraph in its entirety, (2)
+ * distributions including binary code include the above copyright notice and
+ * this paragraph in its entirety in the documentation or other materials
+ * provided with the distribution, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Format and print Realtek Remote Control Protocol (RRCP)
+ * and Realtek Echo Protocol (RRCP-REP) packets.
+ */
+
+#ifndef lint
+static const char rcsid[] _U_ =
+ "@(#) $Header: /tcpdump/master/tcpdump/print-rrcp.c,v 1.1.2.1 2008-02-06 10:49:22 guy Exp $";
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tcpdump-stdinc.h>
+
+#include <stdio.h>
+#include <string.h>
+
+#include "netdissect.h"
+#include "addrtoname.h"
+#include "extract.h"
+#include "ether.h"
+
+#ifndef ETH_ALEN
+#define ETH_ALEN 6
+#endif
+
+struct rrcp_packet_t
+{
+ uint16_t rrcp_ethertype; /* 0x8899 */
+ uint8_t rrcp_proto; /* must be 0x01 */
+ uint8_t rrcp_opcode:7; /* 0x00 = hello, 0x01 = get, 0x02 = set */
+ uint8_t rrcp_isreply:1; /* 0 = request to switch, 1 = reply from switch */
+ uint16_t rrcp_authkey; /* 0x2379 by default */
+ uint16_t rrcp_reg_addr; /* register address */
+ uint32_t rrcp_reg_data; /* register data */
+ uint32_t cookie1;
+ uint32_t cookie2;
+};
+
+struct rrcp_helloreply_packet_t
+{
+ uint16_t rrcp_ethertype; /* 0x8899 */
+ uint8_t rrcp_proto; /* must be 0x01 */
+ uint8_t rrcp_opcode:7; /* 0x00 = hello, 0x01 = get, 0x02 = set */
+ uint8_t rrcp_isreply:1; /* 0 = request to switch, 1 = reply from switch */
+ uint16_t rrcp_authkey; /* 0x2379 by default */
+ uint8_t rrcp_downlink_port; /* */
+ uint8_t rrcp_uplink_port; /* */
+ uint8_t rrcp_uplink_mac[ETH_ALEN]; /* */
+ uint16_t rrcp_chip_id; /* */
+ uint32_t rrcp_vendor_id; /* */
+};
+
+
+/*
+ * Print RRCP requests
+ */
+void
+rrcp_print(netdissect_options *ndo,
+ register const u_char *cp,
+ u_int length _U_)
+{
+ const struct rrcp_packet_t *rrcp;
+ const struct rrcp_helloreply_packet_t *rrcp_hello;
+ register const struct ether_header *ep;
+ char proto_str[16];
+ char opcode_str[32];
+
+ ep = (const struct ether_header *)cp;
+ rrcp = (const struct rrcp_packet_t *)(cp+12);
+ rrcp_hello = (const struct rrcp_helloreply_packet_t *)(cp+12);
+
+ if (rrcp->rrcp_proto==1){
+ strcpy(proto_str,"RRCP");
+ }else if ( rrcp->rrcp_proto==2 ){
+ strcpy(proto_str,"RRCP-REP");
+ }else{
+ sprintf(proto_str,"RRCP-0x%02d",rrcp->rrcp_proto);
+ }
+ if (rrcp->rrcp_opcode==0){
+ strcpy(opcode_str,"hello");
+ }else if ( rrcp->rrcp_opcode==1 ){
+ strcpy(opcode_str,"get");
+ }else if ( rrcp->rrcp_opcode==2 ){
+ strcpy(opcode_str,"set");
+ }else{
+ sprintf(opcode_str,"unknown opcode (0x%02d)",rrcp->rrcp_opcode);
+ }
+ ND_PRINT((ndo, "%s > %s, %s %s",
+ etheraddr_string(ESRC(ep)),
+ etheraddr_string(EDST(ep)),
+ proto_str, rrcp->rrcp_isreply ? "reply" : "query"));
+ if (rrcp->rrcp_proto==1){
+ ND_PRINT((ndo, ": %s", opcode_str));
+ }
+ if (rrcp->rrcp_opcode==1 || rrcp->rrcp_opcode==2){
+ ND_PRINT((ndo, " addr=0x%04x, data=0x%04x",
+ rrcp->rrcp_reg_addr, rrcp->rrcp_reg_data, rrcp->rrcp_authkey));
+ }
+ if (rrcp->rrcp_proto==1){
+ ND_PRINT((ndo, ", auth=0x%04x",
+ ntohs(rrcp->rrcp_authkey)));
+ }
+ if (rrcp->rrcp_proto==1 && rrcp->rrcp_opcode==0 && rrcp->rrcp_isreply){
+ ND_PRINT((ndo, " downlink_port=%d, uplink_port=%d, uplink_mac=%s, vendor_id=%08x ,chip_id=%04x ",
+ rrcp_hello->rrcp_downlink_port,
+ rrcp_hello->rrcp_uplink_port,
+ etheraddr_string(rrcp_hello->rrcp_uplink_mac),
+ rrcp_hello->rrcp_vendor_id,
+ rrcp_hello->rrcp_chip_id));
+ }else if (rrcp->rrcp_opcode==1 || rrcp->rrcp_opcode==2 || rrcp->rrcp_proto==2){
+ ND_PRINT((ndo, ", cookie=0x%08x%08x ",
+ rrcp->cookie2, rrcp->cookie1));
+ }
+ if (!ndo->ndo_vflag)
+ return;
+}
diff --git a/win32/prj/GNUmakefile b/win32/prj/GNUmakefile
index b7e0a772..37a8b9aa 100644
--- a/win32/prj/GNUmakefile
+++ b/win32/prj/GNUmakefile
@@ -114,6 +114,7 @@ OBJS = \
../../print-pptp.o \
../../print-radius.o \
../../print-raw.o \
+ ../../print-rrcp.o \
../../print-rip.o \
../../print-ripng.o \
../../print-rsvp.o \
diff --git a/win32/prj/WinDump.dsp b/win32/prj/WinDump.dsp
index 5bb8e103..9bb9b47f 100644
--- a/win32/prj/WinDump.dsp
+++ b/win32/prj/WinDump.dsp
@@ -473,6 +473,10 @@ SOURCE="..\..\print-raw.c"
# End Source File
# Begin Source File
+SOURCE="..\..\print-rrcp.c"
+# End Source File
+# Begin Source File
+
SOURCE="..\..\print-rip.c"
# End Source File
# Begin Source File