From patchwork Tue Jun 30 01:06:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 192036 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp3369442ilg; Mon, 29 Jun 2020 18:06:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUV+hiqudwPa2AXqB2wky0cbddO4V6+Vau1CitzC9s8DDXvI5IU0YnBCPlnb9pLRMP0MvO X-Received: by 2002:a17:906:e299:: with SMTP id gg25mr15855222ejb.160.1593479205005; Mon, 29 Jun 2020 18:06:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593479205; cv=none; d=google.com; s=arc-20160816; b=XGjzLvI4eZLd+DIRp5xGWC+Iq6hxYuGHInCZvMNFIYO3bgcklcAZ0ZPcEZK7ECAsKO rzCdPwGnRSe/cvqyCYc5/FgAiWWMyJUQ77/cAPKQGFRxJ0Yr5Oj2Ume1RC7tyYVFEXQw P2Fharph1nVZUz0GQ8ETy7yttD4ETmT6vqVUGLH+0MR5U9A1ydQvbVTfB3rMCkCfgc6u m6SjOsqv9CSayt2M2ZovJ0lKwZ7mi/RtvsMLXveooPs3cfLmHW3VeuIEvBVj64cWG+jx 5K3UXNGZ64Y6heNhUyoQ5U/L1EGNKUxp+H24VzBbgNCSTlUmqTbx3H+Adporg6uz/Mp0 N7uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vWBrPP9l+QKDIyH9arTmX+HFWS9FqfcSiC36xjoMF34=; b=O1me50yZkMjTx/4a5jYTP3vIASDqShVhambMgmxo2fdUdmWXSeJGtMcFfqjcxqilXC fO23cJfF5VyybuypSwzjFRsIcbruFUn2GYnvlZI6wxdeQJcITP9oP2d026jhLJScHu9p RtEKLvP6cnujQ+NKWl4IB0VkMbH/5hGPu5OSuiaUaT/qb19n37pZVfn2K7wLzmxyjKHu H8N/kHTW7uwbEI0jzsrPvjCYX77VDvY6kRqmyNjzszusbAfissWOIenGzWE6QXyGlBv2 vv/fPx9TbshLF/8zpDh1c54Sk/+Vvd7rPE3QEwDKPOgDdXEnxq9kJYnUw1vTIK0b6+h4 3hqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=mail header.b=Q52ZVdS2; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d17si849269edu.223.2020.06.29.18.06.44; Mon, 29 Jun 2020 18:06:45 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=mail header.b=Q52ZVdS2; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727921AbgF3BGn (ORCPT + 9 others); Mon, 29 Jun 2020 21:06:43 -0400 Received: from mail.zx2c4.com ([192.95.5.64]:60171 "EHLO mail.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726712AbgF3BGm (ORCPT ); Mon, 29 Jun 2020 21:06:42 -0400 Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 0323f243; Tue, 30 Jun 2020 00:46:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=mail; bh=xKPsjje8Yh5NeiPGcodksFIMq EM=; b=Q52ZVdS2df6sLWVXiAnYvG0t1Kpkwc6tQ98PRlNuUyjRqZOMI0dyC1jzW wf6uabx7/Nv2H6FwWSkmhz8rlw/AYib89Hq/mKLOmemyK0+KsaF3ByAz4VJOuuZ6 UHU33r04I13qbC3ge5v3SSJ3AABEYD7S3TxKLkVBh3IOtHSPsrlDas1ZMJmw/+Yq zr7Dno9+plGtZmtD8A2FlPxjl/lqAlx0e2YPoosqz0vOB1OD8OVcfvNnYNI/pX1W BA7ralk6oQ9OLkRtLf5acoqD2h7kWO3UVRPvr+1ByF/VWIcXy+HHqLBzKm9zHsAL UXeLoaGZ32LDgBBjEO/RpsRTWQSCQ== Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 9353f973 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 30 Jun 2020 00:46:56 +0000 (UTC) From: "Jason A. Donenfeld" To: netdev@vger.kernel.org, davem@davemloft.net Cc: "Jason A. Donenfeld" , Hans Wippel Subject: [PATCH net v2 2/8] net: ipip: implement header_ops->parse_protocol for AF_PACKET Date: Mon, 29 Jun 2020 19:06:19 -0600 Message-Id: <20200630010625.469202-3-Jason@zx2c4.com> In-Reply-To: <20200630010625.469202-1-Jason@zx2c4.com> References: <20200630010625.469202-1-Jason@zx2c4.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Ipip uses skb->protocol to determine packet type, and bails out if it's not set. For AF_PACKET injection, we need to support its call chain of: packet_sendmsg -> packet_snd -> packet_parse_headers -> dev_parse_header_protocol -> parse_protocol Without a valid parse_protocol, this returns zero, and ipip rejects the skb. So, this wires up the ip_tunnel handler for layer 3 packets for that case. Signed-off-by: Jason A. Donenfeld --- net/ipv4/ipip.c | 1 + net/ipv6/ip6_tunnel.c | 1 + 2 files changed, 2 insertions(+) -- 2.27.0 Acked-by: Willem de Bruijn diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index 40fea52c8277..75d35e76bec2 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c @@ -361,6 +361,7 @@ static const struct net_device_ops ipip_netdev_ops = { static void ipip_tunnel_setup(struct net_device *dev) { dev->netdev_ops = &ipip_netdev_ops; + dev->header_ops = &ip_tunnel_header_ops; dev->type = ARPHRD_TUNNEL; dev->flags = IFF_NOARP; diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 821d96c720b9..a18c378ca5f4 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c @@ -1846,6 +1846,7 @@ static const struct net_device_ops ip6_tnl_netdev_ops = { static void ip6_tnl_dev_setup(struct net_device *dev) { dev->netdev_ops = &ip6_tnl_netdev_ops; + dev->header_ops = &ip_tunnel_header_ops; dev->needs_free_netdev = true; dev->priv_destructor = ip6_dev_free;