From patchwork Tue Oct 9 17:56:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: stephen hemminger X-Patchwork-Id: 190396 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id EEEC52C00C6 for ; Wed, 10 Oct 2012 05:01:51 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756571Ab2JISBu (ORCPT ); Tue, 9 Oct 2012 14:01:50 -0400 Received: from fiji.vyatta.com ([76.74.103.50]:51696 "EHLO fiji.vyatta.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756572Ab2JISB2 (ORCPT ); Tue, 9 Oct 2012 14:01:28 -0400 Received: by fiji.vyatta.com (Postfix, from userid 1051) id A03D81540FA; Tue, 9 Oct 2012 09:49:19 -0700 (PDT) Message-Id: <20121009175714.538033361@vyatta.com> User-Agent: quilt/0.60-1 Date: Tue, 09 Oct 2012 10:56:39 -0700 From: Stephen Hemminger To: David Miller Cc: netdev@vger.kernel.org Subject: [PATCH 2/6] vxlan: use ip_route_output References: <20121009175637.048993312@vyatta.com> Content-Disposition: inline; filename=vxlan-route-output.patch Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/net/vxlan.c 2012-10-09 10:48:56.546879617 -0700 +++ b/drivers/net/vxlan.c 2012-10-09 10:49:01.334832146 -0700 @@ -676,9 +676,11 @@ static netdev_tx_t vxlan_xmit(struct sk_ hash = skb_get_rxhash(skb); - rt = ip_route_output_gre(dev_net(dev), &fl4, dst, - vxlan->saddr, vxlan->vni, - RT_TOS(tos), vxlan->link); + 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++; @@ -720,7 +722,7 @@ static netdev_tx_t vxlan_xmit(struct sk_ 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);