Skip to contentSkip to conversation

/proc/net/ip_conntrack

DISCUSSION Daniel Corrêa de Azevedo 3 participants 5 messages Jun 29, 2004 – Jun 30, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

Hi.
I wonder if any one could help me with figuring out a way to write to the
proc file "/proc/net/ip_conntrack". What I need is to replicate this file from one computer to another. I already have all the content from the original file at the destination machine (easy part). What I need to do is figure a way to put its content into this destination
machine /proc/net/ip_conntract file.
Any one could give a clue where to find how to do this? Thanks,

Daniel C. Azevedo

#1 lore raw
Quoted 2 lines · Daniel Corrêa de Azevedo

I wonder if any one could help me with figuring out a way to write to the proc file "/proc/net/ip_conntrack".

You can't. It is not a file, it is a window into the connection tracking function of the kernel showing you what is going on "right now". This window is bulletproof and you cant take things out or put things in via this window, only look at how they look.

Quoted 2 lines

What I need is to replicate this file
from one computer to another.

See discussions on conntrack replication/syncronisation. There is an ongoing (not yet finished) project implementing this kind of function. There is a whole lot more involved than just "copying".

Regards
Henrik

#3 lore raw
In reply to Daniel Corrêa de Azevedo

Hi Daniel,

Quoted 2 lines · Daniel Corrêa de Azevedo

I've just figured that out spending the hole night studing ip_conntrack source.

oh, welcome to the club. :-)

Quoted 3 lines

Since I'm really starting with advanced programming, it took me some time to figured out that ip_conntrack matching works as a LKM (Loable Kernel Module) and that to write to the /proc/net/ip_conntrack file, it should be a LKM too.
Tough, I still wonder if is there a solution to this problem.

sure, there is :-).

Quoted 3 lines

I was thinking of LKMs and wondering if it is possible to one write a LKM that interacts with the ip_conntrack LKM to write entries to /proc/net/ip_conntrack? Or even write directly to it?

that's a misconception, you can't write to /proc/net/ip_conntrack. As Henrik pointed out, /proc/net/ip_conntrack is just an interface to give you a snapshot of the current state of the conntrack table. As this often get people confused, actually the replication of the conntrack is a problem a bit more complex than writing /proc/net/ip_conntrack.

Surely you can write a LKM which interacts with the ip_conntrack module, but you'll also need to export some symbols to do.

Quoted 3 lines

I've just loaded ip_conntrack LKM indirectly by inserting a statefull rule to iptables and
checkout what symbols it makes available.

check ip_conntrack_standalone.c to see exported symbols by the conntrack system.

Quoted 4 lines

Any way, what do you think about this? Does it sound like nonsense (I've just my first
contact with LKM...) or it maybe possible?

you should forget your thoughts about the /proc interface and start understanding some ip_conntrack internal to replicate the information to some backup's machines.

regards,
Pablo

#2 lore raw
In reply to Henrik Nordstrom

Hi Henrik.

Quoted 7 lines
Quoted 2 lines

I wonder if any one could help me with figuring out a way to write to the proc file "/proc/net/ip_conntrack".

You can't. It is not a file, it is a window into the connection tracking function of the kernel showing you what is going on "right now". This window is bulletproof and you cant take things out or put things in via this window, only look at how they look.

I've just figured that out spending the hole night studing ip_conntrack source. Since I'm
really starting with advanced programming, it took me some time to figured out that ip_conntrack matching works as a LKM (Loable Kernel Module) and that to write to the /proc/net/ip_conntrack file, it should be a LKM too.
Tough, I still wonder if is there a solution to this problem. I was thinking of LKMs and
wondering if it is possible to one write a LKM that interacts with the ip_conntrack LKM to write entries to /proc/net/ip_conntrack? Or even write directly to it?
I've just loaded ip_conntrack LKM indirectly by inserting a statefull rule to iptables and
checkout what symbols it makes available. There are a few that, by their names, looks like inserts entries to ip_conntrack file (just guessing), like:

d0901c50 GPLONLY_ip_conntrack_put_Re9c6735e [ip_conntrack]

Any way, what do you think about this? Does it sound like nonsense (I've just my first
contact with LKM...) or it maybe possible?

Quoted 7 lines
Quoted 3 lines

What I need is to replicate this file
from one computer to another.

See discussions on conntrack replication/syncronisation. There is an ongoing (not yet finished) project implementing this kind of function. There is a whole lot more involved than just "copying".

I'll look into google for "conntrack replication/syncronisation" and see what I can figure out,
and also be waiting to see what you think about this considerations.
Thank's for your help,

Daniel C. Azevedo

#4 lore raw
In reply to Pablo Neira
Quoted 6 lines · Pablo Neira
Quoted 2 lines

Any way, what do you think about this? Does it sound like nonsense (I've just my first
contact with LKM...) or it maybe possible?

you should forget your thoughts about the /proc interface and start understanding some ip_conntrack internal to replicate the information to some backup's machines.

Or even better yet look into the already ongoing project implementing such interface to conntrack.

Regards
Henrik