added cisco hdlc datalink type - fix MPLS header - added BGP pcap with cisco hdlc & MPLS header
This commit is contained in:
+16
-2
@@ -71,7 +71,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define VLAN 0x8100
|
#define VLAN 0x8100
|
||||||
#define MPLS 0x8847
|
#define MPLS_UNI 0x8847
|
||||||
|
#define MPLS_MULTI 0x8848
|
||||||
#define PPPoE 0x8864
|
#define PPPoE 0x8864
|
||||||
|
|
||||||
/* mask for FCF */
|
/* mask for FCF */
|
||||||
@@ -1551,6 +1552,8 @@ static void pcap_packet_callback(u_char *args,
|
|||||||
*/
|
*/
|
||||||
/** --- Ethernet header --- **/
|
/** --- Ethernet header --- **/
|
||||||
const struct ndpi_ethhdr *ethernet;
|
const struct ndpi_ethhdr *ethernet;
|
||||||
|
/** --- Cisco HDLC header --- **/
|
||||||
|
const struct ndpi_chdlc *chdlc;
|
||||||
|
|
||||||
/** --- ieee802.11 --- **/
|
/** --- ieee802.11 --- **/
|
||||||
/* Radio Tap header */
|
/* Radio Tap header */
|
||||||
@@ -1560,6 +1563,9 @@ static void pcap_packet_callback(u_char *args,
|
|||||||
/* Data frame */
|
/* Data frame */
|
||||||
const struct ndpi_wifi_data_frame *wifi_data;
|
const struct ndpi_wifi_data_frame *wifi_data;
|
||||||
|
|
||||||
|
/* MPLS header */
|
||||||
|
const struct ndpi_mplshdr * mphls;
|
||||||
|
|
||||||
/** --- IP header --- **/
|
/** --- IP header --- **/
|
||||||
struct ndpi_iphdr *iph;
|
struct ndpi_iphdr *iph;
|
||||||
/** --- IPv6 header --- **/
|
/** --- IPv6 header --- **/
|
||||||
@@ -1624,6 +1630,14 @@ static void pcap_packet_callback(u_char *args,
|
|||||||
|
|
||||||
ip_offset = 4 + eth_offset;
|
ip_offset = 4 + eth_offset;
|
||||||
|
|
||||||
|
/* Cisco PPP with HDLC framing - 104 (http://tools.ietf.org/html/rfc1547#section-4.3.1) */
|
||||||
|
case DLT_C_HDLC:
|
||||||
|
chdlc = (struct ndpi_chdlc *) &packet[eth_offset];
|
||||||
|
ip_offset = sizeof(struct ndpi_chdlc); /* CHDLC_OFF = 4 */
|
||||||
|
type = ntohs(chdlc->proto_code);
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* IEEE 802.3 Ethernet - 1 */
|
||||||
case DLT_EN10MB :
|
case DLT_EN10MB :
|
||||||
ethernet = (struct ndpi_ethhdr *) &packet[eth_offset];
|
ethernet = (struct ndpi_ethhdr *) &packet[eth_offset];
|
||||||
ip_offset = sizeof(struct ndpi_ethhdr) + eth_offset;
|
ip_offset = sizeof(struct ndpi_ethhdr) + eth_offset;
|
||||||
@@ -1684,7 +1698,7 @@ static void pcap_packet_callback(u_char *args,
|
|||||||
vlan_packet = 1;
|
vlan_packet = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(type == MPLS) {
|
else if(type == MPLS_UNI || type == MPLS_MULTI) {
|
||||||
label = ntohl(*((u_int32_t*)&packet[ip_offset]));
|
label = ntohl(*((u_int32_t*)&packet[ip_offset]));
|
||||||
ndpi_thread_info[thread_id].stats.mpls_count++;
|
ndpi_thread_info[thread_id].stats.mpls_count++;
|
||||||
type = 0x800, ip_offset += 4;
|
type = 0x800, ip_offset += 4;
|
||||||
|
|||||||
@@ -48,6 +48,16 @@
|
|||||||
#pragma pack(pop) /* restore original alignment from stack */
|
#pragma pack(pop) /* restore original alignment from stack */
|
||||||
|
|
||||||
|
|
||||||
|
/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
|
||||||
|
/* ++++++++++ Cisco HDLC data structures +++++++++++++++++++++++ */
|
||||||
|
/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
|
||||||
|
struct ndpi_chdlc
|
||||||
|
{
|
||||||
|
u_int8_t addr; /* 0x0F (Unicast) - 0x8F (Broadcast) */
|
||||||
|
u_int8_t ctrl; /* always 0x00 */
|
||||||
|
u_int16_t proto_code; /* protocol type (e.g. 0x0800 IP) */
|
||||||
|
};
|
||||||
|
|
||||||
/* ++++++++++++++++++++++++++++++++++++++++++++++++++ */
|
/* ++++++++++++++++++++++++++++++++++++++++++++++++++ */
|
||||||
/* +++++++++++ Ethernet data structures +++++++++++++ */
|
/* +++++++++++ Ethernet data structures +++++++++++++ */
|
||||||
/* ++++++++++++++++++++++++++++++++++++++++++++++++++ */
|
/* ++++++++++++++++++++++++++++++++++++++++++++++++++ */
|
||||||
@@ -59,7 +69,6 @@ struct ndpi_ethhdr
|
|||||||
u_int16_t h_proto; /* packet type ID field */
|
u_int16_t h_proto; /* packet type ID field */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* ++++++++++++++++++++++++++++++++++++++++++++++++++ */
|
/* ++++++++++++++++++++++++++++++++++++++++++++++++++ */
|
||||||
/* +++++++++++ ieee802.11 data structures +++++++++++ */
|
/* +++++++++++ ieee802.11 data structures +++++++++++ */
|
||||||
/* ++++++++++++++++++++++++++++++++++++++++++++++++++ */
|
/* ++++++++++++++++++++++++++++++++++++++++++++++++++ */
|
||||||
@@ -125,7 +134,6 @@ struct ndpi_llc_header_proto
|
|||||||
/* ++++++++++++++ IP data structures ++++++++++++++++ */
|
/* ++++++++++++++ IP data structures ++++++++++++++++ */
|
||||||
/* ++++++++++++++++++++++++++++++++++++++++++++++++++ */
|
/* ++++++++++++++++++++++++++++++++++++++++++++++++++ */
|
||||||
|
|
||||||
|
|
||||||
/* IP header */
|
/* IP header */
|
||||||
struct ndpi_iphdr {
|
struct ndpi_iphdr {
|
||||||
#if defined(__LITTLE_ENDIAN__)
|
#if defined(__LITTLE_ENDIAN__)
|
||||||
@@ -180,9 +188,11 @@ struct ndpi_ip6_ext
|
|||||||
u_int8_t ip6e_len; /* length in units of 8 octets. */
|
u_int8_t ip6e_len; /* length in units of 8 octets. */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define s6_addr __u6_addr.__u6_addr8
|
/*
|
||||||
#define s6_addr16 __u6_addr.__u6_addr16
|
#define s6_addr u6_addr.u6_addr8
|
||||||
#define s6_addr32 __u6_addr.__u6_addr32
|
#define s6_addr16 u6_addr.u6_addr16
|
||||||
|
#define s6_addr32 u6_addr.u6_addr32
|
||||||
|
*/
|
||||||
#else
|
#else
|
||||||
#ifndef __KERNEL__
|
#ifndef __KERNEL__
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,4 @@
|
|||||||
|
BGP 2 322 2
|
||||||
|
|
||||||
|
1 TCP 2.2.2.2:179 <-> 4.4.4.4:63535 [proto: 13/BGP][1 pkts/163 bytes]
|
||||||
|
2 TCP 2.2.2.2:179 <-> 5.5.5.5:49433 [proto: 13/BGP][1 pkts/159 bytes]
|
||||||
Reference in New Issue
Block a user