All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@davemloft.net>
Cc: Netfilter Development Mailinglist <netfilter-devel@lists.netfilter.org>
Subject: [PATCH 2.6.11]: Clear NAT status bits on module unload
Date: Sat, 05 Feb 2005 03:53:16 +0100	[thread overview]
Message-ID: <4204351C.8010701@trash.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 139 bytes --]

Hi Dave,

another patch which I think should go in 2.6.11, it fixes a crash
when unloading, then reloading iptable_nat.

Regards
Patrick



[-- Attachment #2: x --]
[-- Type: text/plain, Size: 1584 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/02/05 03:49:38+01:00 kaber@coreworks.de 
#   [NETFILTER]: Clear NAT status bits on module unload
#   
#   ip_nat_core doesn't clear the status bits in struct ip_conntrack on
#   module unload, but zeroes out the nat area. When the module is loaded
#   again and a connection times out ip_nat_cleanup_conntrack tries to
#   list_del the zeroed list-head and crashes. There are probably more
#   conditions under which it can crash or cause other misbehaviour.
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# net/ipv4/netfilter/ip_nat_core.c
#   2005/02/05 03:49:28+01:00 kaber@coreworks.de +1 -0
#   [NETFILTER]: Clear NAT status bits on module unload
#   
#   ip_nat_core doesn't clear the status bits in struct ip_conntrack on
#   module unload, but zeroes out the nat area. When the module is loaded
#   again and a connection times out ip_nat_cleanup_conntrack tries to
#   list_del the zeroed list-head and crashes. There are probably more
#   conditions under which it can crash or cause other misbehaviour.
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
diff -Nru a/net/ipv4/netfilter/ip_nat_core.c b/net/ipv4/netfilter/ip_nat_core.c
--- a/net/ipv4/netfilter/ip_nat_core.c	2005-02-05 03:50:14 +01:00
+++ b/net/ipv4/netfilter/ip_nat_core.c	2005-02-05 03:50:14 +01:00
@@ -543,6 +543,7 @@
 static int clean_nat(struct ip_conntrack *i, void *data)
 {
 	memset(&i->nat, 0, sizeof(i->nat));
+	i->status &= ~(IPS_NAT_MASK | IPS_NAT_DONE_MASK | IPS_SEQ_ADJUST);
 	return 0;
 }
 

             reply	other threads:[~2005-02-05  2:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-05  2:53 Patrick McHardy [this message]
2005-02-07  6:13 ` [PATCH 2.6.11]: Clear NAT status bits on module unload David S. 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=4204351C.8010701@trash.net \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=netfilter-devel@lists.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.