From patchwork Tue Jun 30 01:06:25 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: 192041 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp3369600ilg; Mon, 29 Jun 2020 18:06:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxh/WjeLNQluZs/0W//A9SUA/DH8dgES8hJBOXdMAEVZUi90XL9vz4wDIhMgfM7vo5ODbB8 X-Received: by 2002:a17:907:7290:: with SMTP id dt16mr15830893ejc.63.1593479216790; Mon, 29 Jun 2020 18:06:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593479216; cv=none; d=google.com; s=arc-20160816; b=w7mQ7RqAsEoGrRNYhDRJ4+UooxKIzddTZTafLJgMOY8d4OBrgaW3Ll6TWAuUnO6HG9 lLr3ipRFGtuctuBOm68uKbwjnKgP+QTKCbC/J/BOEh3z7o1wona2L0POQKy+WvlH/UxS romZKKeQNy2IkSs/rKeE8ABP3XjnfPHa2lWVofYiqlpvAbxFmGmCorGhMpb7hBaD+0AD Fx3gbKs6E0kF+TF1WAkI0GvYqVTR6Sz6wsgS/Es2vJB+PmyFB8WcnW08uHcDEg+PPsOp 0jpuQlIk4PQc7sGnyQ6Fd5W5JABRs4Fp1X+dkJhE/jmH6f8V7WiG44t1NBNq9PA7u1Ws 17SA== 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=CYVeM0VGgK2O51gjZogDnpe9MrghVt+D6sBtn2W8no0=; b=ZCB2nBlBfW2Hipbeeujt8QkWPp+l+Xnvhc+VkvnfmcQBBJXoom3V3s5KrsvG6hB+j/ cau+SkLtOKaxbXUggtwnZD10bhCZD5f+HrvbHM+qFhR574yI0i4l0TbYZ0iupZxT1BJi VvAOJS0viXpW3vsaKBGjw82KeI4P+jSVKz5f9u+3cCxMDvAPQjw8npS1pXzCJGkgLnmM KMYgcMQMOmmXfiLMQq+s6z5OUJ17meHaXLAHb/bYr6K1tDk2sMuGZBO6gkbHwOVfS3/O WfVn6tfpHvwM9DpAPXGH7t7/laA27DLclsN3/8EjdddkQQHr8CFvLAg59GjVyZsBPG1g X5Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=mail header.b=E1BIat3K; 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.56; Mon, 29 Jun 2020 18:06:56 -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=E1BIat3K; 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 S1728156AbgF3BGy (ORCPT + 9 others); Mon, 29 Jun 2020 21:06:54 -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 S1728126AbgF3BGw (ORCPT ); Mon, 29 Jun 2020 21:06:52 -0400 Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 0907e8c1; Tue, 30 Jun 2020 00:47:05 +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=Xmy6YQJ23F4/CDIjrR9nvLnBL T8=; b=E1BIat3KtHtdKTksZkvYg+PDN33dnMfbh0VKPugk3LYYV3tIA0K1PqwQQ dvajTKXueWFSyDfmJQfsxJO5md7rI/zKUMxMlgncZow4jsTl2m97zOiVrz4dD9f2 YSnKsFTyUij4Uo603KgmbVkZg9Pso2n0+P1vhpTdsqjLQ8JCmSi8L2vN2d9pmgvK uh5XMqV3UHrtJMt81AsArrB1WxZ5ueVxLZCte/4pCLVjfbY8AFOW67e8rf3t0Jkp E3MtLMUfNg42Lo6dC6RrP2h2HLQCuYjLv160KUp0l9opYTJ6fFg8SigarvPBOd3R 7bltHQBon1n8Dz2MgdbpCzW0NgvcQ== Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id d98247d1 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 30 Jun 2020 00:47:04 +0000 (UTC) From: "Jason A. Donenfeld" To: netdev@vger.kernel.org, davem@davemloft.net Cc: "Jason A. Donenfeld" , Hans Wippel , Willem de Bruijn Subject: [PATCH net v2 8/8] net: xfrmi: implement header_ops->parse_protocol for AF_PACKET Date: Mon, 29 Jun 2020 19:06:25 -0600 Message-Id: <20200630010625.469202-9-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 The xfrm interface 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 xfrmi rejects the skb. So, this wires up the ip_tunnel handler for layer 3 packets for that case. Reported-by: Willem de Bruijn Signed-off-by: Jason A. Donenfeld --- net/xfrm/xfrm_interface.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.27.0 diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c index c407ecbc5d46..b615729812e5 100644 --- a/net/xfrm/xfrm_interface.c +++ b/net/xfrm/xfrm_interface.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -581,6 +582,7 @@ static const struct net_device_ops xfrmi_netdev_ops = { static void xfrmi_dev_setup(struct net_device *dev) { dev->netdev_ops = &xfrmi_netdev_ops; + dev->header_ops = &ip_tunnel_header_ops; dev->type = ARPHRD_NONE; dev->mtu = ETH_DATA_LEN; dev->min_mtu = ETH_MIN_MTU;