12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- #include <stdio.h>
- #include <stdlib.h>
- #include <errno.h>
- #include <ip6tables.h>
- #include "ip6tables-multi.h"
- int
- ip6tables_main(int argc, char *argv[])
- {
- int ret;
- char *table = "filter";
- struct xtc_handle *handle = NULL;
- ip6tables_globals.program_name = "ip6tables";
- ret = xtables_init_all(&ip6tables_globals, NFPROTO_IPV6);
- if (ret < 0) {
- fprintf(stderr, "%s/%s Failed to initialize xtables\n",
- ip6tables_globals.program_name,
- ip6tables_globals.program_version);
- exit(1);
- }
- #if defined(ALL_INCLUSIVE) || defined(NO_SHARED_LIBS)
- init_extensions();
- init_extensions6();
- #endif
- ret = do_command6(argc, argv, &table, &handle);
- if (ret) {
- ret = ip6tc_commit(handle);
- ip6tc_free(handle);
- }
- if (!ret) {
- if (errno == EINVAL) {
- fprintf(stderr, "ip6tables: %s. "
- "Run `dmesg' for more information.\n",
- ip6tc_strerror(errno));
- } else {
- fprintf(stderr, "ip6tables: %s.\n",
- ip6tc_strerror(errno));
- }
- }
- exit(!ret);
- }
|