netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
xtoptions.c File Reference
#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"
Include dependency graph for xtoptions.c:

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_lmapxtables_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...
 

Macro Definition Documentation

#define IPTOS_NORMALSVC   0
#define XTOPT_MKPTR (   cb)    ((void *)((char *)(cb)->data + (cb)->entry->ptroff))

Function Documentation

void xtables_lmap_free ( struct xtables_lmap head)

References xtables_lmap::name, xtables_lmap::next, and NULL.

Referenced by xtables_lmap_init().

Here is the caller graph for this function:

const char* xtables_lmap_id2name ( const struct xtables_lmap head,
int  id 
)
struct xtables_lmap* xtables_lmap_init ( const char *  file)

References buf, id, NULL, and xtables_lmap_free().

Here is the call graph for this function:

int xtables_lmap_name2id ( const struct xtables_lmap head,
const char *  name 
)
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().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

void xtables_option_mpcall ( unsigned int  c,
char **  argv,
bool  invert,
struct xtables_match m,
void *  fw 
)
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().

Here is the call graph for this function:

Here is the caller graph for this function:

void xtables_option_tpcall ( unsigned int  c,
char **  argv,
bool  invert,
struct xtables_target t,
void *  fw 
)
void xtables_options_fcheck ( const char *  name,
unsigned int  xflags,
const struct xt_option_entry table 
)
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().

Here is the call graph for this function:

Here is the caller graph for this function: