EDGESEC
0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
|
File containing the implementation of the IP tables utilities. More...
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <limits.h>
#include "allocs.h"
#include "iface_mapper.h"
#include "iptables.h"
#include "log.h"
#include "net.h"
#include "os.h"
Data Structures | |
struct | iptables_columns |
Macros | |
#define | BASIC_FLUSH_COMMANDS |
Functions | |
struct iptables_columns | process_rule_column (char *column) |
int | process_rule_lines (struct iptables_context *ctx, char *rule_str) |
void | list_rule_cb (void *ctx, void *buf, size_t count) |
int | run_iptables (struct iptables_context *ctx, const char *const argv[], process_callback_fn fn) |
int | flush_iptables (struct iptables_context *ctx) |
int | add_baseif_rules (struct iptables_context *ctx, UT_array *ifinfo_array) |
void | iptables_free (struct iptables_context *ctx) |
Free the iptables context. More... | |
struct iptables_context * | iptables_init (const char *path, UT_array *ifinfo_array, bool exec_iptables) |
Initialises the iptables rules list. More... | |
int | get_filter_rules (struct iptables_context *ctx) |
int | get_nat_rules (struct iptables_context *ctx) |
long | find_rule (UT_array *rlist, const char *sip, const char *sif, const char *dip, const char *dif, const char *target) |
int | delete_bridge_rule (struct iptables_context *ctx, const char *sip, const char *sif, const char *dip, const char *dif) |
int | iptables_delete_bridge (struct iptables_context *ctx, const char *sip, const char *sif, const char *dip, const char *dif) |
Delete a bridge rule. More... | |
long | find_baseif_rulenum (UT_array *rlist, const char *ifname) |
int | add_bridge_rule (struct iptables_context *ctx, const char *sip, const char *sif, const char *dip, const char *dif) |
int | iptables_add_bridge (struct iptables_context *ctx, char *sip, char *sif, char *dip, char *dif) |
Add a bridge rule to the list of rules. More... | |
int | iptables_delete_nat (struct iptables_context *ctx, char *sip, char *sif, char *nif) |
Delete a NAT rule. More... | |
int | iptables_add_nat (struct iptables_context *ctx, char *sip, char *sif, char *nif) |
Add a NAT rule. More... | |
File containing the implementation of the IP tables utilities.
#define BASIC_FLUSH_COMMANDS |
int add_baseif_rules | ( | struct iptables_context * | ctx, |
UT_array * | ifinfo_array | ||
) |
int add_bridge_rule | ( | struct iptables_context * | ctx, |
const char * | sip, | ||
const char * | sif, | ||
const char * | dip, | ||
const char * | dif | ||
) |
int delete_bridge_rule | ( | struct iptables_context * | ctx, |
const char * | sip, | ||
const char * | sif, | ||
const char * | dip, | ||
const char * | dif | ||
) |
long find_baseif_rulenum | ( | UT_array * | rlist, |
const char * | ifname | ||
) |
long find_rule | ( | UT_array * | rlist, |
const char * | sip, | ||
const char * | sif, | ||
const char * | dip, | ||
const char * | dif, | ||
const char * | target | ||
) |
int flush_iptables | ( | struct iptables_context * | ctx | ) |
int get_filter_rules | ( | struct iptables_context * | ctx | ) |
int get_nat_rules | ( | struct iptables_context * | ctx | ) |
int iptables_add_bridge | ( | struct iptables_context * | ctx, |
char * | sip, | ||
char * | sif, | ||
char * | dip, | ||
char * | dif | ||
) |
Add a bridge rule to the list of rules.
ctx | The iptables context |
sip | Source IP string |
sif | Source interface name string |
dip | Destination IP string |
dif | Destination interface name string |
int iptables_add_nat | ( | struct iptables_context * | ctx, |
char * | sip, | ||
char * | sif, | ||
char * | nif | ||
) |
Add a NAT rule.
ctx | The iptables context |
sip | Source IP string |
sif | Source interface name string |
nif | NAT interface name string |
int iptables_delete_bridge | ( | struct iptables_context * | ctx, |
const char * | sip, | ||
const char * | sif, | ||
const char * | dip, | ||
const char * | dif | ||
) |
Delete a bridge rule.
ctx | The iptables context |
sip | Source IP string |
sif | Source interface name string |
dip | Destination IP string |
dif | Destination interface name string |
int iptables_delete_nat | ( | struct iptables_context * | ctx, |
char * | sip, | ||
char * | sif, | ||
char * | nif | ||
) |
Delete a NAT rule.
ctx | The iptables context |
sip | Source IP string |
sif | Source interface name string |
nif | NAT interface name string |
void iptables_free | ( | struct iptables_context * | ctx | ) |
Free the iptables context.
ctx | The iptables context |
struct iptables_context* iptables_init | ( | const char * | path, |
UT_array * | ifinfo_array, | ||
bool | exec_iptables | ||
) |
Initialises the iptables rules list.
path | The iptables binary path |
ifinfo_array | Array of interface configuration info structure |
exec_iptables | Execute the iptables command |
void list_rule_cb | ( | void * | ctx, |
void * | buf, | ||
size_t | count | ||
) |
struct iptables_columns process_rule_column | ( | char * | column | ) |
int process_rule_lines | ( | struct iptables_context * | ctx, |
char * | rule_str | ||
) |
int run_iptables | ( | struct iptables_context * | ctx, |
const char *const | argv[], | ||
process_callback_fn | fn | ||
) |