From patchwork Tue Jun 30 01:06:23 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: 192039 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp3369534ilg; Mon, 29 Jun 2020 18:06:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTsCUFhMKMZydPAUbZaemzhmoP0A4bNcDkPcqBRgpcc1/qJizaThHlN2Dg40Jfp54ccNYt X-Received: by 2002:a17:906:b45:: with SMTP id v5mr15823787ejg.464.1593479211974; Mon, 29 Jun 2020 18:06:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593479211; cv=none; d=google.com; s=arc-20160816; b=iiEksRtqWPMLFb2U4ZCPwvLYNCgXIKJM8duCdGF/6aJVyreFX0+6/7LIZHavpKrFA3 6nEJ+g108Qlkp34WPuvi9Up4W0Sci/YwP+ItRiM+75R1Yv1BJjB9oy54XWHtFMuVH8aU nCglEOKLDmZXTjKFcB3F8gkg8OSy81xQ9qayxOjNdnnS4HwQd1YLotH6zNy3ugv3IL/P ZhOtn7lP/qKruyx62pZlU1M3LkJmEsfFAGkNsJ3o64CvN8uFFuy5Vq2MTAP2WcbOAOiE NuLLY4h3cnhswW43IA8sxeFe5xT24jzATDZHKDWWyne4jHqn2VN97cEzqldbMDn09HiM va+w== 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=I8jhAw1C48W3klydTEg2q9rxPa/43f6yYo0iZ4Sjjkk=; b=XycXybo1LKgDawYdo0rBY4OX1zaFiOJ7bbB+Lr8Ms1KK+4DzoBXkdOuwYlBhxc1FaP gvLTufTdRvtbjOjrVFGdsj0N4yn4k53NBxOYOnD6JgBAJ72oCQv0HblkERUUcJxkzwP7 9xHd6xpx4MiHZPMFYhrlbju39pCUXNAJRdUdrKj9Iov8VA32CdEs0ungFOpYtC2T0PXM XesKcNL/P+jrAKFSZsuyNe+q7tFLuNXvJU8+aajegRt3aaNPAdmWszE1H2vxRIIjSAEb Cl1ff1CpvjgF8jgB7fmTblaWGjswq2+2bZgB4GSOPJ/i9X/J69b2u1meUs+y4BwkqnNm HYbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=mail header.b=zKuKVmZ4; 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.51; Mon, 29 Jun 2020 18:06:51 -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=zKuKVmZ4; 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 S1728116AbgF3BGu (ORCPT + 9 others); Mon, 29 Jun 2020 21:06:50 -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 S1727780AbgF3BGr (ORCPT ); Mon, 29 Jun 2020 21:06:47 -0400 Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 5e605d44; Tue, 30 Jun 2020 00:47:02 +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=Fi3F3RTKj50aJq3o7a+r71FKJ OQ=; b=zKuKVmZ4EIvXtJvV2PO6NY1kmkaa8KuqG1oF3iKDzaWCminGCzIHSpvQf ie9rjShsJ04k5TozrFyTcJZ5D7EgMndgkAQxNXh1qMplsfNw8fSIPOQJCyN+lsqY 9ZUxY6vBGgbeMrytfU1My6/ogaqk2LtrdGvdJsqSsCCVfqPCCrMUX2AkNOhtpoW6 RqP9A7npwU1FlilC6rs2zu9OtP1/xUMPwKSDvZOBJw5icELON8vvxhGasf9jYftC sMIy5Zm4ViG4eg/mx0ivrYQ8V4lrKX7r2NIBXeEKHnBAUzj4gQ6yfHHfsaOSu6tg OvAwc8JcOJDZxoBNC4DZCdZPjNHsQ== Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id b6d6483f (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 30 Jun 2020 00:47:01 +0000 (UTC) From: "Jason A. Donenfeld" To: netdev@vger.kernel.org, davem@davemloft.net Cc: "Jason A. Donenfeld" , Hans Wippel Subject: [PATCH net v2 6/8] net: vti: implement header_ops->parse_protocol for AF_PACKET Date: Mon, 29 Jun 2020 19:06:23 -0600 Message-Id: <20200630010625.469202-7-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 Vti 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 vti 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/ip_vti.c | 1 + net/ipv6/ip6_vti.c | 1 + 2 files changed, 2 insertions(+) -- 2.27.0 diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c index 1d9c8cff5ac3..460ca1099e8a 100644 --- a/net/ipv4/ip_vti.c +++ b/net/ipv4/ip_vti.c @@ -441,6 +441,7 @@ static const struct net_device_ops vti_netdev_ops = { static void vti_tunnel_setup(struct net_device *dev) { dev->netdev_ops = &vti_netdev_ops; + dev->header_ops = &ip_tunnel_header_ops; dev->type = ARPHRD_TUNNEL; ip_tunnel_setup(dev, vti_net_id); } diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c index 1147f647b9a0..0d964160a9dd 100644 --- a/net/ipv6/ip6_vti.c +++ b/net/ipv6/ip6_vti.c @@ -905,6 +905,7 @@ static const struct net_device_ops vti6_netdev_ops = { static void vti6_dev_setup(struct net_device *dev) { dev->netdev_ops = &vti6_netdev_ops; + dev->header_ops = &ip_tunnel_header_ops; dev->needs_free_netdev = true; dev->priv_destructor = vti6_dev_free;