Skip to contentSkip to conversation

Deleting iptable-extended rule

DISCUSSION lists brk 2 participants 2 messages Dec 4, 2002 – Dec 9, 2002 netfilter

lore
Share & tools
lore

lists brk

author
#0 lore raw

Hi!

I am using iptables-1.2.7a. I have extended iptables to do a coustom matching operation. The extension works fine when I use it while adding new rules, something like
iptables -A INPUT -m coustom --ip-id -j DROP.

I am able to delete the rule using the rule number, but I am not able to remove it using the rule specifed above but with -D option, something like iptables -D INPUT -m coustom --ip-id -j DROP

The error I get is:
iptables: Bad rule (does a matching rule exist in that chain?)

I tried to debug it and found that iptables fails at

mptr = matchmask + sizeof(STRUCT_ENTRY);
	if (IPT_MATCH_ITERATE(a, match_different, a->elems,
b->elems, &mptr))
	  return 0;

in is_same() found in file libiptc/libip4tc.c

Any ideas why this might be happening??

Thanks,
brk

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus – Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

#1 lore raw
Quoted 11 lines · lists brk

I am able to delete the rule using the rule number, but I am not able to remove it using the rule specifed above but with -D option, something like iptables -D INPUT -m coustom --ip-id -j DROP

The error I get is:
iptables: Bad rule (does a matching rule exist in that chain?)

I tried to debug it and found that iptables fails at

Quoted 8 lines
mptr = matchmask + sizeof(STRUCT_ENTRY);
	if (IPT_MATCH_ITERATE(a, match_different, a->elems,
b->elems, &mptr))
	  return 0;

in is_same() found in file libiptc/libip4tc.c

Any ideas why this might be happening??

because the compare fails for some reason. Maybe there are some uninitialized fields in the match private data structure. Try explicitly memset()ing it to zero when it is initlailzed from the parse() function.

Quoted 2 lines

Thanks,
brk

Signature · 4 lines
- Harald Welte / [email protected]               http://www.gnumonks.org/
============================================================================
"If this were a dictatorship, it'd be a heck of a lot easier, just so long
 as I'm the dictator."  --  George W. Bush Dec 18, 2000