Skip to contentSkip to conversation

Checking add/remove rules

DISCUSSION Silimite 2 participants 4 messages Aug 22, 2005 – Aug 25, 2005 netfilter

lore
Share & tools
lore

Silimite

author
#0 lore raw

Is there any reliable way to tell when a rule is added or removed from within an iptables module?

I know you can see when they are added and removed in the check() and destroy() functions but it seems those are called multiple times and there does not appear to be a way to determine exactly when a rule is being added or removed.

Thanks for any information!

author
#1 lore raw

Should I take this silence as meaning this is not possible? Or maybe no one knows?

Even a "that's not possible" answer would be nice.

Thanks

S

Quoted 10 lines · Silimite

Is there any reliable way to tell when a rule is added or removed from within an iptables module?

I know you can see when they are added and removed in the check() and destroy() functions but it seems those are called multiple times and there does not appear to be a way to determine exactly when a rule is being added or removed.

Thanks for any information!

#2 lore raw
Quoted 4 lines · Silimite

Should I take this silence as meaning this is not possible? Or maybe no one knows?

Even a "that's not possible" answer would be nice.

It is possible, it's ugly but possible.

Look at the geoip match in patch-o-matic-ng, more exactly the refcounting in the checkentry()/destroy() functions in ipt_geoip.c And look at the posision of the refcount member of the ipt_geoip_info struct in the includefile. And look at the size and userspacesize members of struct iptables_match in libipt_geoip.c

I hope that helps.

/Martin

author
#3 lore raw

Thanks! That's what I needed to know. I was mostly just wondering if there was a way besides something like ref-counting. Since there does not seem to be another way I now know what to do.

Thanks again.

S

Quoted 9 lines · Martin Josefsson

Look at the geoip match in patch-o-matic-ng, more exactly the refcounting in the checkentry()/destroy() functions in ipt_geoip.c And look at the posision of the refcount member of the ipt_geoip_info struct in the includefile. And look at the size and userspacesize members of struct iptables_match in libipt_geoip.c

I hope that helps.

/Martin