Skip to content

Commit

Permalink
vxlan: use ip_route_output
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
stephen hemminger authored and David S. Miller committed Oct 11, 2012
1 parent 321fb99 commit ca78f18
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions drivers/net/vxlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -680,9 +680,13 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)

hash = skb_get_rxhash(skb);

rt = ip_route_output_gre(dev_net(dev), &fl4, dst,
vxlan->saddr, vxlan->vni,
RT_TOS(tos), vxlan->link);
memset(&fl4, 0, sizeof(fl4));
fl4.flowi4_oif = 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)) {
netdev_dbg(dev, "no route to %pI4\n", &dst);
dev->stats.tx_carrier_errors++;
Expand Down Expand Up @@ -724,7 +728,7 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
iph->frag_off = df;
iph->protocol = IPPROTO_UDP;
iph->tos = vxlan_ecn_encap(tos, old_iph, skb);
iph->daddr = fl4.daddr;
iph->daddr = dst;
iph->saddr = fl4.saddr;
iph->ttl = ttl ? : ip4_dst_hoplimit(&rt->dst);

Expand Down

0 comments on commit ca78f18

Please sign in to comment.