mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-24 02:23:27 +08:00
add baseline FRF.15 (=fragmentation) support for frame-relay
This commit is contained in:
parent
5730fd122f
commit
ecdfb8a72a
3
nlpid.c
3
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" },
|
||||
|
3
nlpid.h
3
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
|
||||
|
59
print-fr.c
59
print-fr.c
@ -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.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user