From cc57cfe85c61de5619d7147e259990afbfe45726 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 14 Jul 2008 13:54:45 -0700 Subject: [PATCH] packets: New macros for detecting IP fragments. --- include/packets.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/packets.h b/include/packets.h index 5d4eb560..177bc30f 100644 --- a/include/packets.h +++ b/include/packets.h @@ -173,6 +173,12 @@ BUILD_ASSERT_DECL(VLAN_ETH_HEADER_LEN == sizeof(struct vlan_eth_header)); #define IP_VERSION 4 +#define IP_DONT_FRAGMENT 0x4000 /* Don't fragment. */ +#define IP_MORE_FRAGMENTS 0x2000 /* More fragments. */ +#define IP_FRAG_OFF_MASK 0x1fff /* Fragment offset. */ +#define IP_IS_FRAGMENT(ip_frag_off) \ + (ntohs(ip_frag_off) & (IP_MORE_FRAGMENTS | IP_FRAG_OFF_MASK)) + #define IP_HEADER_LEN 20 struct ip_header { uint8_t ip_ihl_ver; -- 2.30.2