* (libiptc) iptc_delete_entry or iptc_delete_num_entry?
@ 2003-01-31 20:57 Craig Davison
2003-02-02 20:26 ` Craig Davison
0 siblings, 1 reply; 3+ messages in thread
From: Craig Davison @ 2003-01-31 20:57 UTC (permalink / raw)
To: netfilter
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: (libiptc) iptc_delete_entry or iptc_delete_num_entry?
2003-01-31 20:57 (libiptc) iptc_delete_entry or iptc_delete_num_entry? Craig Davison
@ 2003-02-02 20:26 ` Craig Davison
0 siblings, 0 replies; 3+ messages in thread
From: Craig Davison @ 2003-02-02 20:26 UTC (permalink / raw)
To: netfilter
Hi again,
The reason I'm asking is that neither the LDP nor the Netfilter Hacking HOWTO have adequate
information on these functions. Basically I need help from someone who has used libiptc to
add, modify and delete rules, or at least some kind of document on the subject.
On Fri, Jan 31, 2003 at 01:57:37PM -0700, Craig Davison wrote:
> 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
>
--
Craig Davison
Symantec Corporation
+1 (403) 213-3939 ext. 228
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: (libiptc) iptc_delete_entry or iptc_delete_num_entry?
[not found] <20030606122253.86683BBDBD@urano.rg.radial.br>
@ 2003-06-06 12:44 ` Sander Sneekes
0 siblings, 0 replies; 3+ messages in thread
From: Sander Sneekes @ 2003-06-06 12:44 UTC (permalink / raw)
To: Craig Davison; +Cc: netfilter
On Fri, 2003-06-06 at 14:22, Craig Davison wrote:
> ------------------ Virus Warning Message (on dmdint.com)
>
> Found virus PE_BUGBEAR.B in file serialswitches.txt.exe
> The uncleanable file serialswitches.txt.exe is moved to /etc/iscan/virus/virzXfqEv.
>
> ---------------------------------------------------------
>
> ______________________________________________________________________
>
> 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
>
> ______________________________________________________________________
>
> ------------------ Virus Warning Message (on dmdint.com)
>
> serialswitches.txt.exe is removed from here because it contains a virus.
>
> ---------------------------------------------------------
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-06-06 12:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-31 20:57 (libiptc) iptc_delete_entry or iptc_delete_num_entry? Craig Davison
2003-02-02 20:26 ` Craig Davison
[not found] <20030606122253.86683BBDBD@urano.rg.radial.br>
2003-06-06 12:44 ` Sander Sneekes
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.