OVS_GREP_IFELSE([$KSRC/include/net/ip.h], [ip_do_fragment])
OVS_GREP_IFELSE([$KSRC/include/net/ip.h], [ip_is_fragment])
OVS_GREP_IFELSE([$KSRC/include/net/ip.h], [ip_skb_dst_mtu])
+
+ OVS_GREP_IFELSE([$KSRC/include/net/ip.h], [IPSKB_FRAG_PMTU],
+ [OVS_DEFINE([HAVE_CORRECT_MRU_HANDLING])])
OVS_GREP_IFELSE([$KSRC/include/net/inet_frag.h], [hashfn.*const],
[OVS_DEFINE([HAVE_INET_FRAGS_CONST])])
OVS_GREP_IFELSE([$KSRC/include/net/inet_frag.h], [last_in],
#endif
#endif
+#ifndef HAVE_CORRECT_MRU_HANDLING
static unsigned int rpl_frag_percpu_counter_batch = 130000;
#define frag_percpu_counter_batch rpl_frag_percpu_counter_batch
void rpl_inet_frag_destroy(struct inet_frag_queue *q, struct inet_frags *f);
#define inet_frag_destroy(q, f, work) rpl_inet_frag_destroy(q, f)
+#endif /* !HAVE_CORRECT_MRU_HANDLING */
#endif /* OVS_FRAGMENT_BACKPORT */
#endif /* inet_frag.h */
#define OVS_VPORT_OUTPUT_PARAMS struct sk_buff *skb
#endif
-#ifdef OVS_FRAGMENT_BACKPORT
+/* Prior to upstream commit d6b915e29f4a ("ip_fragment: don't forward
+ * defragmented DF packet"), IPCB(skb)->frag_max_size was not always populated
+ * correctly, which would lead to reassembled packets not being refragmented.
+ * So, we backport all of ip_defrag() in these cases.
+ */
+#if !defined(HAVE_CORRECT_MRU_HANDLING) && defined(OVS_FRAGMENT_BACKPORT)
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
static inline bool ip_defrag_user_in_between(u32 user,
{
return user >= lower_bond && user <= upper_bond;
}
-#endif
+#endif /* < v4.2 */
#ifndef HAVE_IP_DO_FRAGMENT
static inline int rpl_ip_do_fragment(struct sock *sk, struct sk_buff *skb,
#define ip_do_fragment rpl_ip_do_fragment
#endif /* IP_DO_FRAGMENT */
-/* Prior to upstream commit d6b915e29f4a ("ip_fragment: don't forward
- * defragmented DF packet"), IPCB(skb)->frag_max_size was not always populated
- * correctly, which would lead to reassembled packets not being refragmented.
- * So, we backport all of ip_defrag() in these cases.
- */
int rpl_ip_defrag(struct sk_buff *skb, u32 user);
#define ip_defrag rpl_ip_defrag
int __init rpl_ipfrag_init(void);
void rpl_ipfrag_fini(void);
-#else /* OVS_FRAGMENT_BACKPORT */
+#else /* HAVE_CORRECT_MRU_HANDLING || !OVS_FRAGMENT_BACKPORT */
/* We have no good way to detect the presence of upstream commit 8282f27449bf
* ("inet: frag: Always orphan skbs inside ip_defrag()"), but it should be
static inline int rpl_ipfrag_init(void) { return 0; }
static inline void rpl_ipfrag_fini(void) { }
-#endif /* OVS_FRAGMENT_BACKPORT */
+#endif /* HAVE_CORRECT_MRU_HANDLING && OVS_FRAGMENT_BACKPORT */
#define ipfrag_init rpl_ipfrag_init
#define ipfrag_fini rpl_ipfrag_fini
#include <linux/version.h>
-#ifdef OVS_FRAGMENT_BACKPORT
+#if !defined(HAVE_CORRECT_MRU_HANDLING) && defined(OVS_FRAGMENT_BACKPORT)
#include <linux/list.h>
#include <linux/spinlock.h>
net_dbg_ratelimited("%s%s", prefix, msg);
}
-#endif /* OVS_FRAGMENT_BACKPORT */
+#endif /* !HAVE_CORRECT_MRU_HANDLING && OVS_FRAGMENT_BACKPORT */