summaryrefslogtreecommitdiffstats
path: root/userspace/ebtables2/ebtables.c
diff options
context:
space:
mode:
authorBart De Schuymer <bdschuym@pandora.be>2005-08-27 16:52:19 +0000
committerBart De Schuymer <bdschuym@pandora.be>2005-08-27 16:52:19 +0000
commit6fad20a22b19f36763006998acb8f94916f6c827 (patch)
treecd827b209a74a95fc8b22cd8f0384a3a65d17ad3 /userspace/ebtables2/ebtables.c
parent8f4b3b4a405a385b07647ce29515616cc64bdb57 (diff)
make array of chains
Diffstat (limited to 'userspace/ebtables2/ebtables.c')
-rw-r--r--userspace/ebtables2/ebtables.c71
1 files changed, 11 insertions, 60 deletions
diff --git a/userspace/ebtables2/ebtables.c b/userspace/ebtables2/ebtables.c
index 08a9e57..717c66b 100644
--- a/userspace/ebtables2/ebtables.c
+++ b/userspace/ebtables2/ebtables.c
@@ -406,73 +406,24 @@ ATOMIC_ENV_VARIABLE " : if set <FILE> (see above) will equal its value"
static void list_rules()
{
int i;
-#ifdef EBT_DEBUG
- int j;
-#endif
struct ebt_cntchanges *cc = replace->counterchanges;
if (!(replace->flags & LIST_X))
printf("Bridge table: %s\n", table->name);
- if (replace->selected_chain != -1) {
-#ifdef EBT_DEBUG
-
- for (i = 0; i < replace->selected_chain; i++) {
- if (i < NF_BR_NUMHOOKS && !(replace->hook_entry[i]))
- continue;
- j = ebt_nr_to_chain(replace, i)->nentries;
- while (j) {
- if (cc->type != CNT_DEL)
- j--;
- cc = cc->next;
- }
- }
-#endif
+ if (replace->selected_chain != -1)
list_em(ebt_to_chain(replace), cc);
- } else {
- struct ebt_u_chain_list *cl = replace->udc;
-
+ else {
/* Create new chains and rename standard chains when necessary */
- if (replace->flags & LIST_X) {
- while (cl) {
- printf("ebtables -t %s -N %s\n", replace->name,
- cl->udc->name);
- cl = cl->next;
- }
- cl = replace->udc;
+ if (replace->flags & LIST_X && replace->num_chains > NF_BR_NUMHOOKS) {
+ for (i = NF_BR_NUMHOOKS; i < replace->num_chains; i++)
+ printf("ebtables -t %s -N %s\n", replace->name, replace->chains[i]->name);
for (i = 0; i < NF_BR_NUMHOOKS; i++)
- if (replace->hook_entry[i] &&
- strcmp(replace->hook_entry[i]->name, ebt_hooknames[i]))
- printf("ebtables -t %s -E %s %s\n",
- replace->name, ebt_hooknames[i],
- replace->hook_entry[i]->name);
- }
- i = 0;
- while (1) {
- if (i < NF_BR_NUMHOOKS) {
- if (replace->hook_entry[i]) {
- list_em(replace->hook_entry[i], cc);
-#ifdef EBT_DEBUG
- j = replace->hook_entry[i]->nentries;
-#endif
- }
- } else {
- if (!cl)
- break;
- list_em(cl->udc, cc);
-#ifdef EBT_DEBUG
- j = cl->udc->nentries;
-#endif
- cl = cl->next;
- }
-#ifdef EBT_DEBUG
- while (j) {
- if (cc->type != CNT_DEL)
- j--;
- cc = cc->next;
- }
-#endif
- i++;
+ if (replace->chains[i] && strcmp(replace->chains[i]->name, ebt_hooknames[i]))
+ printf("ebtables -t %s -E %s %s\n", replace->name, ebt_hooknames[i], replace->chains[i]->name);
}
+ for (i = 0; i < replace->num_chains; i++)
+ if (replace->chains[i])
+ list_em(replace->chains[i], cc);
}
}
@@ -1223,7 +1174,7 @@ check_extension:
struct ebt_u_entry *e;
i++;
- entries = ebt_nr_to_chain(replace, i);
+ entries = replace->chains[i];
if (!entries) {
if (i < NF_BR_NUMHOOKS)
continue;