diff options
author | stephen hemminger <shemminger@vyatta.com> | 2012-10-09 16:35:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-10-10 22:41:21 -0400 |
commit | ca78f18129999320466107887317b5d1c042accd (patch) | |
tree | 7834a3ceb007dd1efe7424bf9a883bdca1c074d7 /drivers/net | |
parent | 321fb991399bd7b156f8b15a8acfa0c8622e3c68 (diff) |
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: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/vxlan.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 882a041d7594..0b53a9cb6f84 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -680,9 +680,13 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev) | |||
680 | 680 | ||
681 | hash = skb_get_rxhash(skb); | 681 | hash = skb_get_rxhash(skb); |
682 | 682 | ||
683 | rt = ip_route_output_gre(dev_net(dev), &fl4, dst, | 683 | memset(&fl4, 0, sizeof(fl4)); |
684 | vxlan->saddr, vxlan->vni, | 684 | fl4.flowi4_oif = vxlan->link; |
685 | RT_TOS(tos), vxlan->link); | 685 | fl4.flowi4_tos = RT_TOS(tos); |
686 | fl4.daddr = dst; | ||
687 | fl4.saddr = vxlan->saddr; | ||
688 | |||
689 | rt = ip_route_output_key(dev_net(dev), &fl4); | ||
686 | if (IS_ERR(rt)) { | 690 | if (IS_ERR(rt)) { |
687 | netdev_dbg(dev, "no route to %pI4\n", &dst); | 691 | netdev_dbg(dev, "no route to %pI4\n", &dst); |
688 | dev->stats.tx_carrier_errors++; | 692 | dev->stats.tx_carrier_errors++; |
@@ -724,7 +728,7 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev) | |||
724 | iph->frag_off = df; | 728 | iph->frag_off = df; |
725 | iph->protocol = IPPROTO_UDP; | 729 | iph->protocol = IPPROTO_UDP; |
726 | iph->tos = vxlan_ecn_encap(tos, old_iph, skb); | 730 | iph->tos = vxlan_ecn_encap(tos, old_iph, skb); |
727 | iph->daddr = fl4.daddr; | 731 | iph->daddr = dst; |
728 | iph->saddr = fl4.saddr; | 732 | iph->saddr = fl4.saddr; |
729 | iph->ttl = ttl ? : ip4_dst_hoplimit(&rt->dst); | 733 | iph->ttl = ttl ? : ip4_dst_hoplimit(&rt->dst); |
730 | 734 | ||