NPF(3) | NetBSD Library Functions Manual | NPF(3) |
nl_config_t *
npf_config_create(void);
int
npf_config_submit(nl_config_t *ncf, int fd);
void
npf_config_destroy(nl_config_t *ncf);
nl_rule_t *
npf_rule_create(char *name, uint32_t attr, u_int if_idx);
int
npf_rule_setcode(nl_rule_t *rl, int type, const void *code, size_t sz);
bool
npf_rule_exists_p(nl_config_t *ncf, const char *name);
int
npf_rule_insert(nl_config_t *ncf, nl_rule_t *parent, nl_rule_t *rl, pri_t pri);
int
npf_rule_setproc(nl_config_t *ncf, nl_rule_t *rl, const char *name);
void
npf_rule_destroy(nl_rule_t *rl);
nl_rproc_t *
npf_rproc_create(char *name);
bool
npf_rproc_exists_p(nl_config_t *ncf, const char *name);
int
npf_rproc_insert(nl_config_t *ncf, nl_rproc_t *rp);
nl_nat_t *
npf_nat_create(int type, int flags, u_int if_idx, npf_addr_t *addr, int af, in_port_t port);
int
npf_nat_insert(nl_config_t *ncf, nl_nat_t *nt, pri_t pri);
nl_table_t *
npf_table_create(int index, int type);
int
npf_table_add_entry(nl_table_t *tl, in_addr_t addr, in_addr_t mask);
bool
npf_table_exists_p(nl_config_t *ncf, u_int tid);
int
npf_table_insert(nl_config_t *ncf, nl_table_t *tl);
void
npf_table_destroy(nl_table_t *tl);
int
npf_update_rule(int fd, char *rname, nl_rule_t *rl);
int
npf_sessions_send(int fd, const char *fpath);
int
npf_sessions_recv(int fd, const char *fpath);
Interface is specified by if_idx, which is a numeral representation of an interface, given by if_nametoindex(3). Zero indicates any interface.
Priority is the order of the rule in the ruleset. Lower value means first to process, higher value - last to process. If multiple rules have the same priority - order is unspecified. A special constant NPF_PRI_NEXT may be passed to use the value of last used priority incremented by 1.
A bi-directional NAT is obtained by combining two policies. The following flags are supported:
Translation address is specified by addr, and its family by fa. Family must be either AF_INET for IPv4 or AF_INET6 for IPv6 address.
March 22, 2011 | NetBSD 5.99 |