* nat drop the icmp redirect packet @ 2011-11-28 1:12 Gao feng 2011-11-28 1:23 ` Gao feng 2011-11-30 18:53 ` Patrick McHardy 0 siblings, 2 replies; 9+ messages in thread From: Gao feng @ 2011-11-28 1:12 UTC (permalink / raw) To: netfilter-devel Hi In func nf_nat_icmp_reply_translation,the icmp packet will be droped when the nat is not finished. pc A(whose gateway is C) send a icmp request to pc B. When gw C receive this packet,it may return a icmp redirect packet to A. BUT now,the icmp request packet has not go to POSTROUTING,So the nat is not finished. Finally,the icmp redirect packet will be droped no matter the conn has nat or not. of course,the icmp redirect packet will be correct handled when nat is finished. Can somebody will give me some suggestion, or should I just add a sysctl to let the user decide drop or receive this icmp redirect packet when nat is not finished? ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: nat drop the icmp redirect packet 2011-11-28 1:12 nat drop the icmp redirect packet Gao feng @ 2011-11-28 1:23 ` Gao feng 2011-11-30 4:00 ` Gao feng 2011-11-30 18:53 ` Patrick McHardy 1 sibling, 1 reply; 9+ messages in thread From: Gao feng @ 2011-11-28 1:23 UTC (permalink / raw) To: netfilter-devel 于 2011年11月28日 09:12, Gao feng 写道: > Hi > > In func nf_nat_icmp_reply_translation,the icmp packet will be droped when the nat is not finished. > pc A(whose gateway is C) send a icmp request to pc B. > When gw C receive this packet,it may return a icmp redirect packet to A. > BUT now,the icmp request packet has not go to POSTROUTING,So the nat is not finished. > Finally,the icmp redirect packet will be droped no matter the conn has nat or not. > > of course,the icmp redirect packet will be correct handled when nat is finished. > > Can somebody will give me some suggestion, > or should I just add a sysctl to let the user decide drop or receive this icmp redirect packet when nat is not finished? > -- > To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > or maybe we can move the ip_rt_send_redirect from FORWARD to POSTROUTING? -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: nat drop the icmp redirect packet 2011-11-28 1:23 ` Gao feng @ 2011-11-30 4:00 ` Gao feng 0 siblings, 0 replies; 9+ messages in thread From: Gao feng @ 2011-11-30 4:00 UTC (permalink / raw) To: pablo, netfilter-devel Hi pablo what's your idea? > > or maybe we can move the ip_rt_send_redirect from FORWARD to POSTROUTING? > -- ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: nat drop the icmp redirect packet 2011-11-28 1:12 nat drop the icmp redirect packet Gao feng 2011-11-28 1:23 ` Gao feng @ 2011-11-30 18:53 ` Patrick McHardy 2011-12-01 0:59 ` Gao feng 1 sibling, 1 reply; 9+ messages in thread From: Patrick McHardy @ 2011-11-30 18:53 UTC (permalink / raw) To: Gao feng; +Cc: netfilter-devel On 11/28/2011 02:12 AM, Gao feng wrote: > Hi > > In func nf_nat_icmp_reply_translation,the icmp packet will be droped when the nat is not finished. > pc A(whose gateway is C) send a icmp request to pc B. > When gw C receive this packet,it may return a icmp redirect packet to A. > BUT now,the icmp request packet has not go to POSTROUTING,So the nat is not finished. > Finally,the icmp redirect packet will be droped no matter the conn has nat or not. > > of course,the icmp redirect packet will be correct handled when nat is finished. > > Can somebody will give me some suggestion, > or should I just add a sysctl to let the user decide drop or receive this icmp redirect packet when nat is not finished? It doesn't matter whether the ICMP packet has gone through POST_ROUTING, the conntrack associated with the packet is that of the original packet causing the ICMP REDIRECT (or any other kind of ICMP error). Basically, we don't want hosts talking directly to each other *if* NAT has been set up since that would obviously break things. In the case you describe (only destination NAT setup completed, but null mapping) instead of dropping the packet, we could set up a null source mapping and let the packet through under the assumption that the hosts will then start communicating directly. This will break if the host receiving the ICMP REDIRECT ignores it though. What is the specific problem you're trying to solve? ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: nat drop the icmp redirect packet 2011-11-30 18:53 ` Patrick McHardy @ 2011-12-01 0:59 ` Gao feng 2011-12-01 10:20 ` Patrick McHardy 0 siblings, 1 reply; 9+ messages in thread From: Gao feng @ 2011-12-01 0:59 UTC (permalink / raw) To: Patrick McHardy; +Cc: netfilter-devel, pablo 于 2011年12月01日 02:53, Patrick McHardy 写道: > On 11/28/2011 02:12 AM, Gao feng wrote: >> Hi >> >> In func nf_nat_icmp_reply_translation,the icmp packet will be droped when the nat is not finished. >> pc A(whose gateway is C) send a icmp request to pc B. >> When gw C receive this packet,it may return a icmp redirect packet to A. >> BUT now,the icmp request packet has not go to POSTROUTING,So the nat is not finished. >> Finally,the icmp redirect packet will be droped no matter the conn has nat or not. >> >> of course,the icmp redirect packet will be correct handled when nat is finished. >> >> Can somebody will give me some suggestion, >> or should I just add a sysctl to let the user decide drop or receive this icmp redirect packet when nat is not finished? > > It doesn't matter whether the ICMP packet has gone through > POST_ROUTING, the conntrack associated with the packet is > that of the original packet causing the ICMP REDIRECT (or > any other kind of ICMP error). > > Basically, we don't want hosts talking directly to each other > *if* NAT has been set up since that would obviously break > things. In the case you describe (only destination NAT setup > completed, but null mapping) instead of dropping the packet, > we could set up a null source mapping and let the packet > through under the assumption that the hosts will then start > communicating directly. > > This will break if the host receiving the ICMP REDIRECT ignores > it though. What is the specific problem you're trying to solve? > Thanks Patrick! As I said,in my case,the *first* ICMP REDIRECT packet will be dropped even the system has no nat rules,because this REDIRECT packet is triggered by the original packet in FORWARD chain(ip_forward),and when this REDIRECT packet goto POSTROUTING chian(nf_nat_fn->nf_nat_icmp_reply_translation),the original packet is still in FORWARD chain.So the original packet's conntrack ONLY has IPS_DST_NAT_DONE. I understand your mean,we should not let REDIRECT to take effect when this conntrack has nat rule. I just want to know is there some idea to avoid the first ICMP_REDIRECT packet being dropped? -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: nat drop the icmp redirect packet 2011-12-01 0:59 ` Gao feng @ 2011-12-01 10:20 ` Patrick McHardy 2011-12-02 5:32 ` Gao feng 0 siblings, 1 reply; 9+ messages in thread From: Patrick McHardy @ 2011-12-01 10:20 UTC (permalink / raw) To: Gao feng; +Cc: netfilter-devel, pablo On 12/01/2011 01:59 AM, Gao feng wrote: > 于 2011年12月01日 02:53, Patrick McHardy 写道: >> On 11/28/2011 02:12 AM, Gao feng wrote: >>> Hi >>> >>> In func nf_nat_icmp_reply_translation,the icmp packet will be droped when the nat is not finished. >>> pc A(whose gateway is C) send a icmp request to pc B. >>> When gw C receive this packet,it may return a icmp redirect packet to A. >>> BUT now,the icmp request packet has not go to POSTROUTING,So the nat is not finished. >>> Finally,the icmp redirect packet will be droped no matter the conn has nat or not. >>> >>> of course,the icmp redirect packet will be correct handled when nat is finished. >>> >>> Can somebody will give me some suggestion, >>> or should I just add a sysctl to let the user decide drop or receive this icmp redirect packet when nat is not finished? >> It doesn't matter whether the ICMP packet has gone through >> POST_ROUTING, the conntrack associated with the packet is >> that of the original packet causing the ICMP REDIRECT (or >> any other kind of ICMP error). >> >> Basically, we don't want hosts talking directly to each other >> *if* NAT has been set up since that would obviously break >> things. In the case you describe (only destination NAT setup >> completed, but null mapping) instead of dropping the packet, >> we could set up a null source mapping and let the packet >> through under the assumption that the hosts will then start >> communicating directly. >> >> This will break if the host receiving the ICMP REDIRECT ignores >> it though. What is the specific problem you're trying to solve? >> > Thanks Patrick! > > As I said,in my case,the *first* ICMP REDIRECT packet will be dropped even > the system has no nat rules,because this REDIRECT packet is triggered > by the original packet in FORWARD chain(ip_forward),and when this REDIRECT > packet goto POSTROUTING chian(nf_nat_fn->nf_nat_icmp_reply_translation),the > original packet is still in FORWARD chain.So the original packet's conntrack > ONLY has IPS_DST_NAT_DONE. > > I understand your mean,we should not let REDIRECT to take effect when this conntrack > has nat rule. > > I just want to know is there some idea to avoid the first ICMP_REDIRECT packet being dropped Yes, as I said, we could set up a NULL source mapping on the conntrack of the original packet and let the REDIRECT through. The user might have configured a source NAT rule though which would become ineffective by this. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: nat drop the icmp redirect packet 2011-12-01 10:20 ` Patrick McHardy @ 2011-12-02 5:32 ` Gao feng 2011-12-02 12:58 ` Patrick McHardy 0 siblings, 1 reply; 9+ messages in thread From: Gao feng @ 2011-12-02 5:32 UTC (permalink / raw) To: Patrick McHardy; +Cc: netfilter-devel, pablo 于 2011年12月01日 18:20, Patrick McHardy 写道: > Yes, as I said, we could set up a NULL source mapping on the > conntrack of the original packet and let the REDIRECT through. > The user might have configured a source NAT rule though which > would become ineffective by this. > Hi Patrick: Yes,you are right. You mean we have no idea of the ICMP REDIRECT packet being droppen when nat is not finished? -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: nat drop the icmp redirect packet 2011-12-02 5:32 ` Gao feng @ 2011-12-02 12:58 ` Patrick McHardy 2011-12-05 1:18 ` Gao feng 0 siblings, 1 reply; 9+ messages in thread From: Patrick McHardy @ 2011-12-02 12:58 UTC (permalink / raw) To: Gao feng; +Cc: netfilter-devel, pablo On 02.12.2011 06:32, Gao feng wrote: > 于 2011年12月01日 18:20, Patrick McHardy 写道: >> Yes, as I said, we could set up a NULL source mapping on the >> conntrack of the original packet and let the REDIRECT through. >> The user might have configured a source NAT rule though which >> would become ineffective by this. >> > > Hi Patrick: > > Yes,you are right. > > You mean we have no idea of the ICMP REDIRECT packet being droppen > when nat is not finished? We can't determine whether we could let it through at that point. The safe choice is to drop it. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: nat drop the icmp redirect packet 2011-12-02 12:58 ` Patrick McHardy @ 2011-12-05 1:18 ` Gao feng 0 siblings, 0 replies; 9+ messages in thread From: Gao feng @ 2011-12-05 1:18 UTC (permalink / raw) To: Patrick McHardy; +Cc: netfilter-devel, pablo 于 2011年12月02日 20:58, Patrick McHardy 写道: > On 02.12.2011 06:32, Gao feng wrote: >> 于 2011年12月01日 18:20, Patrick McHardy 写道: >>> Yes, as I said, we could set up a NULL source mapping on the >>> conntrack of the original packet and let the REDIRECT through. >>> The user might have configured a source NAT rule though which >>> would become ineffective by this. >>> >> >> Hi Patrick: >> >> Yes,you are right. >> >> You mean we have no idea of the ICMP REDIRECT packet being droppen >> when nat is not finished? > > We can't determine whether we could let it through at that point. > The safe choice is to drop it. > -- Good Morning Patrick I got it,thank you very much. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-12-05 1:17 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-11-28 1:12 nat drop the icmp redirect packet Gao feng 2011-11-28 1:23 ` Gao feng 2011-11-30 4:00 ` Gao feng 2011-11-30 18:53 ` Patrick McHardy 2011-12-01 0:59 ` Gao feng 2011-12-01 10:20 ` Patrick McHardy 2011-12-02 5:32 ` Gao feng 2011-12-02 12:58 ` Patrick McHardy 2011-12-05 1:18 ` Gao feng
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).