2004-11-14 01:38:14

by Andries E. Brouwer

[permalink] [raw]
Subject: [PATCH] no __initdata in netfilter?

Stuff marked initdata that is referenced in non-init context.

diff -uprN -X /linux/dontdiff a/net/ipv4/netfilter/ip_nat_rule.c b/net/ipv4/netfilter/ip_nat_rule.c
--- a/net/ipv4/netfilter/ip_nat_rule.c 2004-10-30 21:44:11.000000000 +0200
+++ b/net/ipv4/netfilter/ip_nat_rule.c 2004-11-13 22:40:51.000000000 +0100
@@ -59,8 +59,8 @@ static struct
struct ipt_replace repl;
struct ipt_standard entries[3];
struct ipt_error term;
-} nat_initial_table __initdata
-= { { "nat", NAT_VALID_HOOKS, 4,
+} nat_initial_table = {
+ { "nat", NAT_VALID_HOOKS, 4,
sizeof(struct ipt_standard) * 3 + sizeof(struct ipt_error),
{ [NF_IP_PRE_ROUTING] = 0,
[NF_IP_POST_ROUTING] = sizeof(struct ipt_standard),
diff -uprN -X /linux/dontdiff a/net/ipv4/netfilter/iptable_filter.c b/net/ipv4/netfilter/iptable_filter.c
--- a/net/ipv4/netfilter/iptable_filter.c 2004-10-30 21:44:11.000000000 +0200
+++ b/net/ipv4/netfilter/iptable_filter.c 2004-11-13 22:40:51.000000000 +0100
@@ -44,8 +44,8 @@ static struct
struct ipt_replace repl;
struct ipt_standard entries[3];
struct ipt_error term;
-} initial_table __initdata
-= { { "filter", FILTER_VALID_HOOKS, 4,
+} initial_table = {
+ { "filter", FILTER_VALID_HOOKS, 4,
sizeof(struct ipt_standard) * 3 + sizeof(struct ipt_error),
{ [NF_IP_LOCAL_IN] = 0,
[NF_IP_FORWARD] = sizeof(struct ipt_standard),


2004-11-14 07:56:42

by Patrick McHardy

[permalink] [raw]
Subject: Re: [netfilter-core] [PATCH] no __initdata in netfilter?

Andries Brouwer wrote:

>Stuff marked initdata that is referenced in non-init context.
>
Where ? The initial tables are replaced by ipt_register_table.

Regards
Patrick

>diff -uprN -X /linux/dontdiff a/net/ipv4/netfilter/ip_nat_rule.c b/net/ipv4/netfilter/ip_nat_rule.c
>--- a/net/ipv4/netfilter/ip_nat_rule.c 2004-10-30 21:44:11.000000000 +0200
>+++ b/net/ipv4/netfilter/ip_nat_rule.c 2004-11-13 22:40:51.000000000 +0100
>@@ -59,8 +59,8 @@ static struct
> struct ipt_replace repl;
> struct ipt_standard entries[3];
> struct ipt_error term;
>-} nat_initial_table __initdata
>-= { { "nat", NAT_VALID_HOOKS, 4,
>+} nat_initial_table = {
>+ { "nat", NAT_VALID_HOOKS, 4,
> sizeof(struct ipt_standard) * 3 + sizeof(struct ipt_error),
> { [NF_IP_PRE_ROUTING] = 0,
> [NF_IP_POST_ROUTING] = sizeof(struct ipt_standard),
>diff -uprN -X /linux/dontdiff a/net/ipv4/netfilter/iptable_filter.c b/net/ipv4/netfilter/iptable_filter.c
>--- a/net/ipv4/netfilter/iptable_filter.c 2004-10-30 21:44:11.000000000 +0200
>+++ b/net/ipv4/netfilter/iptable_filter.c 2004-11-13 22:40:51.000000000 +0100
>@@ -44,8 +44,8 @@ static struct
> struct ipt_replace repl;
> struct ipt_standard entries[3];
> struct ipt_error term;
>-} initial_table __initdata
>-= { { "filter", FILTER_VALID_HOOKS, 4,
>+} initial_table = {
>+ { "filter", FILTER_VALID_HOOKS, 4,
> sizeof(struct ipt_standard) * 3 + sizeof(struct ipt_error),
> { [NF_IP_LOCAL_IN] = 0,
> [NF_IP_FORWARD] = sizeof(struct ipt_standard),
>
>
>

2004-11-14 11:26:17

by Andries Brouwer

[permalink] [raw]
Subject: Re: [netfilter-core] [PATCH] no __initdata in netfilter?

On Sun, Nov 14, 2004 at 08:56:29AM +0100, Patrick McHardy wrote:
> Andries Brouwer wrote:
>
> >Stuff marked initdata that is referenced in non-init context.
>
> Where ? The initial tables are replaced by ipt_register_table.

ip_nat_rule.c:nat_initial_table was referenced in

static struct ipt_table nat_table = {
.table = &nat_initial_table.repl,
...

iptable_filter.c:initial_table was referenced in

static struct ipt_table packet_filter = {
.table = &initial_table.repl,
...

This is not to say that there is a bug here, that the .init
data would actually be referenced by non-init stuff, but
it is better to convince oneself by static inspection of
the binary than by reasoning about the flow of the program.

Where the memory savings are important, the code should
be rewritten a bit.

Andries