From 05492ec8e8431584c4b436e1411b69b24a84c766 Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Mon, 9 Aug 2021 17:01:10 +0200 Subject: Defined more standard ethernet protocol types --- example/reader_util.c | 8 ++++---- src/include/ndpi_define.h.in | 24 ++++++++---------------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/example/reader_util.c b/example/reader_util.c index bd2d0d202..c960005ed 100644 --- a/example/reader_util.c +++ b/example/reader_util.c @@ -1789,7 +1789,7 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow, /* check ether type */ switch(type) { - case VLAN: + case ETH_P_VLAN: vlan_id = ((packet[ip_offset] << 8) + packet[ip_offset+1]) & 0xFFF; type = (packet[ip_offset+2] << 8) + packet[ip_offset+3]; ip_offset += 4; @@ -1804,8 +1804,8 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow, recheck_type = 1; break; - case MPLS_UNI: - case MPLS_MULTI: + case ETH_P_MPLS_UNI: + case ETH_P_MPLS_MULTI: mpls.u32 = *((uint32_t *) &packet[ip_offset]); mpls.u32 = ntohl(mpls.u32); workflow->stats.mpls_count++; @@ -1819,7 +1819,7 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow, recheck_type = 1; break; - case PPPOE: + case ETH_P_PPPoE: workflow->stats.pppoe_count++; type = ETH_P_IP; ip_offset += 8; diff --git a/src/include/ndpi_define.h.in b/src/include/ndpi_define.h.in index 5488b046f..2560852d8 100644 --- a/src/include/ndpi_define.h.in +++ b/src/include/ndpi_define.h.in @@ -390,28 +390,20 @@ #define ETH_P_IPV6 0x86dd /* IPv6 */ #endif -#ifndef CISCO_SLARP -#define CISCO_SLARP 0x8035 /* Cisco Slarp */ +#ifndef ETH_P_VLAN +#define ETH_P_VLAN 0x8100 #endif -#ifndef CISCO_D_PROTO -#define CISCO_D_PROTO 0x2000 /* Cisco Discovery Protocol */ +#ifndef ETH_P_MPLS_UNI +#define ETH_P_MPLS_UNI 0x8847 #endif -#ifndef VLAN -#define VLAN 0x8100 +#ifndef ETH_P_MPLS_MULTI +#define ETH_P_MPLS_MULTI 0x8848 #endif -#ifndef MPLS_UNI -#define MPLS_UNI 0x8847 -#endif - -#ifndef MPLS_MULTI -#define MPLS_MULTI 0x8848 -#endif - -#ifndef PPPOE -#define PPPOE 0x8864 +#ifndef ETH_P_PPPoE +#define ETH_P_PPPoE 0x8864 #endif #endif /* __NDPI_DEFINE_INCLUDE_FILE__ */ -- cgit v1.2.3