All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>,
	netfilter-devel@vger.kernel.org, Netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH nf 2/2] netfilter: use actual socket sk rather than skb sk when routing harder
Date: Thu, 29 Oct 2020 13:01:53 +0100	[thread overview]
Message-ID: <CAHmME9ohyPOwQryPMzk7oNGaBeKSJoFmSQkemRoUYKhjqgQ7ag@mail.gmail.com> (raw)
In-Reply-To: <20201029025606.3523771-3-Jason@zx2c4.com>

As a historical note, this code goes all the way back to Rusty in
2.3.14, where it looked like this:

#ifdef CONFIG_NETFILTER
/* To preserve the cute illusion that a locally-generated packet can
  be mangled before routing, we actually reroute if a hook altered
  the packet. -RR */
static int route_me_harder(struct sk_buff *skb)
{
       struct iphdr *iph = skb->nh.iph;
       struct rtable *rt;

       if (ip_route_output(&rt, iph->daddr, iph->saddr,
                           RT_TOS(iph->tos) | RTO_CONN,
                           skb->sk ? skb->sk->bound_dev_if : 0)) {
               printk("route_me_harder: No more route.\n");
               return -EINVAL;
       }

       /* Drop old route. */
       dst_release(skb->dst);

       skb->dst = &rt->u.dst;
       return 0;
}
#endif

And until now, it was never updated to take the separate sock *sk parameter.

  parent reply	other threads:[~2020-10-29 12:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-29  2:56 [PATCH nf 0/2] route_me_harder routing loop with tunnels Jason A. Donenfeld
2020-10-29  2:56 ` [PATCH nf 1/2] wireguard: selftests: check that route_me_harder packets use the right sk Jason A. Donenfeld
2020-10-29  2:56 ` [PATCH nf 2/2] netfilter: use actual socket sk rather than skb sk when routing harder Jason A. Donenfeld
2020-10-29  9:28   ` Florian Westphal
2020-10-29 12:01   ` Jason A. Donenfeld [this message]
2020-10-29 12:02     ` Jason A. Donenfeld
2020-10-30 19:23 ` [PATCH nf 0/2] route_me_harder routing loop with tunnels Pablo Neira Ayuso
2020-10-31  0:05   ` Jason A. Donenfeld
2020-10-31  1:00     ` Pablo Neira Ayuso
2020-10-31  1:08       ` Pablo Neira Ayuso

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=CAHmME9ohyPOwQryPMzk7oNGaBeKSJoFmSQkemRoUYKhjqgQ7ag@mail.gmail.com \
    --to=jason@zx2c4.com \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.