netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Changliang Wu <changliang.wu@smartx.com>
Cc: davem@davemloft.net, kuba@kernel.org, yoshfuji@linux-ipv6.org,
	dsahern@kernel.org, edumazet@google.com, idosch@OSS.NVIDIA.COM,
	amcohen@nvidia.com, fw@strlen.de, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ipv4: add sysctl knob to control the discarding of skb from local in ip_forward
Date: Tue, 9 Nov 2021 12:46:12 +0100	[thread overview]
Message-ID: <20211109114612.GC16363@breakpoint.cc> (raw)
In-Reply-To: <1636457577-43305-1-git-send-email-changliang.wu@smartx.com>

Changliang Wu <changliang.wu@smartx.com> wrote:
> This change is meant to add a control for forwarding skb from local.
> By default, ip forward will not receive the pakcet to/from the local.
> But in some special cases, for example:
> -
> |  ovs-bridge  gw-port |  <---->   kube-proxy(iptables) |
> -
> Ovs sends the packet to the gateway, which requires iptables for nat,
> such as kube-proxy (iptables), and then sends it back to the gateway
> through routing for further processing in ovs.

This a very terse description.  How does packet end up in forward
after skb->sk assignment?

> diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
> index 00ec819..06b7e00 100644
> --- a/net/ipv4/ip_forward.c
> +++ b/net/ipv4/ip_forward.c
> @@ -95,9 +95,6 @@ int ip_forward(struct sk_buff *skb)
>  	if (skb->pkt_type != PACKET_HOST)
>  		goto drop;
>  
> -	if (unlikely(skb->sk))
> -		goto drop;
> -

Please have a look at
2ab957492d13bb819400ac29ae55911d50a82a13

you need to explain why this is now ok.

Without explanation i have to assume stack will now crash again
when net->ipv4.sysctl_ip_fwd_accept_local=1 and TW socket is assigned.

      parent reply	other threads:[~2021-11-09 11:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09 11:32 [PATCH] ipv4: add sysctl knob to control the discarding of skb from local in ip_forward Changliang Wu
2021-11-09 11:44 ` Daniel Borkmann
2021-11-09 11:46 ` Florian Westphal [this message]

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=20211109114612.GC16363@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=amcohen@nvidia.com \
    --cc=changliang.wu@smartx.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=idosch@OSS.NVIDIA.COM \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.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 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).