Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: sun miller <sunminlei@gmail.com>
Cc: Florian Westphal <fw@strlen.de>, netfilter@vger.kernel.org
Subject: Re: nf_nat_icmp_reply_translation dropped icmp redirect packet
Date: Thu, 19 Oct 2023 10:47:40 +0200	[thread overview]
Message-ID: <20231019084740.GB12544@breakpoint.cc> (raw)
In-Reply-To: <CAPDoCBYC61XDROuR4q7zX=MggF2nfG76_UxkrX5wVDXMxvoaXA@mail.gmail.com>

sun miller <sunminlei@gmail.com> wrote:
> I'm sorry, I forgot to cc netfilter in my previous reply, so I'm
> sending it again. I apologize for my oversight. I hope I didn't
> disturb you.
> 
> > For some reason the comment that explains this got dropped when
> > code was moved around.  The original comment was:
> >
> > /* Redirects on non-null nats must be dropped, else they'll
> >    start talking to each other without our translation, and be
> >    confused... --RR */
> >
> > ... which is exactly what this does, it drops the redirect
> > if it can't verify that no nat is in place in either direction.
> 
> Thank you for your reply and explanation.
> 
> I searched globally for ip_rt_send_redirect and icmp_send(skb,
> ICMP_REDIRECT, ICMP_REDIR_HOST...), and it seems that the related code
> paths do not meet ct->status & IPS_NAT_DONE_MASK == IPS_NAT_DONE_MASK.
>
> Does this mean that icmp_redirect caused by the same subnet request
> packet will be DROPPED when the firewall is enabled? Does this break
> the correct functionality that the kernel should have originally? (Of
> course, this functionality seems to be unimportant from my limited
> work experience.)
> 
> Additionally, if it's convenient for you, would you provide an example
> scenario for the code comment that mentions "they'll start talking to
> each other without our translation, and be confused"?  I am unable to
> think of any related issues.

A -> B, A sends packet to R.  R has a DNAT rule to redirect to C
(or redirect to R).

If we let icmp redirect through, this won't work.

  reply	other threads:[~2023-10-19  8:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-17 17:09 nf_nat_icmp_reply_translation dropped icmp redirect packet sun miller
2023-10-17 21:31 ` Florian Westphal
2023-10-19  8:34   ` sun miller
2023-10-19  8:47     ` Florian Westphal [this message]
2023-10-20 14:02       ` sun 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=20231019084740.GB12544@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=netfilter@vger.kernel.org \
    --cc=sunminlei@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