From Gordon McKinney: make IP-over-PPP work with the TCP graph code.
authorGuy Harris <guy@alum.mit.edu>
Sun, 9 Dec 2001 01:20:14 +0000 (01:20 -0000)
committerGuy Harris <guy@alum.mit.edu>
Sun, 9 Dec 2001 01:20:14 +0000 (01:20 -0000)
svn path=/trunk/; revision=4367

AUTHORS
gtk/tcp_graph.c

diff --git a/AUTHORS b/AUTHORS
index 99f2779050bb0486b7ad8a25790156f063b420b6..a923e7335753b372ef6562b9127fbaa0b7250a45 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -869,6 +869,7 @@ Gordon McKinney <gordon[AT]night-ray.com> {
        Enhanced Ethereal icon for Windows
        Support for time stamping packets in text2pcap
        Fix to text2pcap to handle colons after offset field
+       Make IP-over-PPP work with the TCP graph code
 }
 
 Pavel Novotny <Pavel.Novotny[AT]icn.siemens.de> {
index 77e90e5dc02ad429cc4619017c5c65f17a22f2ba..1f4e338a04b52d75877c9d2759a297612480a071 100644 (file)
@@ -3,7 +3,7 @@
  * By Pavel Mores <pvl@uh.cz>
  * Win32 port:  rwh@unifiedtech.com
  *
- * $Id: tcp_graph.c,v 1.2 2001/12/08 09:39:23 guy Exp $
+ * $Id: tcp_graph.c,v 1.3 2001/12/09 01:20:14 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -58,6 +58,13 @@ struct ether_header {
 #define ETHERTYPE_IP   0x0800
 
 
+/* reverse engineered from capture file, not too difficult :) */
+struct ppp_header {
+       guint8 ppp_type;        /* Protocol on PPP connection */
+};
+#define PPPTYPE_IP 0x21
+
+
 #undef BITFIELDS
 
 /* from <netinet/ip.h> */
@@ -567,8 +574,8 @@ void tcp_graph_cb (GtkWidget *w, gpointer data, guint graph_type)
 
        g->type = graph_type;
        if (!get_headers (cfile.pd, &current)) {
-               /* currently selected packet is neither TCP over IP over Ethernet II
-                * nor TCP over IP alone (= IP over PPP) - should display some
+               /* currently selected packet is neither TCP over IP over Ethernet II/PPP
+                * nor TCP over IP alone - should display some
                 * kind of warning dialog */
                printf ("packet selected is not a TCP segment\n");
                return;
@@ -1800,14 +1807,19 @@ static void graph_segment_list_get (struct graph *g)
 static int get_headers (char *pd, struct segment *hdrs)
 {
        struct ether_header *e;
+       struct ppp_header   *p;
        struct iphdr *ip;
        struct tcphdr *tcp;
 
        e = (struct ether_header * )pd;
+       p = (struct ppp_header * )pd;
        if (ntohs (e->ether_type) == ETHERTYPE_IP) {
                ip = (struct iphdr * )((struct ether_header * )pd + 1);
        } else if (((struct iphdr *)e)->protocol == IPPROTO_TCP) {
                ip = (struct iphdr *)e;
+       } else if ( (p->ppp_type == PPPTYPE_IP) &&                                                      /* IP Protocol over PPP */
+                               (((struct iphdr *)(p+1))->protocol == IPPROTO_TCP) ) {  /* TCP Protocol over IP */
+               ip = (struct iphdr *)(p+1);
        } else {
                /* printf ("not IP over Ethernet II or PPP\n"); */
                return FALSE;