Skip to contentSkip to conversation

Tiny ip_nat_snmp_basic fix

PATCH In review Rob Radez 2 participants 3 messages Jun 23, 2002 – Jun 24, 2002

Subsystems (2)
lore
Share & tools
lore

Rob Radez

author
#0 lore raw

PATCH 1/1 Tiny ip_nat_snmp_basic fix

Hi,
I looked at the pending patches page, tried to browse through the mailing archives, and checked google, but didn't see if anyone had already addressed this. fini() in net/ipv4/netfilter/ip_nat_snmp_basic.c is marked __exit, but on Sparc32 will fail to link into the kernel because of some btfixup magic. I saw two obvious ways to fix this, but only did one because I wasn't sure about what kind of netfilter magic is going on in fini(). The attached patch simply removes the __exit tag from fini() and lets the file link in ok.

The other option is to remove the br_write_lock_bh/br_write_unlock_bh calls in fini() since they don't seem to be protecting anything. I didn't do that because I'm not sure if there are any side effects that are being taken advantage of here.

Patch is against 2.4.19-pre10.

Regards,
Rob Radez

net/ipv4/netfilter/ip_nat_snmp_basic.c renamed from net/ipv4//netfilter/ip_nat_snmp_basic.c +1 -1
@@ -1338,7 +1338,7 @@
 	return ret;
 }
 
-static void __exit fini(void)
+static void fini(void)
 {
 	ip_nat_helper_unregister(&snmp);
 	ip_nat_helper_unregister(&snmp_trap);
#1 lore raw
Quoted 4 lines · Rob Radez

Hi,
I looked at the pending patches page, tried to browse through the mailing archives, and checked google, but didn't see if anyone had already addressed this.

See http://marc.theaimsgroup.com/?l=linux-kernel&m=100909932003300&w=2

Quoted 3 lines

fini() in net/ipv4/netfilter/ip_nat_snmp_basic.c is marked __exit,
but on Sparc32 will fail to link into the kernel because of some btfixup magic.

Can you please post the build error message and the version of binutils that you're using?

Quoted 4 lines

I saw two obvious ways to fix this, but only did one because I wasn't
sure about what kind of netfilter magic is going on in fini(). The attached patch simply removes the __exit tag from fini() and lets the file link in ok.

No, the __exit tag is correct.

Quoted 5 lines

The other option is to remove the br_write_lock_bh/br_write_unlock_bh calls in fini() since they don't seem to be protecting anything. I didn't do that because I'm not sure if there are any side effects that are being taken advantage of here.

The purpose of this lock/unlock is to synchronize with net_rx_action().

- James

Signature · 2 lines
James Morris
<[email protected]>
author
#2 lore raw
Quoted 7 lines · James Morris
Quoted 4 lines · Rob Radez

Hi,
I looked at the pending patches page, tried to browse through the mailing archives, and checked google, but didn't see if anyone had already addressed this.

Quoted 8 lines

See http://marc.theaimsgroup.com/?l=linux-kernel&m=100909932003300&w=2

Quoted 3 lines

fini() in net/ipv4/netfilter/ip_nat_snmp_basic.c is marked __exit,
but on Sparc32 will fail to link into the kernel because of some btfixup magic.

Can you please post the build error message and the version of binutils that you're using?

This is slightly different: it's not ld complaining, but btfixup. (background info: btfixup is a way for one kernel to run on sun4c/sun4d/sun4m with the kernel determining all the hardware-specific functions to call at boot time instead of compile time.) When compiling for smp with the snmp code builtin, btfixupprep complains "Wrong use of 'smp_processor_id' in '.text.exit' section. It can only be used in .text, .fixup and .text.init". Of all the files that I compiled into the kernel, ip_nat_snmp_basic is the only one that had this problem, so I figured that while the __exit tag is correct, it was simplest to just remove it and suffer the miniscule loss of not being able to free the memory it takes up.

Quoted 1 line

The purpose of this lock/unlock is to synchronize with net_rx_action().

Perhaps a comment in the code to that effect?

Regards,
Rob Radez