Defined more standard ethernet protocol types

This commit is contained in:
Luca Deri
2021-08-09 17:01:10 +02:00
parent 58ca7b5a7f
commit 05492ec8e8
2 changed files with 12 additions and 20 deletions
+4 -4
View File
@@ -1789,7 +1789,7 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow,
/* check ether type */ /* check ether type */
switch(type) { switch(type) {
case VLAN: case ETH_P_VLAN:
vlan_id = ((packet[ip_offset] << 8) + packet[ip_offset+1]) & 0xFFF; vlan_id = ((packet[ip_offset] << 8) + packet[ip_offset+1]) & 0xFFF;
type = (packet[ip_offset+2] << 8) + packet[ip_offset+3]; type = (packet[ip_offset+2] << 8) + packet[ip_offset+3];
ip_offset += 4; ip_offset += 4;
@@ -1804,8 +1804,8 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow,
recheck_type = 1; recheck_type = 1;
break; break;
case MPLS_UNI: case ETH_P_MPLS_UNI:
case MPLS_MULTI: case ETH_P_MPLS_MULTI:
mpls.u32 = *((uint32_t *) &packet[ip_offset]); mpls.u32 = *((uint32_t *) &packet[ip_offset]);
mpls.u32 = ntohl(mpls.u32); mpls.u32 = ntohl(mpls.u32);
workflow->stats.mpls_count++; workflow->stats.mpls_count++;
@@ -1819,7 +1819,7 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow,
recheck_type = 1; recheck_type = 1;
break; break;
case PPPOE: case ETH_P_PPPoE:
workflow->stats.pppoe_count++; workflow->stats.pppoe_count++;
type = ETH_P_IP; type = ETH_P_IP;
ip_offset += 8; ip_offset += 8;
+8 -16
View File
@@ -390,28 +390,20 @@
#define ETH_P_IPV6 0x86dd /* IPv6 */ #define ETH_P_IPV6 0x86dd /* IPv6 */
#endif #endif
#ifndef CISCO_SLARP #ifndef ETH_P_VLAN
#define CISCO_SLARP 0x8035 /* Cisco Slarp */ #define ETH_P_VLAN 0x8100
#endif #endif
#ifndef CISCO_D_PROTO #ifndef ETH_P_MPLS_UNI
#define CISCO_D_PROTO 0x2000 /* Cisco Discovery Protocol */ #define ETH_P_MPLS_UNI 0x8847
#endif #endif
#ifndef VLAN #ifndef ETH_P_MPLS_MULTI
#define VLAN 0x8100 #define ETH_P_MPLS_MULTI 0x8848
#endif #endif
#ifndef MPLS_UNI #ifndef ETH_P_PPPoE
#define MPLS_UNI 0x8847 #define ETH_P_PPPoE 0x8864
#endif
#ifndef MPLS_MULTI
#define MPLS_MULTI 0x8848
#endif
#ifndef PPPOE
#define PPPOE 0x8864
#endif #endif
#endif /* __NDPI_DEFINE_INCLUDE_FILE__ */ #endif /* __NDPI_DEFINE_INCLUDE_FILE__ */