static void
rule_print(struct fw3_ipt_rule *r, const char *chain)
{
- struct xtables_rule_match *rm;
- struct xtables_match *m;
- struct xtables_target *t;
-
debug(r->h, "-A %s", chain);
#ifndef DISABLE_IPV6
#endif
rule_print4(&r->e);
- for (rm = r->matches; rm; rm = rm->next)
- {
- m = rm->match;
- printf(" -m %s", fw3_xt_get_match_name(m));
-
- if (m->save)
- m->save(&r->e.ip, m->m);
- }
-
- if (r->target)
- {
- t = r->target;
- printf(" -j %s", fw3_xt_get_target_name(t));
-
- if (t->save)
- t->save(&r->e.ip, t->t);
- }
+ fw3_xt_print_matches(&r->e.ip, r->matches);
+ fw3_xt_print_target(&r->e.ip, r->target);
printf("\n");
}
t->extra_opts, &t->option_offset);
}
+static inline void
+fw3_xt_print_matches(void *ip, struct xtables_match **matches)
+{
+ struct xtables_rule_match *rm;
+ struct xtables_match *m;
+
+ for (rm = matches; rm; rm = rm->next)
+ {
+ m = rm->match;
+ printf(" -m %s", fw3_xt_get_match_name(m));
+
+ if (m->save)
+ m->save(ip, m->m);
+ }
+}
+
+static inline void
+fw3_xt_print_target(void *ip, struct xtables_target *target)
+{
+ if (target)
+ {
+ printf(" -j %s", fw3_xt_get_target_name(target));
+
+ if (target->save)
+ target->save(ip, target->t);
+ }
+}
+
#endif
g->opts = xtables_merge_options(g->opts, t->extra_opts, &t->option_offset);
}
+static inline void
+fw3_xt_print_matches(void *ip, struct xtables_match **matches)
+{
+ struct xtables_rule_match *rm;
+ struct xtables_match *m;
+
+ printf(" ");
+
+ for (rm = matches; rm; rm = rm->next)
+ {
+ m = rm->match;
+ printf("-m %s ", fw3_xt_get_match_name(m));
+
+ if (m->save)
+ m->save(ip, m->m);
+ }
+}
+
+static inline void
+fw3_xt_print_target(void *ip, struct xtables_target *target)
+{
+ if (target)
+ {
+ printf("-j %s ", fw3_xt_get_target_name(target));
+
+ if (target->save)
+ target->save(ip, target->t);
+ }
+}
+
/* xtables api addons */