openvswitch: Introduce ovs_tunnel_route_lookup
Introduce ovs_tunnel_route_lookup to consolidate route lookup shared by vxlan, gre, and geneve ports. Signed-off-by: Fan Du <fan.du@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -145,7 +145,7 @@ static int vxlan_tnl_send(struct vport *vport, struct sk_buff *skb)
|
||||
struct net *net = ovs_dp_get_net(vport->dp);
|
||||
struct vxlan_port *vxlan_port = vxlan_vport(vport);
|
||||
__be16 dst_port = inet_sk(vxlan_port->vs->sock->sk)->inet_sport;
|
||||
struct ovs_key_ipv4_tunnel *tun_key;
|
||||
const struct ovs_key_ipv4_tunnel *tun_key;
|
||||
struct rtable *rt;
|
||||
struct flowi4 fl;
|
||||
__be16 src_port;
|
||||
@@ -158,15 +158,7 @@ static int vxlan_tnl_send(struct vport *vport, struct sk_buff *skb)
|
||||
}
|
||||
|
||||
tun_key = &OVS_CB(skb)->egress_tun_info->tunnel;
|
||||
/* Route lookup */
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
fl.daddr = tun_key->ipv4_dst;
|
||||
fl.saddr = tun_key->ipv4_src;
|
||||
fl.flowi4_tos = RT_TOS(tun_key->ipv4_tos);
|
||||
fl.flowi4_mark = skb->mark;
|
||||
fl.flowi4_proto = IPPROTO_UDP;
|
||||
|
||||
rt = ip_route_output_key(net, &fl);
|
||||
rt = ovs_tunnel_route_lookup(net, tun_key, skb->mark, &fl, IPPROTO_UDP);
|
||||
if (IS_ERR(rt)) {
|
||||
err = PTR_ERR(rt);
|
||||
goto error;
|
||||
|
Reference in New Issue
Block a user