From: Craig Davison <cd@securityfocus.com>
To: netfilter@lists.netfilter.org
Subject: (libiptc) iptc_delete_entry or iptc_delete_num_entry?
Date: Fri, 31 Jan 2003 13:57:37 -0700 [thread overview]
Message-ID: <20030131205737.GB27677@securityfocus.com> (raw)
Hi,
Should I be using iptc_delete_num_entry or iptc_delete_entry to delete
rules from a chain? I can't seem to find documentation for the
parameters of iptc_delete_entry (please point me in the right direction if
it exists!), and I'm not 100% sure what to pass for the rulenum parameter
to iptc_delete_num_entry.
The only documentation I have for iptc_delete_num_entry is the
Querying-libiptc-HOWTO from the LDP, and it says that rulenum is a rule
number starting at 1 for the first rule.
So let's say I want to delete every rule one at a time from a chain. Do I
have to manually increase my own rulenum counter for every rule, or is
there some way to get rulenum from an ipt_entry?
Example:
iptc_handle_t htable;
const char *chain = "INPUT";
struct ipt_entry *entry;
int rulenum = 0, is_chain_changed = 0;
if (!(htable = iptc_init ("filter")))
{
printf ("iptc_init: %s\n", iptc_strerror (errno));
exit(0);
}
entry = (struct ipt_entry *)iptc_first_rule (chain, &htable);
while (entry)
{
rulenum++;
if (!(iptc_delete_num_entry (chain, rulenum, &htable)))
{
printf ("iptc_delete_num_entry: %s\n", iptc_strerror (errno));
break;
}
is_chain_changed = 1;
entry = (struct ipt_entry *)iptc_next_rule (entry, &htable);
}
if (is_chain_changed)
{
if (!(iptc_commit (&htable)))
fprintf (stderr, "iptc_commit: %s\n", iptc_strerror (errno));
}
Plus, is the rulenum going to change for the rest of the rules in a chain
if I delete a rule? If not immediately, how about after I commit?
TIA for any help.
--
Craig Davison
Symantec Corporation
+1 (403) 213-3939 ext. 228
next reply other threads:[~2003-01-31 20:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-31 20:57 Craig Davison [this message]
2003-02-02 20:26 ` (libiptc) iptc_delete_entry or iptc_delete_num_entry? Craig Davison
[not found] <20030606122253.86683BBDBD@urano.rg.radial.br>
2003-06-06 12:44 ` Sander Sneekes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030131205737.GB27677@securityfocus.com \
--to=cd@securityfocus.com \
--cc=netfilter@lists.netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox