aboutsummaryrefslogtreecommitdiff
path: root/example/ndpi_util.c
diff options
context:
space:
mode:
authorCampus <campus@ntop.org>2017-04-15 00:29:53 +0200
committerCampus <campus@ntop.org>2017-04-15 00:29:53 +0200
commit29cd6ef9942188633b79b5c1fe62360f048a6450 (patch)
treec259bf30b7b75dcd1742c22800abda1124bb7a72 /example/ndpi_util.c
parentd8b2189cc30f675fba46b072d162dc5943b1c362 (diff)
fix segmentation fault caused by missing spanning tree check - add control for threads return values
Diffstat (limited to 'example/ndpi_util.c')
-rw-r--r--example/ndpi_util.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/example/ndpi_util.c b/example/ndpi_util.c
index 60dc94230..a5d9d300d 100644
--- a/example/ndpi_util.c
+++ b/example/ndpi_util.c
@@ -48,6 +48,7 @@
#define MPLS_MULTI 0x8848
#define PPPoE 0x8864
#define SNAP 0xaa
+#define BSTP 0x42 /* Bridge Spanning Tree Protocol */
/* mask for FCF */
#define WIFI_DATA 0x2 /* 0000 0010 */
@@ -286,8 +287,10 @@ static struct ndpi_flow_info *get_ndpi_flow_info(struct ndpi_workflow * workflow
tcp_len = ndpi_min(4*(*tcph)->doff, l4_packet_len);
*payload = &l4[tcp_len];
*payload_len = ndpi_max(0, l4_packet_len-4*(*tcph)->doff);
- } else if(iph->protocol == IPPROTO_UDP && l4_packet_len >= 8) {
+
// udp
+ } else if(iph->protocol == IPPROTO_UDP && l4_packet_len >= 8) {
+
workflow->stats.udp_count++;
*udph = (struct ndpi_udphdr *)l4;
@@ -670,12 +673,16 @@ struct ndpi_proto ndpi_workflow_process_packet (struct ndpi_workflow * workflow,
type = check;
if(pyld_eth_len != 0) {
+ llc = (struct ndpi_llc_header *)(&packet[ip_offset]);
/* check for LLC layer with SNAP extension */
- if(packet[ip_offset] == SNAP) {
- llc = (struct ndpi_llc_header *)(&packet[ip_offset]);
+ if(llc->dsap == SNAP || llc->ssap == SNAP) {
+#define SNAP_EXT
type = llc->snap.proto_ID;
ip_offset += + 8;
}
+ else if(llc->dsap == BSTP || llc->ssap == BSTP) {
+ goto v4_warning;
+ }
}
break;