netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ip6tables.c File Reference
#include <getopt.h>
#include <string.h>
#include <netdb.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdarg.h>
#include <stdbool.h>
#include <limits.h>
#include <ip6tables.h>
#include <xtables.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include "ip6tables-multi.h"
#include "xshared.h"
Include dependency graph for ip6tables.c:

Data Structures

struct  pprot
 

Macros

#define TRUE   1
 
#define FALSE   0
 
#define CMD_NONE   0x0000U
 
#define CMD_INSERT   0x0001U
 
#define CMD_DELETE   0x0002U
 
#define CMD_DELETE_NUM   0x0004U
 
#define CMD_REPLACE   0x0008U
 
#define CMD_APPEND   0x0010U
 
#define CMD_LIST   0x0020U
 
#define CMD_FLUSH   0x0040U
 
#define CMD_ZERO   0x0080U
 
#define CMD_NEW_CHAIN   0x0100U
 
#define CMD_DELETE_CHAIN   0x0200U
 
#define CMD_SET_POLICY   0x0400U
 
#define CMD_RENAME_CHAIN   0x0800U
 
#define CMD_LIST_RULES   0x1000U
 
#define CMD_ZERO_NUM   0x2000U
 
#define CMD_CHECK   0x4000U
 
#define NUMBER_OF_CMD   16
 
#define NUMBER_OF_OPT   ARRAY_SIZE(optflags)
 
#define opts   ip6tables_globals.opts
 
#define prog_name   ip6tables_globals.program_name
 
#define prog_vers   ip6tables_globals.program_version
 

Functions

void ip6tables_exit_error (enum xtables_exittype status, const char *msg,...) __attribute__((noreturn
 
void format (printf, 2, 3)))
 
int for_each_chain6 (int(*fn)(const xt_chainlabel, int, struct xtc_handle *), int verbose, int builtinstoo, struct xtc_handle *handle)
 
int flush_entries6 (const xt_chainlabel chain, int verbose, struct xtc_handle *handle)
 
int delete_chain6 (const xt_chainlabel chain, int verbose, struct xtc_handle *handle)
 
void print_rule6 (const struct ip6t_entry *e, struct xtc_handle *h, const char *chain, int counters)
 
int do_command6 (int argc, char *argv[], char **table, struct xtc_handle **handle, bool restore)
 

Variables

struct xtables_globals ip6tables_globals
 

Macro Definition Documentation

#define CMD_APPEND   0x0010U

Referenced by do_command6().

#define CMD_CHECK   0x4000U

Referenced by do_command6().

#define CMD_DELETE   0x0002U

Referenced by do_command6().

#define CMD_DELETE_CHAIN   0x0200U

Referenced by do_command6().

#define CMD_DELETE_NUM   0x0004U

Referenced by do_command6().

#define CMD_FLUSH   0x0040U

Referenced by do_command6().

#define CMD_INSERT   0x0001U

Referenced by do_command6().

#define CMD_LIST   0x0020U

Referenced by do_command6().

#define CMD_LIST_RULES   0x1000U

Referenced by do_command6(), and do_commandx().

#define CMD_NEW_CHAIN   0x0100U

Referenced by do_command6().

#define CMD_NONE   0x0000U

Referenced by do_command6().

#define CMD_RENAME_CHAIN   0x0800U

Referenced by do_command6().

#define CMD_REPLACE   0x0008U

Referenced by do_command6().

#define CMD_SET_POLICY   0x0400U

Referenced by do_command6().

#define CMD_ZERO   0x0080U

Referenced by do_command6().

#define CMD_ZERO_NUM   0x2000U

Referenced by do_command6(), and do_commandx().

#define FALSE   0

Referenced by do_command6().

#define NUMBER_OF_CMD   16
#define NUMBER_OF_OPT   ARRAY_SIZE(optflags)
#define opts   ip6tables_globals.opts
#define prog_name   ip6tables_globals.program_name
#define prog_vers   ip6tables_globals.program_version
#define TRUE   1

Referenced by do_command6().

Function Documentation

int delete_chain6 ( const xt_chainlabel  chain,
int  verbose,
struct xtc_handle handle 
)

References for_each_chain6(), and ip6tc_delete_chain().

Referenced by do_command6(), and ip6tables_restore_main().

Here is the call graph for this function:

Here is the caller graph for this function:

int do_command6 ( int  argc,
char *  argv[],
char **  table,
struct xtc_handle **  handle,
bool  restore 
)

References iptables_command_state::argv, xt_counters::bcnt, iptables_command_state::c, CMD_APPEND, CMD_CHECK, CMD_DELETE, CMD_DELETE_CHAIN, CMD_DELETE_NUM, CMD_FLUSH, CMD_INSERT, CMD_LIST, CMD_LIST_RULES, CMD_NEW_CHAIN, CMD_NONE, CMD_RENAME_CHAIN, CMD_REPLACE, CMD_SET_POLICY, CMD_ZERO, CMD_ZERO_NUM, command_default(), ip6t_entry::counters, delete_chain6(), dump_entries6(), exit_printhelp(), exit_tryhelp(), FALSE, ip6t_ip6::flags, flush_entries6(), iptables_command_state::fw6, generic_opt_check(), ip6t_ip6::iniface, ip6t_ip6::iniface_mask, iptables_command_state::invert, ip6t_ip6::invflags, IP6T_F_GOTO, IP6T_F_PROTO, IP6T_INV_DSTIP, IP6T_INV_SRCIP, ip6tables_globals, ip6tc_create_chain(), ip6tc_delete_num_entry(), ip6tc_init(), ip6tc_is_chain(), ip6tc_rename_chain(), ip6tc_set_policy(), ip6tc_strerror(), ip6tc_zero_counter(), ip6t_entry::ipv6, iptables_command_state::jumpto, line, xtables_match::m, xtables_rule_match::match, iptables_command_state::matches, xtables_match::mflags, xtables_match::next, xtables_target::next, xtables_rule_match::next, NULL, OPT_COUNTERS, OPT_DESTINATION, OPT_EXPANDED, OPT_JUMP, OPT_LINENUMBERS, OPT_NUMERIC, OPT_PROTOCOL, OPT_SOURCE, OPT_VERBOSE, OPT_VIANAMEIN, OPT_VIANAMEOUT, iptables_command_state::options, opts, xtables_globals::orig_opts, ip6t_ip6::outiface, ip6t_ip6::outiface_mask, PARAMETER_PROBLEM, xt_counters::pcnt, prog_name, prog_vers, ip6t_ip6::proto, iptables_command_state::protocol, RESOURCE_PROBLEM, size, xtables_target::t, xt_entry_target::target, iptables_command_state::target, xtables_target::tflags, TRUE, xtables_target::used, VERSION_PROBLEM, xs_init_target(), XT_INV_PROTO, xt_params, XT_STANDARD_TARGET, xtables_calloc(), xtables_error, xtables_find_match(), xtables_find_target(), xtables_free_opts(), xtables_ip6parse_multiple(), xtables_load_ko(), xtables_lock(), xtables_matches, xtables_modprobe_program, xtables_option_mfcall(), xtables_option_tfcall(), xtables_parse_interface(), xtables_parse_protocol(), xtables_rule_matches_free(), xtables_targets, XTF_LOAD_MUST_SUCCEED, and XTF_TRY_LOAD.

Referenced by ip6tables_main(), and ip6tables_restore_main().

Here is the call graph for this function:

Here is the caller graph for this function:

int flush_entries6 ( const xt_chainlabel  chain,
int  verbose,
struct xtc_handle handle 
)

References for_each_chain6(), and ip6tc_flush_entries().

Referenced by do_command6(), and ip6tables_restore_main().

Here is the call graph for this function:

Here is the caller graph for this function:

int for_each_chain6 ( int(*)(const xt_chainlabel, int, struct xtc_handle *)  fn,
int  verbose,
int  builtinstoo,
struct xtc_handle handle 
)

References ip6tc_builtin(), ip6tc_first_chain(), ip6tc_next_chain(), and xtables_malloc().

Referenced by delete_chain6(), flush_entries6(), and ip6tables_restore_main().

Here is the call graph for this function:

Here is the caller graph for this function:

void format ( printf  ,
,
 
)
void ip6tables_exit_error ( enum xtables_exittype  status,
const char *  msg,
  ... 
)

References exit_tryhelp(), PARAMETER_PROBLEM, prog_name, prog_vers, VERSION_PROBLEM, and xtables_free_opts().

Here is the call graph for this function:

Variable Documentation

struct xtables_globals ip6tables_globals
Initial value:
= {
.option_offset = 0,
.program_version = IPTABLES_VERSION,
.orig_opts = original_opts,
.exit_err = ip6tables_exit_error,
}
void ip6tables_exit_error(enum xtables_exittype status, const char *msg,...) __attribute__((noreturn
Definition: ip6tables.c:275
int xtables_compatible_revision(const char *name, uint8_t revision, int opt)
Definition: xtables.c:742

Referenced by do_command6(), ip6tables_main(), ip6tables_restore_main(), and ip6tables_save_main().