static int do_output(const char *tablename) { struct xtc_handle *h; const char *chain = NULL; if (!tablename) return for_each_table(&do_output); h = ip6tc_init(tablename); if (h == NULL) { xtables_load_ko(xtables_modprobe_program, false); h = ip6tc_init(tablename); } if (!h) xtables_error(OTHER_PROBLEM, "Cannot initialize: %s\n", ip6tc_strerror(errno)); time_t now = time(NULL); printf("# Generated by ip6tables-save v%s on %s", IPTABLES_VERSION, ctime(&now)); printf("*%s\n", tablename); /* Dump out chain names first, * thereby preventing dependency conflicts */ for (chain = ip6tc_first_chain(h); chain; chain = ip6tc_next_chain(h)) { printf(":%s ", chain); if (ip6tc_builtin(chain, h)) { struct xt_counters count; printf("%s ", ip6tc_get_policy(chain, &count, h)); printf("[%llu:%llu]\n", (unsigned long long)count.pcnt, (unsigned long long)count.bcnt); } else { printf("- [0:0]\n"); } } for (chain = ip6tc_first_chain(h); chain; chain = ip6tc_next_chain(h)) { const struct ip6t_entry *e; /* Dump out rules */ e = ip6tc_first_rule(chain, h); while(e) { print_rule6(e, h, chain, show_counters); e = ip6tc_next_rule(e, h); } } now = time(NULL); printf("COMMIT\n"); printf("# Completed on %s", ctime(&now)); ip6tc_free(h); return 1; }
static int do_output(const char *tablename) { ip6tc_handle_t h; const char *chain = NULL; if (!tablename) return for_each_table(&do_output); h = ip6tc_init(tablename); if (!h) exit_error(OTHER_PROBLEM, "Can't initialize: %s\n", ip6tc_strerror(errno)); if (!binary) { time_t now = time(NULL); printf("# Generated by ip6tables-save v%s on %s", IPTABLES_VERSION, ctime(&now)); printf("*%s\n", tablename); /* Dump out chain names first, * thereby preventing dependency conflicts */ for (chain = ip6tc_first_chain(&h); chain; chain = ip6tc_next_chain(&h)) { printf(":%s ", chain); if (ip6tc_builtin(chain, h)) { struct ip6t_counters count; printf("%s ", ip6tc_get_policy(chain, &count, &h)); printf("[%llu:%llu]\n", (unsigned long long)count.pcnt, (unsigned long long)count.bcnt); } else { printf("- [0:0]\n"); } } for (chain = ip6tc_first_chain(&h); chain; chain = ip6tc_next_chain(&h)) { const struct ip6t_entry *e; /* Dump out rules */ e = ip6tc_first_rule(chain, &h); while(e) { print_rule(e, &h, chain, counters); e = ip6tc_next_rule(e, &h); } } now = time(NULL); printf("COMMIT\n"); printf("# Completed on %s", ctime(&now)); } else { /* Binary, huh? OK. */ exit_error(OTHER_PROBLEM, "Binary NYI\n"); } ip6tc_free(&h); return 1; }
int ft_disable_all_events(void) { return for_each_table(ft_disable_all_events_in_table); }
int init_ft_events(void) { return for_each_table(init_ft_events_in_table); }