aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorHidde van der Heide <hvanderheide@nexuz.net>2018-01-10 10:40:54 +0100
committerHidde van der Heide <hvanderheide@nexuz.net>2018-01-10 10:40:54 +0100
commitd896ce7469f5cebf08086c6ff2219c9909b02195 (patch)
treebd1ef0564669f1c1a105320dcfc5f47c90d2e952 /example
parentbf8c9c2625928e069266b96cf92a4b493a58ff4b (diff)
parent77cb8ccaeace7c83a697f199aa1cdd784423b47c (diff)
Merge remote-tracking branch 'upstream/dev' into dev
Diffstat (limited to 'example')
-rw-r--r--example/ndpi_util.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/example/ndpi_util.c b/example/ndpi_util.c
index d0a8470dc..af83c6d14 100644
--- a/example/ndpi_util.c
+++ b/example/ndpi_util.c
@@ -689,7 +689,10 @@ struct ndpi_proto ndpi_workflow_process_packet (struct ndpi_workflow * workflow,
const struct ndpi_wifi_header *wifi;
/* --- MPLS header --- */
- struct ndpi_mpls_header *mpls;
+ union mpls {
+ uint32_t u32;
+ struct ndpi_mpls_header mpls;
+ } mpls;
/** --- IP header --- **/
struct ndpi_iphdr *iph;
@@ -846,15 +849,15 @@ struct ndpi_proto ndpi_workflow_process_packet (struct ndpi_workflow * workflow,
break;
case MPLS_UNI:
case MPLS_MULTI:
- mpls = (struct ndpi_mpls_header *) &packet[ip_offset];
- label = ntohl(mpls->label);
- /* label = ntohl(*((u_int32_t*)&packet[ip_offset])); */
+ mpls.u32 = *((uint32_t *) &packet[ip_offset]);
+ mpls.u32 = ntohl(mpls.u32);
workflow->stats.mpls_count++;
type = ETH_P_IP, ip_offset += 4;
- while((label & 0x100) != 0x100) {
+ while(!mpls.mpls.s) {
ip_offset += 4;
- label = ntohl(mpls->label);
+ mpls.u32 = *((uint32_t *) &packet[ip_offset]);
+ mpls.u32 = ntohl(mpls.u32);
}
break;
case PPPoE: