* iptables links
@ 2011-06-23 22:16 Jonathan Tripathy
2011-06-23 23:44 ` Jan Engelhardt
0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Tripathy @ 2011-06-23 22:16 UTC (permalink / raw)
To: netfilter
Hi Everyone,
Is there any quick command that I can use with iptables to remove all
links to a chain, as well as removing the chain itself?
Or would I need to hack this in?
Thanks
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: iptables links
2011-06-23 22:16 iptables links Jonathan Tripathy
@ 2011-06-23 23:44 ` Jan Engelhardt
2011-06-24 0:06 ` Jonathan Tripathy
0 siblings, 1 reply; 5+ messages in thread
From: Jan Engelhardt @ 2011-06-23 23:44 UTC (permalink / raw)
To: Jonathan Tripathy; +Cc: netfilter
On Friday 2011-06-24 00:16, Jonathan Tripathy wrote:
> Hi Everyone,
>
> Is there any quick command that I can use with iptables to remove all links to
> a chain, as well as removing the chain itself?
No, -F would clean the chain, and -X would remove them, which are
currently two separate operations with the iptables(8) frontend.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: iptables links
2011-06-23 23:44 ` Jan Engelhardt
@ 2011-06-24 0:06 ` Jonathan Tripathy
2011-06-24 22:12 ` Jan Engelhardt
0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Tripathy @ 2011-06-24 0:06 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: netfilter
On 24/06/2011 00:44, Jan Engelhardt wrote:
> On Friday 2011-06-24 00:16, Jonathan Tripathy wrote:
>
>> Hi Everyone,
>>
>> Is there any quick command that I can use with iptables to remove all links to
>> a chain, as well as removing the chain itself?
> No, -F would clean the chain, and -X would remove them, which are
> currently two separate operations with the iptables(8) frontend.
Hi There,
Thanks for this, however I already knew those commands. I'm looking for
a command to clear the links to the chain (the commands above clear the
chain itself), however I'm guessing is there none?
Thanks
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: iptables links
2011-06-24 0:06 ` Jonathan Tripathy
@ 2011-06-24 22:12 ` Jan Engelhardt
2011-07-18 17:35 ` Erik Schorr
0 siblings, 1 reply; 5+ messages in thread
From: Jan Engelhardt @ 2011-06-24 22:12 UTC (permalink / raw)
To: Jonathan Tripathy; +Cc: netfilter
On Friday 2011-06-24 02:06, Jonathan Tripathy wrote:
>
> On 24/06/2011 00:44, Jan Engelhardt wrote:
>> On Friday 2011-06-24 00:16, Jonathan Tripathy wrote:
>>
>>> Hi Everyone,
>>>
>>> Is there any quick command that I can use with iptables to remove all links
>>> to
>>> a chain, as well as removing the chain itself?
>> No, -F would clean the chain, and -X would remove them, which are
>> currently two separate operations with the iptables(8) frontend.
> Hi There,
>
> Thanks for this, however I already knew those commands. I'm looking for a
> command to clear the links to the chain (the commands above clear the chain
> itself), however I'm guessing is there none?
Indeed there are none.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: iptables links
2011-06-24 22:12 ` Jan Engelhardt
@ 2011-07-18 17:35 ` Erik Schorr
0 siblings, 0 replies; 5+ messages in thread
From: Erik Schorr @ 2011-07-18 17:35 UTC (permalink / raw)
To: netfilter; +Cc: Jan Engelhardt, Jonathan Tripathy
I've had the need for the same functionality, so I wrote the script
below. It takes one argument - the name of the chain for which you want
to delete any rules that reference it. It prints the iptables commands
to run to delete the respective rules.
#!/bin/bash
# unlink-chain.sh
# Erik Schorr 2010
# Permission to use, modify, and redistribute granted to anyone for any
purpose.
# Use this program at your own risk.
# Author disclaims any responsibility for quality or usefulness of this
program.
PATH=/sbin:/usr/sbin:$PATH
SEARCHCHAIN=$1
if [ "$SEARCHCHAIN" ]; then
for n in nat filter raw; do
iptables -t $n -S | grep -e "^-A.*-j $SEARCHCHAIN " | sed -e
"s/^-A/-D/g" -e "s/^/iptables -t $n /g"
done
else
echo "usage: $0 <target chain>"
fi
### snip
# ./unlink-chain.sh DROP_SPYWARE
iptables -t filter -D EGRESS_OUT -d x.x.x.x/32 -p tcp -m comment
--comment "SPYWARE 20110215" -j DROP_SPYWARE
Enjoy.
On 6/24/2011 3:12 PM, Jan Engelhardt wrote:
> On Friday 2011-06-24 02:06, Jonathan Tripathy wrote:
>
>> On 24/06/2011 00:44, Jan Engelhardt wrote:
>>> On Friday 2011-06-24 00:16, Jonathan Tripathy wrote:
>>>
>>>> Hi Everyone,
>>>>
>>>> Is there any quick command that I can use with iptables to remove all links
>>>> to
>>>> a chain, as well as removing the chain itself?
>>> No, -F would clean the chain, and -X would remove them, which are
>>> currently two separate operations with the iptables(8) frontend.
>> Hi There,
>>
>> Thanks for this, however I already knew those commands. I'm looking for a
>> command to clear the links to the chain (the commands above clear the chain
>> itself), however I'm guessing is there none?
> Indeed there are none.
> --
> To unsubscribe from this list: send the line "unsubscribe netfilter" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-07-18 17:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-23 22:16 iptables links Jonathan Tripathy
2011-06-23 23:44 ` Jan Engelhardt
2011-06-24 0:06 ` Jonathan Tripathy
2011-06-24 22:12 ` Jan Engelhardt
2011-07-18 17:35 ` Erik Schorr
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox