Searched refs:npf (Results 1 - 25 of 92) sorted by relevance

1234

/netbsd-current/sys/net/npf/
H A Dnpf_if.c34 * NPF uses its own interface IDs (npf-if-id). These IDs start from 1.
74 #define NPF_IFMAP_SLOT2ID(npf, slot) ((npf)->ifmap_off + (slot) + 1)
75 #define NPF_IFMAP_ID2SLOT(npf, id) \
76 ((id) - atomic_load_relaxed(&(npf)->ifmap_off) - 1)
79 npf_ifmap_init(npf_t *npf, const npf_ifops_t *ifops) argument
84 ifops->flush(npf, (void *)(uintptr_t)0);
86 mutex_init(&npf->ifmap_lock, MUTEX_DEFAULT, IPL_SOFTNET);
87 npf->ifmap = kmem_zalloc(nbytes, KM_SLEEP);
88 npf
94 npf_ifmap_fini(npf_t *npf) argument
102 npf_ifmap_lookup(npf_t *npf, const char *ifname) argument
124 npf_ifmap_register(npf_t *npf, const char *ifname) argument
156 npf_ifmap_flush(npf_t *npf) argument
188 npf_ifmap_getid(npf_t *npf, const ifnet_t *ifp) argument
199 npf_ifmap_copylogname(npf_t *npf, unsigned id, char *buf, size_t len) argument
218 npf_ifmap_copyname(npf_t *npf, unsigned id, char *buf, size_t len) argument
226 npfk_ifmap_attach(npf_t *npf, ifnet_t *ifp) argument
238 npfk_ifmap_detach(npf_t *npf, ifnet_t *ifp) argument
[all...]
H A Dnpf_conf.c64 npf_config_init(npf_t *npf) argument
68 mutex_init(&npf->config_lock, MUTEX_DEFAULT, IPL_SOFTNET);
80 npf_config_load(npf, nc, NULL, true);
81 KASSERT(npf->config != NULL);
113 npf_config_fini(npf_t *npf) argument
118 mutex_enter(&npf->config_lock);
119 npf_conn_tracking(npf, false);
120 npf_ebr_full_sync(npf->ebr);
121 npf_conn_load(npf, cd, false);
122 npf_ifmap_flush(npf);
134 npf_config_load(npf_t *npf, npf_config_t *nc, npf_conndb_t *conns, bool flush) argument
199 npf_config_enter(npf_t *npf) argument
206 npf_config_exit(npf_t *npf) argument
212 npf_config_locked_p(npf_t *npf) argument
218 npf_config_sync(npf_t *npf) argument
229 npf_config_read_enter(npf_t *npf) argument
236 npf_config_read_exit(npf_t *npf, int s) argument
247 npf_config_ruleset(npf_t *npf) argument
255 npf_config_natset(npf_t *npf) argument
263 npf_config_tableset(npf_t *npf) argument
271 npf_default_pass(npf_t *npf) argument
[all...]
H A Dnpf.c36 __KERNEL_RCSID(0, "$NetBSD: npf.c,v 1.44 2020/08/27 18:50:25 riastradh Exp $");
78 npf_t *npf; local
80 npf = kmem_zalloc(sizeof(npf_t), KM_SLEEP);
81 npf->ebr = npf_ebr_create();
82 npf->stats_percpu = percpu_alloc(NPF_STATS_SIZE);
83 npf->mbufops = mbufops;
84 npf->arg = arg;
86 npf_param_init(npf);
87 npf_state_sysinit(npf);
88 npf_ifmap_init(npf, ifop
104 npfk_destroy(npf_t *npf) argument
135 npfk_load(npf_t *npf, const void *config_ref, npf_error_t *err) argument
149 npfk_gc(npf_t *npf) argument
155 npfk_thread_register(npf_t *npf) argument
161 npfk_thread_unregister(npf_t *npf) argument
168 npfk_getarg(npf_t *npf) argument
174 npf_setkernctx(npf_t *npf) argument
190 npf_stats_inc(npf_t *npf, npf_stats_t st) argument
198 npf_stats_dec(npf_t *npf, npf_stats_t st) argument
230 npfk_stats(npf_t *npf, uint64_t *buf) argument
238 npfk_stats_clear(npf_t *npf) argument
[all...]
H A Dnpf_alg.c71 npf_alg_init(npf_t *npf) argument
76 npf->algset = aset;
80 npf_alg_fini(npf_t *npf) argument
82 npf_algset_t *aset = npf->algset;
88 npf_alg_lookup(npf_t *npf, const char *name) argument
90 npf_algset_t *aset = npf->algset;
92 KASSERT(npf_config_locked_p(npf));
105 npf_alg_construct(npf_t *npf, const char *name) argument
109 npf_config_enter(npf);
110 if ((alg = npf_alg_lookup(npf, nam
130 npf_alg_register(npf_t *npf, const char *name, const npfa_funcs_t *funcs) argument
180 npf_alg_unregister(npf_t *npf, npf_alg_t *alg) argument
221 npf_t *npf = npc->npc_ctx; local
257 npf_t *npf = npc->npc_ctx; local
296 npf_t *npf = npc->npc_ctx; local
321 npf_alg_destroy(npf_t *npf, npf_alg_t *alg, npf_nat_t *nat, npf_conn_t *con) argument
336 npf_alg_export(npf_t *npf, nvlist_t *nvl) argument
[all...]
H A Dnpf_ifaddr.c50 lookup_ifnet_table(npf_t *npf, ifnet_t *ifp) argument
52 const npf_ifops_t *ifops = npf->ifops;
60 ifname = ifops->getname(npf, ifp);
64 nc = npf_config_enter(npf);
82 npf_config_exit(npf);
88 replace_ifnet_table(npf_t *npf, npf_table_t *newt) argument
90 npf_tableset_t *ts = atomic_load_relaxed(&npf->config)->tableset;
93 KASSERT(npf_config_locked_p(npf));
101 npf_config_sync(npf);
102 npf_config_exit(npf);
109 npf_ifaddr_sync(npf_t *npf, ifnet_t *ifp) argument
154 npf_ifaddr_flush(npf_t *npf, ifnet_t *ifp) argument
169 npf_ifaddr_syncall(npf_t *npf) argument
[all...]
H A Dnpf_worker.c51 LIST_HEAD(, npf) instances;
132 npf_worker_addfunc(npf_t *npf, npf_workfunc_t work) argument
134 KASSERTMSG(npf->worker_flags == 0,
138 if (npf->worker_funcs[i] == NULL) {
139 npf->worker_funcs[i] = work;
147 npf_worker_signal(npf_t *npf) argument
151 if ((npf->worker_flags & WFLAG_ACTIVE) == 0) {
165 npf_worker_enlist(npf_t *npf) argument
169 KASSERT(npf->worker_flags == 0);
175 LIST_INSERT_HEAD(&winfo->instances, npf, worker_entr
186 npf_worker_discharge(npf_t *npf) argument
212 remove_npf_instance(npf_workerinfo_t *winfo, npf_t *npf) argument
233 process_npf_instance(npf_workerinfo_t *winfo, npf_t *npf) argument
271 npf_t *npf; local
[all...]
H A DMakefile7 INCS= npf.h
H A Dnpf_os.c81 MODULE(MODULE_CLASS_MISC, npf, "bpf");
83 /* This module autoloads via /dev/npf so it needs to be a driver */
84 MODULE(MODULE_CLASS_DRIVER, npf, "bpf");
137 npf_t *npf = npf_getkernctx(); local
144 npfk_destroy(npf);
152 npf_t *npf; local
158 npf = npfk_create(0, NULL, &kern_ifops, NULL);
159 npf_setkernctx(npf);
165 /* Attach /dev/npf device. */
166 error = devsw_attach("npf", NUL
222 npf_stats_export(npf_t *npf, void *data) argument
257 npf_t *npf = npf_getkernctx(); local
389 npf_t *npf = npf_getkernctx(); local
399 npf_t *npf = npf_getkernctx(); local
417 npf_t *npf = npf_getkernctx(); local
443 npf_t *npf = npf_getkernctx(); local
512 npf_t *npf = npf_getkernctx(); local
[all...]
H A Dnpf_params.c53 npf_param_general_register(npf_t *npf) argument
58 &npf->ip4_reassembly,
64 &npf->ip6_reassembly,
69 npf_param_register(npf, param_map, __arraycount(param_map));
90 npf_param_init(npf_t *npf) argument
96 npf->paraminfo = paraminfo;
99 npf_param_general_register(npf);
103 npf_param_fini(npf_t *npf) argument
105 npf_paraminfo_t *pinfo = npf->paraminfo;
135 npf_params_export(const npf_t *npf, nvlist_ argument
161 npf_param_allocgroup(npf_t *npf, npf_paramgroup_t group, size_t len) argument
169 npf_param_freegroup(npf_t *npf, npf_paramgroup_t group, size_t len) argument
179 npf_param_register(npf_t *npf, npf_param_t *params, unsigned count) argument
224 npf_param_lookup(npf_t *npf, const char *name) argument
232 npf_param_check(npf_t *npf, const char *name, int val) argument
246 npfk_param_get(npf_t *npf, const char *name, int *val) argument
258 npfk_param_set(npf_t *npf, const char *name, int val) argument
[all...]
H A Dnpf_rproc.c81 npf_ext_init(npf_t *npf) argument
83 mutex_init(&npf->ext_lock, MUTEX_DEFAULT, IPL_NONE);
84 LIST_INIT(&npf->ext_list);
88 npf_ext_fini(npf_t *npf) argument
90 KASSERT(LIST_EMPTY(&npf->ext_list));
91 mutex_destroy(&npf->ext_lock);
102 npf_ext_lookup(npf_t *npf, const char *name, bool autoload) argument
108 KASSERT(mutex_owned(&npf->ext_lock));
111 LIST_FOREACH(ext, &npf->ext_list, ext_entry)
118 mutex_exit(&npf
130 npf_ext_register(npf_t *npf, const char *name, const npf_ext_ops_t *ops) argument
151 npf_ext_unregister(npf_t *npf, void *extid) argument
176 npf_ext_construct(npf_t *npf, const char *name, npf_rproc_t *rp, const nvlist_t *params) argument
[all...]
H A Dnpf_handler.c71 #define m_freem(m) npf->mbufops->free(m)
82 npf_reassembly(npf_t *npf, npf_cache_t *npc, bool *mff) argument
91 if (npf_iscached(npc, NPC_IP4) && npf->ip4_reassembly) {
93 } else if (npf_iscached(npc, NPC_IP6) && npf->ip6_reassembly) {
105 npf_stats_inc(npf, NPF_STAT_REASSFAIL);
112 npf_stats_inc(npf, NPF_STAT_FRAGMENTS);
121 nbuf_init(npf, nbuf, m, nbuf->nb_ifp);
127 npf_stats_inc(npf, NPF_STAT_REASSEMBLY);
144 npfk_packet_handler(npf_t *npf, struct mbuf **mp, ifnet_t *ifp, int di) argument
161 nbuf_init(npf,
[all...]
H A Dnpf_ext_rndblock.c138 npf_ext_rndblock_init(npf_t *npf) argument
152 npf_ext_rndblock_id = npf_ext_register(npf, "rndblock",
158 npf_ext_rndblock_fini(npf_t *npf) argument
164 return npf_ext_unregister(npf, npf_ext_rndblock_id);
174 npf_t *npf = npf_getkernctx(); local
178 return npf_ext_rndblock_init(npf);
180 return npf_ext_rndblock_fini(npf);
H A Dnpf_conndb.c100 npf_conndb_sysinit(npf_t *npf) argument
102 npf_conndb_params_t *params = npf_param_allocgroup(npf,
124 npf_param_register(npf, param_map, __arraycount(param_map));
128 npf_conndb_sysfini(npf_t *npf) argument
131 npf_param_freegroup(npf, NPF_PARAMS_CONNDB, len);
164 npf_conndb_lookup(npf_t *npf, const npf_connkey_t *ck, npf_flow_t *flow) argument
166 npf_conndb_t *cd = atomic_load_relaxed(&npf->conn_db);
174 int s = npf_config_read_enter(npf);
177 npf_config_read_exit(npf, s);
193 npf_config_read_exit(npf,
302 npf_conndb_gc_incr(npf_t *npf, npf_conndb_t *cd, const time_t now) argument
373 gc_freq_tune(const npf_t *npf, const npf_conndb_t *cd, const unsigned n) argument
389 npf_conndb_gc(npf_t *npf, npf_conndb_t *cd, bool flush, bool sync) argument
[all...]
H A Dnpf_conn.c149 npf_conn_init(npf_t *npf) argument
151 npf_conn_params_t *params = npf_param_allocgroup(npf,
167 npf_param_register(npf, param_map, __arraycount(param_map));
169 npf->conn_cache[0] = pool_cache_init(
172 npf->conn_cache[1] = pool_cache_init(
176 mutex_init(&npf->conn_lock, MUTEX_DEFAULT, IPL_NONE);
177 atomic_store_relaxed(&npf->conn_tracking, CONN_TRACKING_OFF);
178 npf->conn_db = npf_conndb_create();
179 npf_conndb_sysinit(npf);
181 npf_worker_addfunc(npf, npf_conn_worke
185 npf_conn_fini(npf_t *npf) argument
209 npf_conn_load(npf_t *npf, npf_conndb_t *ndb, bool track) argument
249 npf_conn_tracking(npf_t *npf, bool track) argument
259 const npf_t *npf = npc->npc_ctx; local
328 npf_t *npf = npc->npc_ctx; local
426 npf_t *npf = npc->npc_ctx; local
528 npf_conn_destroy(npf_t *npf, npf_conn_t *con) argument
568 npf_t *npf = npc->npc_ctx; local
713 npf_conn_expired(npf_t *npf, const npf_conn_t *con, uint64_t tsnow) argument
762 npf_conn_worker(npf_t *npf) argument
773 npf_conndb_export(npf_t *npf, nvlist_t *nvl) argument
811 npf_conn_export(npf_t *npf, npf_conn_t *con, nvlist_t *nvl) argument
855 npf_conn_import(npf_t *npf, npf_conndb_t *cd, const nvlist_t *cdict, npf_ruleset_t *natlist) argument
942 npf_conn_find(npf_t *npf, const nvlist_t *req, nvlist_t *resp) argument
[all...]
H A Dnpf_state.c92 npf_state_sysinit(npf_t *npf) argument
94 npf_state_params_t *params = npf_param_allocgroup(npf,
125 npf_param_register(npf, param_map, __arraycount(param_map));
126 npf_state_tcp_sysinit(npf);
130 npf_state_sysfini(npf_t *npf) argument
133 npf_param_freegroup(npf, NPF_PARAMS_GENERIC_STATE, len);
134 npf_state_tcp_sysfini(npf);
216 npf_state_etime(npf_t *npf, const npf_state_t *nst, const int proto) argument
225 timeout = npf_state_tcp_timeout(npf, nst);
230 params = npf
[all...]
/netbsd-current/share/examples/npf/
H A DMakefile8 FILES= host-npf.conf soho_gw-npf.conf hashtablefile treetablefile
9 FILES+= l2tp_gw-npf.conf
10 FILESDIR= /usr/share/examples/npf
/netbsd-current/lib/libnpf/
H A DMakefile7 LIB= npf
10 SRCS= npf.c
12 INCS= npf.h
19 CPPFLAGS.npf.c += -I${NVSRC_DISTPATH}
/netbsd-current/etc/rc.d/
H A Dnpf_boot13 rcvar="npf"
19 if [ -f /etc/npf.boot.conf ]; then
20 /sbin/npfctl reload /etc/npf.boot.conf
21 elif [ -f /etc/defaults/npf.boot.conf ]; then
22 /sbin/npfctl reload /etc/defaults/npf.boot.conf
24 warn "can't load initial npf rules; npf start aborted."
33 load_rc_config_var npf npf
/netbsd-current/lib/npf/
H A Dmod.mk15 LIBDIR= ${LIBROOTDIR}/${MLIBDIR}/npf
17 SHLIBINSTALLDIR=${LIBROOTDIR}/${MLIBDIR}/npf
19 LIBDIR= ${LIBROOTDIR}/npf
21 SHLIBINSTALLDIR=${LIBROOTDIR}/npf
25 SRCS= npf${MOD}.c
26 LIBDPLIBS+= npf ${NETBSDSRCDIR}/lib/libnpf
/netbsd-current/tests/net/npf/
H A DMakefile6 TESTSDIR= ${TESTSBASE}/net/npf
10 FILES= ../../../usr.sbin/npf/npftest/npftest.conf
H A Dt_npf.sh32 atf_check -o ignore -e ignore npfctl debug -c "$(atf_get_srcdir)/npftest.conf" -o ./npf.plist
33 atf_check -o ignore npftest -c npf.plist -T "${name}"
/netbsd-current/usr.sbin/npf/
H A DMakefile11 MAN= npf.7 npf-params.7
/netbsd-current/usr.sbin/npf/npftest/libnpftest/
H A Dnpf_gc_test.c12 #include "npf.h"
68 npf_t *npf = npf_getkernctx(); local
72 npf->conn_db = cd;
97 npf_conndb_gc(npf, cd, false, false);
105 npf_conndb_gc(npf, cd, true, false);
107 npf->conn_db = NULL;
158 run_conndb_tests(npf_t *npf) argument
160 npf_conndb_t *orig_cd = npf->conn_db;
163 npf_config_enter(npf);
164 npf_conn_tracking(npf, tru
176 worker_test_task(npf_t *npf) argument
183 run_worker_tests(npf_t *npf) argument
255 npf_t *npf = npf_getkernctx(); local
[all...]
H A Dnpf_test_subr.c65 npf_t *npf; local
69 if ((npf = npf_getkernctx()) != NULL) {
70 npf_worker_discharge(npf);
74 npf = npfk_create(0, &npftest_mbufops, &npftest_ifops, NULL);
75 npfk_thread_register(npf);
76 npf_setkernctx(npf);
89 npf_t *npf = npf_getkernctx(); local
91 npfk_thread_unregister(npf);
92 npfk_destroy(npf);
116 npf_t *npf local
224 npf_t *npf = npf_getkernctx(); local
[all...]
H A Dnpf_rule_test.c62 npf_t *npf = npf_getkernctx(); local
71 slock = npf_config_read_enter(npf);
72 rl = npf_ruleset_inspect(npc, npf_config_ruleset(npf), t->di, NPF_LAYER_3);
79 npf_config_read_exit(npf, slock);
90 npf_t *npf = npf_getkernctx(); local
95 error = npfk_packet_handler(npf, &m, ifp, t->di);
105 npf_t *npf = npf_getkernctx(); local
111 rl = npf_rule_alloc(npf, rule);
145 npf_t *npf = npf_getkernctx(); local
158 npf_config_enter(npf);
[all...]

Completed in 250 milliseconds

1234