From: Ben Pfaff Date: Mon, 14 Jul 2008 20:54:45 +0000 (-0700) Subject: packets: New macros for detecting IP fragments. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc57cfe85c61de5619d7147e259990afbfe45726;p=openvswitch packets: New macros for detecting IP fragments. --- 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;