diff --git a/datapath/linux-2.6/compat-2.6/compat26.h b/datapath/linux-2.6/compat-2.6/compat26.h index 04335f7..8159517 100644 --- a/datapath/linux-2.6/compat-2.6/compat26.h +++ b/datapath/linux-2.6/compat-2.6/compat26.h @@ -26,4 +26,9 @@ #endif /* linux kernel <= 2.6.22 */ +/* For CentOS / RHEL kernel compatibility */ +#ifndef RHEL_RELEASE_VERSION +#define RHEL_RELEASE_VERSION(X,Y) ( 0 ) +#endif + #endif /* compat26.h */ diff --git a/datapath/linux-2.6/compat-2.6/include/linux/ip.h b/datapath/linux-2.6/compat-2.6/include/linux/ip.h index 7915873..f397371 100644 --- a/datapath/linux-2.6/compat-2.6/include/linux/ip.h +++ b/datapath/linux-2.6/compat-2.6/include/linux/ip.h @@ -4,7 +4,8 @@ #include_next #include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) +#if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)) && \ + (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(5,2))) #ifdef __KERNEL__ #include diff --git a/datapath/linux-2.6/compat-2.6/include/linux/skbuff.h b/datapath/linux-2.6/compat-2.6/include/linux/skbuff.h index 9430f52..1de5ccc 100644 --- a/datapath/linux-2.6/compat-2.6/include/linux/skbuff.h +++ b/datapath/linux-2.6/compat-2.6/include/linux/skbuff.h @@ -6,7 +6,7 @@ #include #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17) -/* Emulate Linux 2.6.17 and later behavior, in which kfree_skb silently ignores +/* Emulate Linux 2.6.17 and later behavior, in which kfree_skb silently ignores * null pointer arguments. */ #define kfree_skb(skb) kfree_skb_maybe_null(skb) static inline void kfree_skb_maybe_null(struct sk_buff *skb) @@ -20,6 +20,7 @@ static inline void kfree_skb_maybe_null(struct sk_buff *skb) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) /* Note that CHECKSUM_PARTIAL is not implemented, but this allows us to at * least test against it: see update_csum() in forward.c. */ +#undef CHECKSUM_PARTIAL #define CHECKSUM_PARTIAL 3 #define CHECKSUM_COMPLETE CHECKSUM_HW #endif /* linux kernel < 2.6.19 */ @@ -30,6 +31,8 @@ static inline void kfree_skb_maybe_null(struct sk_buff *skb) #define mac_header mac.raw #define network_header nh.raw +#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(5,2) + static inline unsigned char *skb_transport_header(const struct sk_buff *skb) { return skb->h.raw; @@ -70,6 +73,8 @@ static inline int skb_transport_offset(const struct sk_buff *skb) { return skb_transport_header(skb) - skb->data; } +#endif /* rhel version < 5.2 */ + #endif /* linux kernel < 2.6.22 */ #endif diff --git a/datapath/linux-2.6/compat-2.6/include/linux/tcp.h b/datapath/linux-2.6/compat-2.6/include/linux/tcp.h index e8b5197..31e41ed 100644 --- a/datapath/linux-2.6/compat-2.6/include/linux/tcp.h +++ b/datapath/linux-2.6/compat-2.6/include/linux/tcp.h @@ -4,7 +4,8 @@ #include_next #include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) +#if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)) && \ + (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(5,2))) #ifdef __KERNEL__ static inline struct tcphdr *tcp_hdr(const struct sk_buff *skb) diff --git a/datapath/linux-2.6/compat-2.6/include/linux/udp.h b/datapath/linux-2.6/compat-2.6/include/linux/udp.h index ffab187..52cc4ca 100644 --- a/datapath/linux-2.6/compat-2.6/include/linux/udp.h +++ b/datapath/linux-2.6/compat-2.6/include/linux/udp.h @@ -4,7 +4,8 @@ #include_next #include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) +#if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)) && \ + (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(5,2))) #ifdef __KERNEL__ static inline struct udphdr *udp_hdr(const struct sk_buff *skb)