Skip to contentSkip to conversation

Changing the content of tcp timeouts in ip_conntrack_proto_tcp.c

DISCUSSION Emmanuel Guiton 4 participants 11 messages Jan 14, 2004 – Jan 15, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

Hi!

In the target module I'm writing, I need to customize the values ip_ct_tcp_timeout_/somthing/ in the ip_conntrack_proto_tcp.c file. I tried to write an extern function on the model of ip_ct_refresh, but I always got the same problem with depmod:

depmod: *** Unresolved symbols in /lib/modules/2.4.23/kernel/net/ipv4/netfilter/ipt_MY_TARGET.o
depmod: ip_ct_proto_tcp_set_timeouts

Does someone have a good advice on how to proceed correctly?

Emmanuel

#1 lore raw
Quoted 10 lines · Emmanuel Guiton

In the target module I'm writing, I need to customize the values ip_ct_tcp_timeout_/somthing/ in the ip_conntrack_proto_tcp.c file. I tried to write an extern function on the model of ip_ct_refresh, but I always got the same problem with depmod:

depmod: *** Unresolved symbols in /lib/modules/2.4.23/kernel/net/ipv4/netfilter/ipt_MY_TARGET.o
depmod: ip_ct_proto_tcp_set_timeouts

Does someone have a good advice on how to proceed correctly?

Looks like you have not exported this function from ip_conntrack. To use a function from another module than it is defined in the function must first be exported from the module where it is defined.

Regards
Henrik

#2 lore raw
Quoted 9 lines · Henrik Nordstrom
Quoted 5 lines · Emmanuel Guiton

In the target module I'm writing, I need to customize the values ip_ct_tcp_timeout_/somthing/ in the ip_conntrack_proto_tcp.c file. I tried to write an extern function on the model of ip_ct_refresh, but I always got the same problem with depmod:

depmod: *** Unresolved symbols in /lib/modules/2.4.23/kernel/net/ipv4/netfilter/ipt_MY_TARGET.o
depmod: ip_ct_proto_tcp_set_timeouts

Quoted 10 lines
Quoted 3 lines

Does someone have a good advice on how to proceed correctly?

Looks like you have not exported this function from ip_conntrack. To use a function from another module than it is defined in the function must first be exported from the module where it is defined.

Regards
Henrik

Well, I think I did. I defined my function in the ip_conntrack_proto_tcp.c and I exported its prototype in ip_conntrack.h. Then I call it in my target module which also uses ip_conntrack.h.
Should I have done otherwise?

Emmanuel

#3 lore raw

Hi,

Quoted 7 lines · Emmanuel Guiton
Quoted 3 lines

Looks like you have not exported this function from ip_conntrack. To use a function from another module than it is defined in the function must first be exported from the module where it is defined.

Well, I think I did. I defined my function in the ip_conntrack_proto_tcp.c and I exported its prototype in ip_conntrack.h. Then I call it in my target module which also uses ip_conntrack.h.

You have to explicitly export it using the EXPORT_SYMBOL() (or
EXPORT_SYMBOL_GPL) macro in ip_conntrack_standalone.c. It has a lot of other exported symbols, just add another one.

Signature · 2 lines
 Regards,
   Krisztian KOVACS
#4 lore raw
Quoted 8 lines · KOVACS Krisztian

Hi,

Quoted 3 lines · Emmanuel Guiton
Quoted 3 lines

Looks like you have not exported this function from ip_conntrack. To use a function from another module than it is defined in the function must first be exported from the module where it is defined.

Quoted 11 lines
Quoted 4 lines

Well, I think I did. I defined my function in the ip_conntrack_proto_tcp.c and I exported its prototype in ip_conntrack.h. Then I call it in my target module which also uses ip_conntrack.h.

You have to explicitly export it using the EXPORT_SYMBOL() (or
EXPORT_SYMBOL_GPL) macro in ip_conntrack_standalone.c. It has a lot of other exported symbols, just add another one.

Right, it's working now.
Thanks!

Emmanuel

#5 lore raw

Side effect? - Re: Changing the content of tcp timeouts in ip_conntrack_proto_tcp.c

Hi!

I was a bit optimistic in my last e-mail. Compilation is totally ok, insertion of the modules in the kernel seems to go fine... until I want to use them. The nat table does not work anymore. The ip_tables module seems to be there:
pc104:# iptables -L Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

But if I try the nat table:
pc104:# iptables -t nat -L
modprobe: Can't locate module ip_tables
iptables v1.2.9: can't initialize iptables table `nat': Table does not exist (do you need to insmod?) Perhaps iptables or your kernel needs to be upgraded.

If I do not add my function in ip_conntrack_standalone.c, everything's ok (well except that I can't use my funciton of course). To be very precise I just added the following:

In ip_conntrack_standalone.c:
EXPORT_SYMBOL(ip_ct_proto_tcp_set_timeouts);

In ip_conntrack.h:
extern void ip_ct_proto_tcp_set_timeous(/datatypes/);

In ip_conntrack_proto_tcp.c:
void ip_ct_proto_tcp_set_tcp_timeouts(unsigned long new_value, ...) {
...
ip_ct_tcp_timeout_established = new_value SECS;
...
}

And the calls to the function in ipt_MY_TARGET.c:
ip_ct_proto_tcp_set_timeouts(/values/);

What do I do wrong?

Emmanuel

Quoted 26 lines · Emmanuel Guiton
Quoted 8 lines · KOVACS Krisztian

Hi,

Quoted 3 lines · Emmanuel Guiton
Quoted 2 lines

Looks like you have not exported this function from ip_conntrack. To use a function from another module than it is defined in the function must first be exported from the module where it is defined.

Quoted 11 lines
Quoted 3 lines

Well, I think I did. I defined my function in the ip_conntrack_proto_tcp.c and I exported its prototype in ip_conntrack.h. Then I call it in my target module which also uses ip_conntrack.h.

You have to explicitly export it using the EXPORT_SYMBOL() (or
EXPORT_SYMBOL_GPL) macro in ip_conntrack_standalone.c. It has a lot of other exported symbols, just add another one.

Right, it's working now.
Thanks!

Emmanuel

#6 lore raw

Re: Side effect? - Re: Changing the content of tcp timeouts in ip_conntrack_proto_tcp.c

Hi,

Quoted 14 lines · Emmanuel Guiton

I was a bit optimistic in my last e-mail. Compilation is totally ok, insertion of the modules in the kernel seems to go fine... until I want to use them. The nat table does not work anymore.
The ip_tables module seems to be there:
pc104:# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Quoted 6 lines

But if I try the nat table:
pc104:# iptables -t nat -L
modprobe: Can't locate module ip_tables
iptables v1.2.9: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

Are you sure iptable_nat is loaded in the kernel? And what does your
kernel log say?

Signature · 2 lines
 Regards,
   Krisztian KOVACS
#7 lore raw

Userspace msg, hw_addr unused?

I was looking thru the userspace code for material passed up in the ipq_packet_msg structure, looking for any data from the ethernet header. I noticed that the hw_addr array never seems to be filled out, even though hw_addrlen does. Any reason for that?

Also, if I wanted to patch the kernel's ip_queue.c to pass up the source and destination ether address, any ideas on where I get the packet's data from? Thanks!!

__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

#8 lore raw

Re: Userspace msg, hw_addr unused?

In poking around, I think I see what would be needed. Any confirmation would be great.
entry->skb has a mac.ethernet structure. This looks to be a ethhdr, so it has a h_source and h_dest. 2 options seem to be to add a ethdr to the ipq_packet_msg and memcpy the entry->skb->mac.ethernet or to add 2 fields (maybe removing the hw_addr if unused) and memcpy the h_source and h_dest.

I think, if I alter those fields, though, that there is alot of recompile needed. Is there a better way to get to the ethernet fields?

Quoted 15 lines · --- Scott MacKay

I was looking thru the userspace code for material passed up in the ipq_packet_msg structure, looking for
any data from the ethernet header. I noticed that the
hw_addr array never seems to be filled out, even though hw_addrlen does. Any reason for that?

Also, if I wanted to patch the kernel's ip_queue.c to
pass up the source and destination ether address, any
ideas on where I get the packet's data from? Thanks!!

Quoted 6 lines

__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus"
Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

#9 lore raw

Re: Side effect? - Re: Changing the content of tcp timeouts in ip_conntrack_proto_tcp.c

In reply to KOVACS Krisztian
Quoted 5 lines · KOVACS Krisztian

Are you sure iptable_nat is loaded in the kernel? And what does your
kernel log say?

Well, as far as I've modified my sources I can't reproduce the error immediately. But a good guess would be that the module was not loaded and more specifically the problem may simply occured in the ip_conntrack module, thus avoiding iptable_nat to work.
But the problem is now solved. I have not changed anything except the name of my function which is much shorter than my original one. Now it's working, even the execution produces the result I was expecting. Isn't there a specific bound on the function's name? The first name I used was 44 characters long (it was in fact a longer version of the one I indicated in my previous mail).

Tanks for your help anyway.

Emmanuel

#10 lore raw

Last minute erratum: I'm stupid. - Re: Side effect? - Re: Changing the content of tcp timeouts ...

Quoted 7 lines · Emmanuel Guiton
Quoted 5 lines · KOVACS Krisztian

Are you sure iptable_nat is loaded in the kernel? And what does your
kernel log say?

Quoted 7 lines

Well, as far as I've modified my sources I can't reproduce the error immediately. But a good guess would be that the module was not loaded and more specifically the problem may simply occured in the ip_conntrack module, thus avoiding iptable_nat to work.
But the problem is now solved. I have not changed anything except the name of my function which is much shorter than my original one. Now it's working, even the execution produces the result I was expecting. Isn't there a specific bound on the function's name? The first name I used was 44 characters long (it was in fact a longer version of the one I indicated in my previous mail).

Tanks for your help anyway.

Emmanuel

I just noticed the real cause of the problem. A syntax error in the name of my function. I thought I had checked it... Please, forget about all the previous messages. Mea culpa.

Emmanuel