]> The Tcpdump Group git mirrors - tcpdump/commitdiff
add baseline FRF.15 (=fragmentation) support for frame-relay
authorhannes <hannes>
Tue, 12 Oct 2004 21:02:00 +0000 (21:02 +0000)
committerhannes <hannes>
Tue, 12 Oct 2004 21:02:00 +0000 (21:02 +0000)
nlpid.c
nlpid.h
print-fr.c

diff --git a/nlpid.c b/nlpid.c
index d903c125e0625049034010f9c46bab0d3f27dfa6..425ad9533473b846fda85466827faa4076c45ae2 100755 (executable)
--- a/nlpid.c
+++ b/nlpid.c
@@ -15,7 +15,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/nlpid.c,v 1.1 2004-10-07 14:53:10 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/nlpid.c,v 1.2 2004-10-12 21:02:00 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -36,6 +36,7 @@ struct tok nlpid_values[] = {
     { NLPID_ISIS, "IS-IS" },
     { NLPID_CONS, "CONS" },
     { NLPID_IDRP, "IDRP" },
+    { NLPID_MFR, "FRF.15" },
     { NLPID_IP, "IPv4" },
     { NLPID_X25_ESIS, "X25 ES-IS" },
     { NLPID_IP6, "IPv6" },
diff --git a/nlpid.h b/nlpid.h
index 69641121796e7f1cc2b16f597f5aafe9f5f17af2..366b36c8c3f5d24ee701cec684fef620a137dd6a 100644 (file)
--- a/nlpid.h
+++ b/nlpid.h
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/nlpid.h,v 1.1 2004-10-07 14:53:10 hannes Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/nlpid.h,v 1.2 2004-10-12 21:02:00 hannes Exp $ (LBL) */
 /* 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that: (1) source code
@@ -25,6 +25,7 @@ extern struct tok nlpid_values[];
 #define        NLPID_ISIS      0x83 /* iso9577 */
 #define NLPID_CONS      0x84
 #define NLPID_IDRP      0x85
+#define NLPID_MFR       0xb1 /* FRF.15 */
 #define NLPID_IP        0xcc
 #define NLPID_X25_ESIS  0x8a
 #define NLPID_IP6       0x8e
index b5330f9c5973a02e43f424476fa3cc5afc11390f..e33785717c2f8e5cb400a4a72ee5ad279d79c8d1 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-       "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.25 2004-10-09 17:55:26 hannes Exp $ (LBL)";
+       "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.26 2004-10-12 21:02:00 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -41,6 +41,7 @@ static const char rcsid[] _U_ =
 #include "extract.h"
 
 static void lmi_print(const u_char *, u_int);
+static void frf15_print(const u_char *, u_int);
 
 /*
  * the frame relay header has a variable length
@@ -61,7 +62,6 @@ static void lmi_print(const u_char *, u_int);
  *    +----+----+----+----+----+----+----+----+
  *    |        DLCI (6 bits)        |SDLC| EA |
  *    +----+----+----+----+----+----+----+----+
-
  */
 
 #define FR_EA_BIT      0x01
@@ -95,7 +95,7 @@ static int parse_q922_addr(const u_char *p, u_int *dlci, u_int *sdlcore,
        *addr_len = 2;
        *dlci = ((p[0] & 0xFC) << 2) | ((p[1] & 0xF0) >> 4);
 
-        flags[0] = p[0] & 0x02; /* populate the frist flag fields */
+        flags[0] = p[0] & 0x02; /* populate the first flag fields */
         flags[1] = p[1] & 0x0c;
 
        if (p[1] & FR_EA_BIT)
@@ -290,6 +290,10 @@ fr_if_print(const struct pcap_pkthdr *h, register const u_char *p)
                lmi_print(p, length);
                break;
 
+        case NLPID_MFR:
+                frf15_print(p, length);
+                break;
+
        default:
                if (!eflag)
                     fr_hdr_print(length + hdr_len, addr_len,
@@ -301,6 +305,55 @@ fr_if_print(const struct pcap_pkthdr *h, register const u_char *p)
        return hdr_len;
 }
 
+/* an NLPID of 0xb1 indicates a 2-byte
+ * FRF.15 header
+ * 
+ *      7    6    5    4    3    2    1    0
+ *    +----+----+----+----+----+----+----+----+
+ *    ~              Q.922 header             ~
+ *    +----+----+----+----+----+----+----+----+
+ *    |             NLPID (8 bits)            | NLPID=0xb1
+ *    +----+----+----+----+----+----+----+----+
+ *    | B  | E  | C  |seq. (high 4 bits) | R  |
+ *    +----+----+----+----+----+----+----+----+
+ *    |        sequence  (low 8 bits)         |
+ *    +----+----+----+----+----+----+----+----+
+ */
+
+struct tok frf15_flag_values[] = {
+    { 0x80, "Begin" },
+    { 0x40, "End" },
+    { 0x20, "Control" },
+    { 0, NULL }
+};
+
+#define FR_FRF15_FRAGTYPE 0x01
+
+static void
+frf15_print (const u_char *p, u_int length) {
+    
+    u_int16_t sequence_num, flags;
+
+    flags = p[0]&0xe0;
+    sequence_num = (p[0]&0x1e)<<7 | p[1];
+
+    printf("FRF.15, seq 0x%03x, Flags [%s],%s Fragmentation, length %u",
+           sequence_num,
+           bittok2str(frf15_flag_values,"none",flags),
+           flags&FR_FRF15_FRAGTYPE ? "Interface" : "End-to-End",
+           length);
+
+/* TODO:
+ * depending on all permutations of the B, E and C bit
+ * dig as deep as we can - e.g. on the first (B) fragment
+ * there is enough payload to print the IP header
+ * on non (B) fragments it depends if the fragmentation
+ * model is end-to-end or interface based wether we want to print
+ * another Q.922 header
+ */
+
+}
+
 /*
  * Q.933 decoding portion for framerelay specific.
  */