Commit ca78f181 authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller

vxlan: use ip_route_output

Select source address for VXLAN packet based on route destination
and don't lie to route code. VXLAN is not GRE.
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 321fb991
...@@ -680,9 +680,13 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -680,9 +680,13 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
hash = skb_get_rxhash(skb); hash = skb_get_rxhash(skb);
rt = ip_route_output_gre(dev_net(dev), &fl4, dst, memset(&fl4, 0, sizeof(fl4));
vxlan->saddr, vxlan->vni, fl4.flowi4_oif = vxlan->link;
RT_TOS(tos), vxlan->link); fl4.flowi4_tos = RT_TOS(tos);
fl4.daddr = dst;
fl4.saddr = vxlan->saddr;
rt = ip_route_output_key(dev_net(dev), &fl4);
if (IS_ERR(rt)) { if (IS_ERR(rt)) {
netdev_dbg(dev, "no route to %pI4\n", &dst); netdev_dbg(dev, "no route to %pI4\n", &dst);
dev->stats.tx_carrier_errors++; dev->stats.tx_carrier_errors++;
...@@ -724,7 +728,7 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -724,7 +728,7 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
iph->frag_off = df; iph->frag_off = df;
iph->protocol = IPPROTO_UDP; iph->protocol = IPPROTO_UDP;
iph->tos = vxlan_ecn_encap(tos, old_iph, skb); iph->tos = vxlan_ecn_encap(tos, old_iph, skb);
iph->daddr = fl4.daddr; iph->daddr = dst;
iph->saddr = fl4.saddr; iph->saddr = fl4.saddr;
iph->ttl = ttl ? : ip4_dst_hoplimit(&rt->dst); iph->ttl = ttl ? : ip4_dst_hoplimit(&rt->dst);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment