]> The Tcpdump Group git mirrors - tcpdump/commitdiff
From Andrew Silent: Realtek Remote Control Protocol support (see
authorguy <guy>
Wed, 6 Feb 2008 10:47:53 +0000 (10:47 +0000)
committerguy <guy>
Wed, 6 Feb 2008 10:47:53 +0000 (10:47 +0000)
OpenRRCP.org.ru for details).

CREDITS
FILES
INSTALL.txt
Makefile.in
ethertype.h
netdissect.h
print-ether.c
print-rrcp.c [new file with mode: 0644]
win32/prj/GNUmakefile
win32/prj/WinDump.dsp

diff --git a/CREDITS b/CREDITS
index 37013ad243ce11fa994f2c3e022088c4c3a45444..efbcbc4f0282d991f1104dd6a8e436450302180a 100644 (file)
--- 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 fd6ee3dd971135f650af1c79d2ad4d9e43656aa5..8329e26d6dc984fdd8dcbaf57b693ab3d56484a9 100644 (file)
--- 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
index 2a9a5b61ed12073c4b79bb8a267b09e3e05ce5f8..3f845c053a45d208c25fc70dcbe37389bdb1e9fc 100644 (file)
@@ -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.2 2008-02-06 10:47:53 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
index bbe4f4d031b0b7b5bc66e3233803d873268efcc7..e6029c00636017e45e410c3c0733e5424f11d669 100644 (file)
@@ -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.319 2008-02-04 20:33:21 guy Exp $ (LBL)
+# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.320 2008-02-06 10:47:53 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 \
index f358c4571c4d61a1c42462e788606fcfd3f6f2a6..dbbbae4afd44b2dcba5e6fcf7649fcf29df89fcb 100644 (file)
@@ -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.30 2008-02-06 10:47:53 guy Exp $ (LBL)
  */
 
 /*
 #ifndef ETHERTYPE_EAPOL
 #define ETHERTYPE_EAPOL        0x888e
 #endif
+#ifndef ETHERTYPE_RRCP
+#define ETHERTYPE_RRCP         0x8899
+#endif
 #ifndef        ETHERTYPE_LOOPBACK
 #define        ETHERTYPE_LOOPBACK      0x9000
 #endif
index bea9252f3af5f55c12b3882502c1b27de13e5690..2406ae5d22bdf6f744bdc531ce13296f4e45be63 100644 (file)
@@ -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.24 2007-11-24 18:13:33 mcr Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/netdissect.h,v 1.25 2008-02-06 10:47:53 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
index 08434b9ae87fa88ad5bb064a2b670f4a31ef5bc7..c93fd6c8643f0a92d913fd3b90ff4223ae0a966e 100644 (file)
@@ -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.106 2008-02-06 10:47:53 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 (file)
index 0000000..dfd6459
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2007 - Andrey "nording" Chernyak <[email protected]>
+ *
+ * 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 2008-02-06 10:47:53 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;
+}
index b7e0a77257a7e4a5b62c291bef2932108233ca0e..37a8b9aa558665cb11d54e74069a3bf2802e8693 100644 (file)
@@ -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 \
index 5bb8e103c4d7a98217710b6811feef583bb40c3f..9bb9b47fa234e80d84d498a97d64582a049282f5 100644 (file)
@@ -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