netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: netdev@vger.kernel.org, davem@davemloft.net
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>,
	Hans Wippel <ndev@hwipl.net>,
	Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Subject: [PATCH net v2 7/8] net: sit: implement header_ops->parse_protocol for AF_PACKET
Date: Mon, 29 Jun 2020 19:06:24 -0600	[thread overview]
Message-ID: <20200630010625.469202-8-Jason@zx2c4.com> (raw)
In-Reply-To: <20200630010625.469202-1-Jason@zx2c4.com>

Sit 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 sit rejects the
skb. So, this wires up the ip_tunnel handler for layer 3 packets for
that case.

Reported-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 net/ipv6/sit.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 1fbb4dfbb191..5e2c34c0ac97 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1421,6 +1421,7 @@ static void ipip6_tunnel_setup(struct net_device *dev)
 	int t_hlen = tunnel->hlen + sizeof(struct iphdr);
 
 	dev->netdev_ops		= &ipip6_netdev_ops;
+	dev->header_ops		= &ip_tunnel_header_ops;
 	dev->needs_free_netdev	= true;
 	dev->priv_destructor	= ipip6_dev_free;
 
-- 
2.27.0


  parent reply	other threads:[~2020-06-30  1:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-30  1:06 [PATCH net v2 0/8] support AF_PACKET for layer 3 devices Jason A. Donenfeld
2020-06-30  1:06 ` [PATCH net v2 1/8] net: ip_tunnel: add header_ops " Jason A. Donenfeld
2020-06-30 15:40   ` Willem de Bruijn
2020-06-30  1:06 ` [PATCH net v2 2/8] net: ipip: implement header_ops->parse_protocol for AF_PACKET Jason A. Donenfeld
2020-06-30 16:02   ` Willem de Bruijn
2020-06-30  1:06 ` [PATCH net v2 3/8] wireguard: " Jason A. Donenfeld
2020-06-30  1:06 ` [PATCH net v2 4/8] wireguard: queueing: make use of ip_tunnel_parse_protocol Jason A. Donenfeld
2020-06-30  1:06 ` [PATCH net v2 5/8] tun: implement header_ops->parse_protocol for AF_PACKET Jason A. Donenfeld
2020-06-30  1:06 ` [PATCH net v2 6/8] net: vti: " Jason A. Donenfeld
2020-06-30  1:06 ` Jason A. Donenfeld [this message]
2020-06-30  1:06 ` [PATCH net v2 8/8] net: xfrmi: " Jason A. Donenfeld
2020-06-30 19:30 ` [PATCH net v2 0/8] support AF_PACKET for layer 3 devices David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200630010625.469202-8-Jason@zx2c4.com \
    --to=jason@zx2c4.com \
    --cc=davem@davemloft.net \
    --cc=ndev@hwipl.net \
    --cc=netdev@vger.kernel.org \
    --cc=willemdebruijn.kernel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).