aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichele Campus <fci1908@gmail.com>2018-01-09 22:13:57 +0100
committerGitHub <noreply@github.com>2018-01-09 22:13:57 +0100
commit77cb8ccaeace7c83a697f199aa1cdd784423b47c (patch)
tree619e67fc56ea614d1121767992488711a6bf1cbf /src
parent61e297b851af570109e72a93a65b1ac5ccfda0b4 (diff)
parent35dc6e27ae11a92553611a9d3d8c1ed963a894d4 (diff)
Merge pull request #506 from cavedon/dev
Fix MPLS header parsing in ndpiReader.
Diffstat (limited to 'src')
-rw-r--r--src/include/ndpi_typedefs.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h
index beb6a86f8..d0afcb40c 100644
--- a/src/include/ndpi_typedefs.h
+++ b/src/include/ndpi_typedefs.h
@@ -178,7 +178,15 @@ struct ndpi_wifi_header
PACK_ON
struct ndpi_mpls_header
{
+ /* Before using this strcut to parse an MPLS header, you will need to convert
+ * the 4-byte data to the correct endianess with ntohl(). */
+#if defined(__LITTLE_ENDIAN__)
+ u_int32_t ttl:8, s:1, exp:3, label:20;
+#elif defined(__BIG_ENDIAN__)
u_int32_t label:20, exp:3, s:1, ttl:8;
+#else
+# error "Byte order must be defined"
+#endif
} PACK_OFF;
/* ++++++++++++++++++++++++ IP header ++++++++++++++++++++++++ */