#include <ctype.h>
#include <errno.h>
#include <getopt.h>
#include <limits.h>
#include <netdb.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <arpa/inet.h>
#include <netinet/ip.h>
#include "xtables.h"
#include "xshared.h"
Data Structures | |
struct | syslog_level |
Simple key-value pairs for syslog levels. More... | |
struct | tos_value_mask |
struct | tos_symbol_info |
Macros | |
#define | IPTOS_NORMALSVC 0 |
#define | XTOPT_MKPTR(cb) ((void *)((char *)(cb)->data + (cb)->entry->ptroff)) |
Functions | |
struct option * | xtables_options_xfrm (struct option *orig_opts, struct option *oldopts, const struct xt_option_entry *entry, unsigned int *offset) |
Creates getopt options from the x6-style option map, and assigns each a getopt id. More... | |
: name of extension | |
: accumulated flags : extension's option table Check that all option constraints have been met. This effectively replaces ->final_check of the older API. | |
void | xtables_options_fcheck (const char *name, unsigned int xflags, const struct xt_option_entry *table) |
void | xtables_option_tfcall (struct xtables_target *t) |
Dispatch arguments to the appropriate final_check function, based upon the extension's choice of API. More... | |
void | xtables_option_mfcall (struct xtables_match *m) |
Dispatch arguments to the appropriate final_check function, based upon the extension's choice of API. More... | |
struct xtables_lmap * | xtables_lmap_init (const char *file) |
void | xtables_lmap_free (struct xtables_lmap *head) |
int | xtables_lmap_name2id (const struct xtables_lmap *head, const char *name) |
const char * | xtables_lmap_id2name (const struct xtables_lmap *head, int id) |
: port name, or number as a string (e.g. "http" or "80") | |
Resolve a port name to a number. Returns the port number in integral form on success, or <0 on error. (errno will not be set.) | |
void | xtables_option_parse (struct xt_option_call *cb) |
The master option parsing routine. More... | |
void | xtables_option_metavalidate (const char *name, const struct xt_option_entry *entry) |
Verifies that an extension's option map descriptor is valid, and ought to be called right after the extension has been loaded, and before option merging/xfrm. More... | |
void | xtables_option_tpcall (unsigned int c, char **argv, bool invert, struct xtables_target *t, void *fw) |
: getopt id (i.e. More... | |
void | xtables_option_mpcall (unsigned int c, char **argv, bool invert, struct xtables_match *m, void *fw) |
: getopt id (i.e. More... | |
#define IPTOS_NORMALSVC 0 |
#define XTOPT_MKPTR | ( | cb | ) | ((void *)((char *)(cb)->data + (cb)->entry->ptroff)) |
void xtables_lmap_free | ( | struct xtables_lmap * | head | ) |
References xtables_lmap::name, xtables_lmap::next, and NULL.
Referenced by xtables_lmap_init().
const char* xtables_lmap_id2name | ( | const struct xtables_lmap * | head, |
int | id | ||
) |
References xtables_lmap::id, xtables_lmap::name, xtables_lmap::next, and NULL.
struct xtables_lmap* xtables_lmap_init | ( | const char * | file | ) |
int xtables_lmap_name2id | ( | const struct xtables_lmap * | head, |
const char * | name | ||
) |
References xtables_lmap::id, xtables_lmap::name, xtables_lmap::next, and NULL.
void xtables_option_metavalidate | ( | const char * | name, |
const struct xt_option_entry * | entry | ||
) |
Verifies that an extension's option map descriptor is valid, and ought to be called right after the extension has been loaded, and before option merging/xfrm.
References ARRAY_SIZE, xtables_globals::exit_err, xt_option_entry::flags, xt_option_entry::id, xt_option_entry::name, NULL, OTHER_PROBLEM, xt_option_entry::ptroff, xt_option_entry::size, xt_option_entry::type, XT_OPTION_OFFSET_SCALE, xt_params, and XTOPT_PUT.
Referenced by xtables_register_match(), and xtables_register_target().
void xtables_option_mfcall | ( | struct xtables_match * | m | ) |
Dispatch arguments to the appropriate final_check function, based upon the extension's choice of API.
References xt_entry_match::data, xt_fcheck_call::data, xt_fcheck_call::ext_name, xtables_match::final_check, xtables_match::m, xtables_match::mflags, xtables_match::name, NULL, xt_fcheck_call::udata, xtables_match::udata, xtables_match::x6_fcheck, xtables_match::x6_options, xt_fcheck_call::xflags, and xtables_options_fcheck().
Referenced by do_command4(), do_command6(), and do_commandx().
void xtables_option_mpcall | ( | unsigned int | c, |
char ** | argv, | ||
bool | invert, | ||
struct xtables_match * | m, | ||
void * | fw | ||
) |
: getopt id (i.e.
with offset) : struct ipt_entry or ip6t_entry
Dispatch arguments to the appropriate parse function, based upon the extension's choice of API.
References xt_option_call::arg, xt_entry_match::data, xt_option_call::data, xt_option_call::entry, xt_option_call::ext_name, xt_option_call::invert, xtables_match::m, xt_option_call::match, xtables_match::mflags, xtables_match::name, NULL, xtables_match::option_offset, OTHER_PROBLEM, xtables_match::parse, xt_option_call::udata, xtables_match::udata, xtables_match::x6_options, xtables_match::x6_parse, xt_option_call::xflags, xt_option_call::xt_entry, and xtables_error.
Referenced by command_default().
void xtables_option_parse | ( | struct xt_option_call * | cb | ) |
The master option parsing routine.
May be used for the ".x6_parse" function pointer in extensions if fully automatic parsing is desired. It may be also called manually from a custom x6_parse function.
References ARRAY_SIZE, xt_option_call::entry, xt_option_entry::excl, xtables_globals::exit_err, xt_option_call::ext_name, xt_option_entry::flags, xt_option_entry::id, xt_option_call::invert, xt_option_entry::name, NULL, xt_option_call::nvals, PARAMETER_PROBLEM, xt_option_entry::type, xt_option_call::xflags, xt_params, XTOPT_INVERT, XTOPT_MULTI, and XTTYPE_NONE.
void xtables_option_tfcall | ( | struct xtables_target * | t | ) |
Dispatch arguments to the appropriate final_check function, based upon the extension's choice of API.
References xt_entry_target::data, xt_fcheck_call::data, xt_fcheck_call::ext_name, xtables_target::final_check, xtables_target::name, NULL, xtables_target::t, xtables_target::tflags, xt_fcheck_call::udata, xtables_target::udata, xtables_target::x6_fcheck, xtables_target::x6_options, xt_fcheck_call::xflags, and xtables_options_fcheck().
Referenced by do_command4(), do_command6(), do_commandarp(), and do_commandx().
void xtables_option_tpcall | ( | unsigned int | c, |
char ** | argv, | ||
bool | invert, | ||
struct xtables_target * | t, | ||
void * | fw | ||
) |
: getopt id (i.e.
with offset) : struct ipt_entry or ip6t_entry
Dispatch arguments to the appropriate parse function, based upon the extension's choice of API.
References xt_option_call::arg, xt_entry_target::data, xt_option_call::data, xt_option_call::entry, xt_option_call::ext_name, xt_option_call::invert, xtables_target::name, NULL, xtables_target::option_offset, OTHER_PROBLEM, xtables_target::parse, xtables_target::t, xt_option_call::target, xtables_target::tflags, xt_option_call::udata, xtables_target::udata, xtables_target::x6_options, xtables_target::x6_parse, xt_option_call::xflags, xt_option_call::xt_entry, and xtables_error.
Referenced by command_default(), and do_commandarp().
void xtables_options_fcheck | ( | const char * | name, |
unsigned int | xflags, | ||
const struct xt_option_entry * | table | ||
) |
References xtables_globals::exit_err, xt_option_entry::flags, xt_option_entry::id, xt_option_entry::name, NULL, PARAMETER_PROBLEM, xt_params, and XTOPT_MAND.
Referenced by xtables_option_mfcall(), and xtables_option_tfcall().
struct option* xtables_options_xfrm | ( | struct option * | orig_opts, |
struct option * | oldopts, | ||
const struct xt_option_entry * | entry, | ||
unsigned int * | offset | ||
) |
Creates getopt options from the x6-style option map, and assigns each a getopt id.
References xt_option_entry::id, xt_option_entry::name, NULL, xtables_globals::option_offset, xt_option_entry::type, XT_OPTION_OFFSET_SCALE, xt_params, xtables_free_opts(), and XTTYPE_NONE.
Referenced by command_default().