mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 16:49:22 +00:00
Merge branch 'Add-ip6_fragment-in-ipv6_stub'
wenxu says: ==================== Add ip6_fragment in ipv6_stub Add ip6_fragment in ipv6_stub and use it in openvswitch This version add default function eafnosupport_ipv6_fragment ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
bd10d45905
4 changed files with 13 additions and 6 deletions
|
@ -63,6 +63,9 @@ struct ipv6_stub {
|
||||||
int encap_type);
|
int encap_type);
|
||||||
#endif
|
#endif
|
||||||
struct neigh_table *nd_tbl;
|
struct neigh_table *nd_tbl;
|
||||||
|
|
||||||
|
int (*ipv6_fragment)(struct net *net, struct sock *sk, struct sk_buff *skb,
|
||||||
|
int (*output)(struct net *, struct sock *, struct sk_buff *));
|
||||||
};
|
};
|
||||||
extern const struct ipv6_stub *ipv6_stub __read_mostly;
|
extern const struct ipv6_stub *ipv6_stub __read_mostly;
|
||||||
|
|
||||||
|
|
|
@ -191,6 +191,13 @@ static int eafnosupport_ip6_del_rt(struct net *net, struct fib6_info *rt,
|
||||||
return -EAFNOSUPPORT;
|
return -EAFNOSUPPORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int eafnosupport_ipv6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
|
||||||
|
int (*output)(struct net *, struct sock *, struct sk_buff *))
|
||||||
|
{
|
||||||
|
kfree_skb(skb);
|
||||||
|
return -EAFNOSUPPORT;
|
||||||
|
}
|
||||||
|
|
||||||
const struct ipv6_stub *ipv6_stub __read_mostly = &(struct ipv6_stub) {
|
const struct ipv6_stub *ipv6_stub __read_mostly = &(struct ipv6_stub) {
|
||||||
.ipv6_dst_lookup_flow = eafnosupport_ipv6_dst_lookup_flow,
|
.ipv6_dst_lookup_flow = eafnosupport_ipv6_dst_lookup_flow,
|
||||||
.ipv6_route_input = eafnosupport_ipv6_route_input,
|
.ipv6_route_input = eafnosupport_ipv6_route_input,
|
||||||
|
@ -201,6 +208,7 @@ const struct ipv6_stub *ipv6_stub __read_mostly = &(struct ipv6_stub) {
|
||||||
.ip6_mtu_from_fib6 = eafnosupport_ip6_mtu_from_fib6,
|
.ip6_mtu_from_fib6 = eafnosupport_ip6_mtu_from_fib6,
|
||||||
.fib6_nh_init = eafnosupport_fib6_nh_init,
|
.fib6_nh_init = eafnosupport_fib6_nh_init,
|
||||||
.ip6_del_rt = eafnosupport_ip6_del_rt,
|
.ip6_del_rt = eafnosupport_ip6_del_rt,
|
||||||
|
.ipv6_fragment = eafnosupport_ipv6_fragment,
|
||||||
};
|
};
|
||||||
EXPORT_SYMBOL_GPL(ipv6_stub);
|
EXPORT_SYMBOL_GPL(ipv6_stub);
|
||||||
|
|
||||||
|
|
|
@ -1027,6 +1027,7 @@ static const struct ipv6_stub ipv6_stub_impl = {
|
||||||
.xfrm6_rcv_encap = xfrm6_rcv_encap,
|
.xfrm6_rcv_encap = xfrm6_rcv_encap,
|
||||||
#endif
|
#endif
|
||||||
.nd_tbl = &nd_tbl,
|
.nd_tbl = &nd_tbl,
|
||||||
|
.ipv6_fragment = ip6_fragment,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct ipv6_bpf_stub ipv6_bpf_stub_impl = {
|
static const struct ipv6_bpf_stub ipv6_bpf_stub_impl = {
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include <linux/in.h>
|
#include <linux/in.h>
|
||||||
#include <linux/ip.h>
|
#include <linux/ip.h>
|
||||||
#include <linux/openvswitch.h>
|
#include <linux/openvswitch.h>
|
||||||
#include <linux/netfilter_ipv6.h>
|
|
||||||
#include <linux/sctp.h>
|
#include <linux/sctp.h>
|
||||||
#include <linux/tcp.h>
|
#include <linux/tcp.h>
|
||||||
#include <linux/udp.h>
|
#include <linux/udp.h>
|
||||||
|
@ -848,13 +847,9 @@ static void ovs_fragment(struct net *net, struct vport *vport,
|
||||||
ip_do_fragment(net, skb->sk, skb, ovs_vport_output);
|
ip_do_fragment(net, skb->sk, skb, ovs_vport_output);
|
||||||
refdst_drop(orig_dst);
|
refdst_drop(orig_dst);
|
||||||
} else if (key->eth.type == htons(ETH_P_IPV6)) {
|
} else if (key->eth.type == htons(ETH_P_IPV6)) {
|
||||||
const struct nf_ipv6_ops *v6ops = nf_get_ipv6_ops();
|
|
||||||
unsigned long orig_dst;
|
unsigned long orig_dst;
|
||||||
struct rt6_info ovs_rt;
|
struct rt6_info ovs_rt;
|
||||||
|
|
||||||
if (!v6ops)
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
prepare_frag(vport, skb, orig_network_offset,
|
prepare_frag(vport, skb, orig_network_offset,
|
||||||
ovs_key_mac_proto(key));
|
ovs_key_mac_proto(key));
|
||||||
memset(&ovs_rt, 0, sizeof(ovs_rt));
|
memset(&ovs_rt, 0, sizeof(ovs_rt));
|
||||||
|
@ -866,7 +861,7 @@ static void ovs_fragment(struct net *net, struct vport *vport,
|
||||||
skb_dst_set_noref(skb, &ovs_rt.dst);
|
skb_dst_set_noref(skb, &ovs_rt.dst);
|
||||||
IP6CB(skb)->frag_max_size = mru;
|
IP6CB(skb)->frag_max_size = mru;
|
||||||
|
|
||||||
v6ops->fragment(net, skb->sk, skb, ovs_vport_output);
|
ipv6_stub->ipv6_fragment(net, skb->sk, skb, ovs_vport_output);
|
||||||
refdst_drop(orig_dst);
|
refdst_drop(orig_dst);
|
||||||
} else {
|
} else {
|
||||||
WARN_ONCE(1, "Failed fragment ->%s: eth=%04x, MRU=%d, MTU=%d.",
|
WARN_ONCE(1, "Failed fragment ->%s: eth=%04x, MRU=%d, MTU=%d.",
|
||||||
|
|
Loading…
Reference in a new issue