iptables configuration

Overview

// global functions

te_errno tapi_cfg_iptables_cmd(const char* ta, const char* ifname, const char* table, const char* chain, const char* rule);
te_errno tapi_cfg_iptables_cmd_fmt(const char* ta, const char* ifname, const char* table, const char* chain, const char* rule, ...);
te_errno tapi_cfg_iptables_chain_set(const char* ta, const char* ifname, const char* table, const char* chain, te_bool enable);
te_errno tapi_cfg_iptables_chain_add(const char* ta, const char* ifname, const char* table, const char* chain, te_bool enable);
te_errno tapi_cfg_iptables_chain_del(const char* ta, const char* ifname, const char* table, const char* chain);

// macros

#define TAPI_CFG_IPTABLES_CMD_LEN_MAX

Detailed Documentation

Global Functions

te_errno tapi_cfg_iptables_cmd(const char* ta, const char* ifname, const char* table, const char* chain, const char* rule)

Execute an iptables rule for the specific chain

Parameters:

ta

  • Test agent name

ifname

  • Interface name

table

  • Table to operate with (raw, filter, mangle, nat)

chain

  • Chain name to operate with (without prefix)

rule

  • Rule to add

Returns:

Status of the operation

te_errno tapi_cfg_iptables_cmd_fmt(const char* ta, const char* ifname, const char* table, const char* chain, const char* rule, ...)

Execute an iptables rule for the specific chain. The rule is specified using a format string with arguments.

Parameters:

ta

  • Test agent name

ifname

  • Interface name

table

  • Table to operate with (raw, filter, mangle, nat)

chain

  • Chain name to operate with (without prefix)

rule

  • Formatted argument to combine the rule

Returns:

Status of the operation

te_errno tapi_cfg_iptables_chain_set(const char* ta, const char* ifname, const char* table, const char* chain, te_bool enable)

Install or delete jumping rule for the per-interface chain

Parameters:

ta

  • Test agent name

ifname

  • Interface name

table

  • Table to operate with (raw, filter, mangle, nat)

chain

  • Chain name to operate with (without prefix)

enable

  • Install or delete jumping rule

Returns:

Status of the operation

te_errno tapi_cfg_iptables_chain_add(const char* ta, const char* ifname, const char* table, const char* chain, te_bool enable)

Add per-interface chain to the system

Parameters:

ta

  • Test agent name

ifname

  • Interface name

table

  • Table to operate with (raw, filter, mangle, nat)

chain

  • Chain name to operate with (without prefix)

enable

  • Install or not jumping rule to the built-in chain

Returns:

Status of the operation

te_errno tapi_cfg_iptables_chain_del(const char* ta, const char* ifname, const char* table, const char* chain)

Delete per-interface chain from the system

Parameters:

ta

  • Test agent name

ifname

  • Interface name

table

  • Table to operate with (raw, filter, mangle, nat)

chain

  • Chain name to operate with (without prefix)

Returns:

Status of the operation