From patchwork Tue Sep 10 02:14:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Maciej_=C5=BBenczykowski?= X-Patchwork-Id: 273746 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 D6E1B2C00FA for ; Tue, 10 Sep 2013 12:15:03 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751955Ab3IJCO5 (ORCPT ); Mon, 9 Sep 2013 22:14:57 -0400 Received: from mail-ve0-f176.google.com ([209.85.128.176]:41967 "EHLO mail-ve0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751753Ab3IJCO4 (ORCPT ); Mon, 9 Sep 2013 22:14:56 -0400 Received: by mail-ve0-f176.google.com with SMTP id jx11so4011422veb.21 for ; Mon, 09 Sep 2013 19:14:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=dr7tcYNx1NDS7iauIbyBYNpQpVOL9wZBEylFxPuk+L4=; b=ny4J7b1mHLHfD8q0D7AE+JKUqofXPGaxCiSKNC8uMe9o3jkAMyOiAYUAg9m7FRd36C 1QJa++/wyGsl+gsWj0oVjMVm14tAUVA/W4e7Vz0TdDIPQDI+1BQ8Qj9E5TMaryI5Q/2Z /pqurA0cwTqRbt/gQglb+979dDZLpUJJAUZArmpCjxCCBmIph58gCcKnJJqyKXZg2+i0 5zwuDpHNFUEiZBN8wZfWfnXwE4wFXJ6VjyfUSiL/Z4cHnWS5sK9dGI6EgFmvOMofXLtt /Gj0IzyYlrxyIkK2dABC/qpS2c6LLagMT4DNOKwXvDzqmyk2efUpVdd4ZGYS3NJhfvpR Jjpw== MIME-Version: 1.0 X-Received: by 10.58.211.227 with SMTP id nf3mr4766688vec.20.1378779296108; Mon, 09 Sep 2013 19:14:56 -0700 (PDT) Received: by 10.221.22.198 with HTTP; Mon, 9 Sep 2013 19:14:56 -0700 (PDT) Date: Mon, 9 Sep 2013 19:14:56 -0700 Message-ID: Subject: wrt. core/dev: set pkt_type after eth_type_trans() in dev_forward_skb() From: =?UTF-8?Q?Maciej_=C5=BBenczykowski?= To: Linux NetDev , Eric Dumazet , David Miller , Isaku Yamahata , decot@google.com Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Merged in v3.11-rc1: commit 06a23fe31ca3992863721f21bdb0307af93da807 Author: Isaku Yamahata Date: Tue Jul 2 20:30:10 2013 +0900 core/dev: set pkt_type after eth_type_trans() in dev_forward_skb() The dev_forward_skb() assignment of pkt_type should be done after the call to eth_type_trans(). ip-encapsulated packets can be handled by localhost. But skb->pkt_type can be PACKET_OTHERHOST when packet comes via veth into ip tunnel device. In that case, the packet is dropped by ip_rcv(). Although this example uses gretap. l2tp-eth also has same issue. For l2tp-eth case, add dummy device for ip address and ip l2tp command. ... EXPORT_SYMBOL_GPL(dev_forward_skb); Appears to me to be bogus. AFAICT, this results in (at least) veth devices effectively ignoring destination mac addresses, since eth_type_trans is what sets PACKET_BROADCAST/MULTICAST/HOST/OTHERHOST, and this makes everything functionally equivalanet to having a dst mac address equal to the devices mac address. (might also affect macvlan and L2TP) - Maciej --- 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/net/core/dev.c +++ b/net/core/dev.c @@ -1659,6 +1659,12 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb) } skb_scrub_packet(skb); skb->protocol = eth_type_trans(skb, dev); + + /* eth_type_trans() can set pkt_type. + * clear pkt_type _after_ calling eth_type_trans() + */ + skb->pkt_type = PACKET_HOST; + return netif_rx(skb); }