From patchwork Mon Mar 4 16:07:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zang MingJie X-Patchwork-Id: 224750 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 A7DF52C0323 for ; Tue, 5 Mar 2013 03:08:06 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932068Ab3CDQHz (ORCPT ); Mon, 4 Mar 2013 11:07:55 -0500 Received: from mail-pb0-f51.google.com ([209.85.160.51]:35095 "EHLO mail-pb0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754493Ab3CDQHy (ORCPT ); Mon, 4 Mar 2013 11:07:54 -0500 Received: by mail-pb0-f51.google.com with SMTP id un15so3150884pbc.24 for ; Mon, 04 Mar 2013 08:07:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=YyRA057hhtSaFMtgUjSueKhRdPJDhGOqr3DdGG5rtNA=; b=C5h42sn7UxqZ0G8q7zI41THdhNhZjC7M1MJA8DOFzQZk2s/mklY8moivHfakI6Zo6D tVNjuBE7m+5+uTak5i6H1YHJ8U9DcGRBXlPrL4yo9upXfBOt5YRmkOPOqtlFoHqxcwbq jIyKK01EFteqGARrCVu331Ukc9SCU4PHeCMq+p6V3C/M1u+P1DpANB0GgsfhK57dD4vs r0zHOI6u3UdEAH0htA9c+wHaUCS5CJt0mA4EvV4nc3GMWekgT6b02H/JhW5tNdTE3UNG HzzzsILYG2Toi1qBSOirX9KMs1TWcX2gliUYSkkA0+C9YKzfiXgLoXZcEkG6mBCLkNur fU/Q== X-Received: by 10.68.196.35 with SMTP id ij3mr28720017pbc.56.1362413274120; Mon, 04 Mar 2013 08:07:54 -0800 (PST) Received: from localhost (li414-6.members.linode.com. [106.187.94.6]) by mx.google.com with ESMTPS id gf6sm22739031pbc.24.2013.03.04.08.07.50 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 04 Mar 2013 08:07:52 -0800 (PST) Received: from kghost by localhost with local (Exim 4.80) (envelope-from ) id 1UCXvY-0002kP-1D; Tue, 05 Mar 2013 00:07:48 +0800 From: Zang MingJie To: netdev@vger.kernel.org, "David S. Miller" Cc: Zang MingJie Subject: [PATCH 1/1] reset nf before xmit vxlan encapsulated packet Date: Tue, 5 Mar 2013 00:07:34 +0800 Message-Id: <1362413254-10520-1-git-send-email-zealot0630@gmail.com> X-Mailer: git-send-email 1.7.10.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We should reset nf settings bond to the skb as ipip/ipgre do. If not, the conntrack/nat info bond to the origin packet may continually redirect the packet to vxlan interface causing a routing loop. this is the scenario: VETP VXLAN Gateway /----\ /---------------\ | | | | | vx+--+vx --NAT-> eth0+--> Internet | | | | \----/ \---------------/ when there are any packet coming from internet to the vetp, there will be lots of garbage packets coming out the gateway's vxlan interface, but none actually sent to the physical interface, because they are redirected back to the vxlan interface in the postrouting chain of NAT rule, and dmesg complains: Mar 1 21:52:53 debian kernel: [ 8802.997699] Dead loop on virtual device vxlan0, fix it urgently! Mar 1 21:52:54 debian kernel: [ 8804.004907] Dead loop on virtual device vxlan0, fix it urgently! Mar 1 21:52:55 debian kernel: [ 8805.012189] Dead loop on virtual device vxlan0, fix it urgently! Mar 1 21:52:56 debian kernel: [ 8806.020593] Dead loop on virtual device vxlan0, fix it urgently! the patch should fix the problem Signed-off-by: Zang MingJie --- drivers/net/vxlan.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index f10e58a..c3e3d29 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -961,6 +961,8 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev) iph->ttl = ttl ? : ip4_dst_hoplimit(&rt->dst); tunnel_ip_select_ident(skb, old_iph, &rt->dst); + nf_reset(skb); + vxlan_set_owner(dev, skb); /* See iptunnel_xmit() */