Handling large amounts of data
I have written an iptables module called "multirange" that works like a combination of iprange and multiport. That is, you can specify multiple ranges to be matched by one rule.
I had to do this because I am loading some 100000 entries into this rule and I needed something efficient at handling this many ranges.
My question is, what is the best way to communicate all these ranges
from user-space into the kernel module? I am currently loading them
via procfs. Is this an acceptable method or should I be looking at something else? It certainly works great but I would like it to be as "proper" as possible.
Thanks!
s
Quoted 5 lines · Silimite
My question is, what is the best way to communicate all these ranges
from user-space into the kernel module? I am currently loading them
via procfs. Is this an acceptable method or should I be looking at something else? It certainly works great but I would like it to be as "proper" as possible.
A unicast netlink socket would almost certainly be the best way to go here. For examples on how to use unicast netlink sockets, look at net/ipv4/netfilter/ip_queue.c or net/core/rtnetlink.c.
Signature · 2 lines
[ Tobias DiPasquale ] 0x636f6465736c696e67657240676d61696c2e636f6d
Thanks! I'll look into that more. I had looked at the netlink sockets in the past but they seemed to require a more complex interface (ie. I can't just cat/echo commands like in procfs). I do like the idea of being able to use netlink and have persistent connections open (for status updates like in a GUI interface).
I suppose there are not a lot of modules that need this type of
interface. I noticed that there was at least one other module using
procfs.
s
Quoted 7 lines · Tobias DiPasquale
A unicast netlink socket would almost certainly be the best way to go
here. For examples on how to use unicast netlink sockets, look atnet/ipv4/netfilter/ip_queue.cornet/core/rtnetlink.c.--
[ Tobias DiPasquale ]0x636f6465736c696e67657240676d61696c2e636f6d