@@ -408,7 +408,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
[OVS_DEFINE([HAVE_INET_GET_LOCAL_PORT_RANGE_USING_NET])])
OVS_GREP_IFELSE([$KSRC/include/net/ip.h], [ip_defrag.*net],
[OVS_DEFINE([HAVE_IP_DEFRAG_TAKES_NET])])
- OVS_GREP_IFELSE([$KSRC/include/net/ip.h], [ip_do_fragment])
+ OVS_GREP_IFELSE([$KSRC/include/net/ip.h], [ip_do_fragment.*net],
+ [OVS_DEFINE([HAVE_IP_DO_FRAGMENT_USING_NET])])
OVS_GREP_IFELSE([$KSRC/include/net/ip.h], [ip_skb_dst_mtu])
OVS_GREP_IFELSE([$KSRC/include/net/ip.h], [IPSKB_FRAG_PMTU],
@@ -702,7 +702,7 @@ static void ovs_fragment(struct net *net, struct vport *vport,
skb_dst_set_noref(skb, &ovs_dst);
IPCB(skb)->frag_max_size = mru;
- ip_do_fragment(skb->sk, skb, ovs_vport_output);
+ ip_do_fragment(net, skb->sk, skb, ovs_vport_output);
refdst_drop(orig_dst);
} else if (ethertype == htons(ETH_P_IPV6)) {
const struct nf_ipv6_ops *v6ops = nf_get_ipv6_ops();
@@ -81,8 +81,9 @@ static inline bool ip_defrag_user_in_between(u32 user,
}
#endif /* < v4.2 */
-#ifndef HAVE_IP_DO_FRAGMENT
-static inline int rpl_ip_do_fragment(struct sock *sk, struct sk_buff *skb,
+#ifndef HAVE_IP_DO_FRAGMENT_USING_NET
+static inline int rpl_ip_do_fragment(struct net *net, struct sock *sk,
+ struct sk_buff *skb,
int (*output)(OVS_VPORT_OUTPUT_PARAMS))
{
unsigned int mtu = ip_skb_dst_mtu(skb);
@@ -95,7 +96,7 @@ static inline int rpl_ip_do_fragment(struct sock *sk, struct sk_buff *skb,
IPCB(skb)->frag_max_size > mtu))) {
pr_warn("Dropping packet in ip_do_fragment()\n");
- IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGFAILS);
+ IP_INC_STATS(net, IPSTATS_MIB_FRAGFAILS);
kfree_skb(skb);
return -EMSGSIZE;
}
@@ -107,7 +108,7 @@ static inline int rpl_ip_do_fragment(struct sock *sk, struct sk_buff *skb,
#endif
}
#define ip_do_fragment rpl_ip_do_fragment
-#endif /* IP_DO_FRAGMENT */
+#endif /* IP_DO_FRAGMENT_USING_NET */
/* If backporting IP defrag, then init/exit functions need to be called from
* compat_{in,ex}it() to prepare the backported fragmentation cache. In this
@@ -120,6 +121,16 @@ void rpl_ipfrag_fini(void);
#else /* HAVE_CORRECT_MRU_HANDLING */
+#ifndef HAVE_IP_DO_FRAGMENT_USING_NET
+static inline int rpl_ip_do_fragment(struct net *net, struct sock *sk,
+ struct sk_buff *skb,
+ int (*output)(OVS_VPORT_OUTPUT_PARAMS))
+{
+ return ip_do_fragment(sk, skb, output);
+}
+#define ip_do_fragment rpl_ip_do_fragment
+#endif
+
/* 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
* always included in kernels 4.5+. */