Home
last modified time | relevance | path

Searched refs:npc (Results 1 – 25 of 68) sorted by relevance

123

/netbsd-src/sys/net/npf/
H A Dnpf_inet.c250 npf_tcpsaw(const npf_cache_t *npc, tcp_seq *seq, tcp_seq *ack, uint32_t *win) in npf_tcpsaw() argument
252 const struct tcphdr *th = npc->npc_l4.tcp; in npf_tcpsaw()
255 KASSERT(npf_iscached(npc, NPC_TCP)); in npf_tcpsaw()
262 if (npf_iscached(npc, NPC_IP4)) { in npf_tcpsaw()
263 const struct ip *ip = npc->npc_ip.v4; in npf_tcpsaw()
264 return ntohs(ip->ip_len) - npc->npc_hlen - thlen; in npf_tcpsaw()
265 } else if (npf_iscached(npc, NPC_IP6)) { in npf_tcpsaw()
266 const struct ip6_hdr *ip6 = npc->npc_ip.v6; in npf_tcpsaw()
268 (npc->npc_hlen - sizeof(*ip6)) - thlen; in npf_tcpsaw()
277 npf_fetch_tcpopts(npf_cache_t *npc, uint16_t *mss, int *wscale) in npf_fetch_tcpopts() argument
[all …]
H A Dnpf_alg_icmp.c74 npfa_icmp_match(npf_cache_t *npc, npf_nat_t *nt, int di) in npfa_icmp_match() argument
76 const int proto = npc->npc_proto; in npfa_icmp_match()
77 const struct ip *ip = npc->npc_ip.v4; in npfa_icmp_match()
80 KASSERT(npf_iscached(npc, NPC_IP46)); in npfa_icmp_match()
81 KASSERT(npf_iscached(npc, NPC_LAYER4)); in npfa_icmp_match()
90 const struct tcphdr *th = npc->npc_l4.tcp; in npfa_icmp_match()
95 const struct udphdr *uh = npc->npc_l4.udp; in npfa_icmp_match()
127 npfa_icmp4_inspect(const int type, npf_cache_t *npc, bool *hasqid) in npfa_icmp4_inspect() argument
129 nbuf_t *nbuf = npc->npc_nbuf; in npfa_icmp4_inspect()
142 return (npf_cache_all(npc) & NPC_LAYER4) != 0; in npfa_icmp4_inspect()
[all …]
H A Dnpf_sendpkt.c60 #define m_freem(m) (npc)->npc_ctx->mbufops->free(m)
61 #define mtod(m,t) ((t)((npc)->npc_ctx->mbufops->getdata(m)))
73 npf_ip6_setscope(const npf_cache_t *npc, struct ip6_hdr *ip6) in npf_ip6_setscope() argument
75 const struct ifnet *rcvif = npc->npc_nbuf->nb_ifp; in npf_ip6_setscope()
92 npf_return_tcp(npf_cache_t *npc) in npf_return_tcp() argument
94 npf_t *npf = npc->npc_ctx; in npf_return_tcp()
104 KASSERT(npf_iscached(npc, NPC_IP46)); in npf_return_tcp()
105 KASSERT(npf_iscached(npc, NPC_LAYER4)); in npf_return_tcp()
106 tcpdlen = npf_tcpsaw(npc, &seq, &ack, &win); in npf_return_tcp()
107 oth = npc->npc_l4.tcp; in npf_return_tcp()
[all …]
H A Dnpf_nat.c413 npf_nat_inspect(npf_cache_t *npc, const unsigned di) in npf_nat_inspect() argument
415 npf_t *npf = npc->npc_ctx; in npf_nat_inspect()
421 rl = npf_ruleset_inspect(npc, rlset, di, NPF_LAYER_3); in npf_nat_inspect()
433 npf_nat_algo_netmap(const npf_cache_t *npc, const npf_natpolicy_t *np, in npf_nat_algo_netmap() argument
436 const npf_addr_t *orig_addr = npc->npc_ips[which]; in npf_nat_algo_netmap()
443 npf_addr_mask(&np->n_taddr, np->n_tmask, npc->npc_alen, addr); in npf_nat_algo_netmap()
444 npf_addr_bitor(orig_addr, np->n_tmask, npc->npc_alen, addr); in npf_nat_algo_netmap()
448 npf_nat_getaddr(npf_cache_t *npc, npf_natpolicy_t *np, const unsigned alen) in npf_nat_getaddr() argument
464 npc->npc_ips[NPF_SRC], in npf_nat_getaddr()
465 npc->npc_ips[NPF_DST]); in npf_nat_getaddr()
[all …]
H A Dnpf_handler.c82 npf_reassembly(npf_t *npf, npf_cache_t *npc, bool *mff) in npf_reassembly() argument
84 nbuf_t *nbuf = npc->npc_nbuf; in npf_reassembly()
91 if (npf_iscached(npc, NPC_IP4) && npf->ip4_reassembly) { in npf_reassembly()
93 } else if (npf_iscached(npc, NPC_IP6) && npf->ip6_reassembly) { in npf_reassembly()
94 error = ip6_reass_packet(&m, npc->npc_hlen); in npf_reassembly()
122 npc->npc_info = 0; in npf_reassembly()
124 if (npf_cache_all(npc) & (NPC_IPFRAG|NPC_FMTERR)) { in npf_reassembly()
147 npf_cache_t npc; in npfk_packet_handler() local
162 memset(&npc, 0, sizeof(npf_cache_t)); in npfk_packet_handler()
163 npc.npc_ctx = npf; in npfk_packet_handler()
[all …]
H A Dnpf_bpf.c85 npf_bpf_prepare(npf_cache_t *npc, bpf_args_t *args, uint32_t *M) in npf_bpf_prepare() argument
87 nbuf_t *nbuf = npc->npc_nbuf; in npf_bpf_prepare()
101 args->arg = npc; in npf_bpf_prepare()
111 const u_int alen = npc->npc_alen; in npf_bpf_prepare()
121 M[BPF_MW_L4OFF] = npc->npc_hlen; in npf_bpf_prepare()
122 M[BPF_MW_L4PROTO] = npc->npc_proto; in npf_bpf_prepare()
156 const npf_cache_t * const npc = (const npf_cache_t *)args->arg; in npf_cop_l3() local
157 const uint32_t ver = (npc->npc_alen & 4) | ((npc->npc_alen >> 4) * 6); in npf_cop_l3()
161 M[BPF_MW_L4OFF] = npc->npc_hlen; in npf_cop_l3()
162 M[BPF_MW_L4PROTO] = npc->npc_proto; in npf_cop_l3()
[all …]
H A Dnpf_conn.c257 npf_conn_trackable_p(const npf_cache_t *npc) in npf_conn_trackable_p() argument
259 const npf_t *npf = npc->npc_ctx; in npf_conn_trackable_p()
268 if (!npf_iscached(npc, NPC_IP46) || !npf_iscached(npc, NPC_LAYER4)) { in npf_conn_trackable_p()
326 npf_conn_lookup(const npf_cache_t *npc, const unsigned di, npf_flow_t *flow) in npf_conn_lookup() argument
328 npf_t *npf = npc->npc_ctx; in npf_conn_lookup()
329 const nbuf_t *nbuf = npc->npc_nbuf; in npf_conn_lookup()
334 if (!npf_conn_conkey(npc, &key, di, NPF_FLOW_FORW)) { in npf_conn_lookup()
341 KASSERT(npc->npc_proto == atomic_load_relaxed(&con->c_proto)); in npf_conn_lookup()
360 npf_conn_inspect(npf_cache_t *npc, const unsigned di, int *error) in npf_conn_inspect() argument
362 nbuf_t *nbuf = npc->npc_nbuf; in npf_conn_inspect()
[all …]
H A Dnpf_ext_normalize.c103 npf_normalize_ip4(npf_cache_t *npc, npf_normalize_t *np) in npf_normalize_ip4() argument
105 struct ip *ip = npc->npc_ip.v4; in npf_normalize_ip4()
144 npf_normalize(npf_cache_t *npc, void *params, const npf_match_info_t *mi, in npf_normalize() argument
160 if (npf_iscached(npc, NPC_IP4) && (np->n_random_id || np->n_minttl)) { in npf_normalize()
161 npf_normalize_ip4(npc, np); in npf_normalize()
163 th = npc->npc_l4.tcp; in npf_normalize()
169 if (maxmss == 0 || !npf_iscached(npc, NPC_TCP) || in npf_normalize()
175 if (!npf_fetch_tcpopts(npc, &mss, &wscale)) { in npf_normalize()
191 if (npf_set_mss(npc, maxmss, old, new, &mid) && in npf_normalize()
192 !nbuf_cksum_barrier(npc->npc_nbuf, mi->mi_di)) { in npf_normalize()
[all …]
H A Dnpf_connkey.c226 npf_conn_conkey(const npf_cache_t *npc, npf_connkey_t *key, in npf_conn_conkey() argument
229 const npf_conn_params_t *params = npc->npc_ctx->params[NPF_PARAMS_CONN]; in npf_conn_conkey()
230 const nbuf_t *nbuf = npc->npc_nbuf; in npf_conn_conkey()
231 const unsigned proto = npc->npc_proto; in npf_conn_conkey()
232 const unsigned alen = npc->npc_alen; in npf_conn_conkey()
238 if (npc->npc_ckey) { in npf_conn_conkey()
243 return npf_connkey_copy(npc->npc_ckey, key, invert); in npf_conn_conkey()
248 KASSERT(npf_iscached(npc, NPC_TCP)); in npf_conn_conkey()
249 th = npc->npc_l4.tcp; in npf_conn_conkey()
254 KASSERT(npf_iscached(npc, NPC_UDP)); in npf_conn_conkey()
[all …]
H A Dnpf_state_tcp.c292 npf_tcp_inwindow(npf_cache_t *npc, npf_state_t *nst, const npf_flow_t flow) in npf_tcp_inwindow() argument
295 const struct tcphdr * const th = npc->npc_l4.tcp; in npf_tcp_inwindow()
302 params = npc->npc_ctx->params[NPF_PARAMS_TCP_STATE]; in npf_tcp_inwindow()
303 KASSERT(npf_iscached(npc, NPC_TCP)); in npf_tcp_inwindow()
323 tcpdlen = npf_tcpsaw(__UNCONST(npc), &seq, &ack, &win); in npf_tcp_inwindow()
358 (void)npf_fetch_tcpopts(npc, NULL, &fstate->nst_wscale); in npf_tcp_inwindow()
378 (void)npf_fetch_tcpopts(npc, NULL, &fstate->nst_wscale); in npf_tcp_inwindow()
408 npf_stats_inc(npc->npc_ctx, NPF_STAT_INVALID_STATE_TCP1); in npf_tcp_inwindow()
414 npf_stats_inc(npc->npc_ctx, NPF_STAT_INVALID_STATE_TCP2); in npf_tcp_inwindow()
425 npf_stats_inc(npc->npc_ctx, NPF_STAT_INVALID_STATE_TCP3); in npf_tcp_inwindow()
[all …]
H A Dnpf_state.c145 npf_state_init(npf_cache_t *npc, npf_state_t *nst) in npf_state_init() argument
147 const int proto = npc->npc_proto; in npf_state_init()
150 KASSERT(npf_iscached(npc, NPC_IP46)); in npf_state_init()
151 KASSERT(npf_iscached(npc, NPC_LAYER4)); in npf_state_init()
158 ret = npf_state_tcp(npc, nst, NPF_FLOW_FORW); in npf_state_init()
187 npf_state_inspect(npf_cache_t *npc, npf_state_t *nst, const npf_flow_t flow) in npf_state_inspect() argument
189 const int proto = npc->npc_proto; in npf_state_inspect()
195 ret = npf_state_tcp(npc, nst, flow); in npf_state_inspect()
H A Dnpf_alg.c219 npf_alg_match(npf_cache_t *npc, npf_nat_t *nt, int di) in npf_alg_match() argument
221 npf_t *npf = npc->npc_ctx; in npf_alg_match()
227 KASSERTMSG(npf_iscached(npc, NPC_IP46), "expecting protocol number"); in npf_alg_match()
236 if (match_func && match_func(npc, nt, di)) { in npf_alg_match()
255 npf_alg_exec(npf_cache_t *npc, npf_nat_t *nt, const npf_flow_t flow) in npf_alg_exec() argument
257 npf_t *npf = npc->npc_ctx; in npf_alg_exec()
270 translate_func(npc, nt, flow); in npf_alg_exec()
294 npf_alg_conn(npf_cache_t *npc, int di) in npf_alg_conn() argument
296 npf_t *npf = npc->npc_ctx; in npf_alg_conn()
309 if (inspect_func && (con = inspect_func(npc, di)) != NULL) { in npf_alg_conn()
H A Dnpf_ext_log.c83 npf_log(npf_cache_t *npc, void *meta, const npf_match_info_t *mi, int *decision) in npf_log() argument
85 struct mbuf *m = nbuf_head_mbuf(npc->npc_nbuf); in npf_log()
93 if (npf_iscached(npc, NPC_IP4)) { in npf_log()
95 } else if (npf_iscached(npc, NPC_IP6)) { in npf_log()
106 struct nbuf *nb = npc->npc_nbuf; in npf_log()
107 npf_ifmap_copyname(npc->npc_ctx, nb ? nb->nb_ifid : 0, in npf_log()
H A Dnpf_rproc.c366 npf_rproc_run(npf_cache_t *npc, npf_rproc_t *rp, const npf_match_info_t *mi, in npf_rproc_run() argument
371 KASSERT(!nbuf_flag_p(npc->npc_nbuf, NBUF_DATAREF_RESET)); in npf_rproc_run()
380 if (!extops->proc(npc, rp->rp_ext_meta[i], mi, decision)) { in npf_rproc_run()
384 if (nbuf_flag_p(npc->npc_nbuf, NBUF_DATAREF_RESET)) { in npf_rproc_run()
385 npf_recache(npc); in npf_rproc_run()
/netbsd-src/usr.sbin/npf/npftest/libnpftest/
H A Dnpf_nat_test.c168 npf_cache_t npc; in checkresult() local
179 memset(&npc, 0, sizeof(npf_cache_t)); in checkresult()
180 npc.npc_ctx = npf_getkernctx(); in checkresult()
181 npc.npc_nbuf = &nbuf; in checkresult()
183 if (!npf_cache_all(&npc)) { in checkresult()
188 const struct udphdr *uh = npc.npc_l4.udp; in checkresult()
193 npf_inet_ntop(af, npc.npc_ips[NPF_SRC], sbuf, sizeof(sbuf)); in checkresult()
194 npf_inet_ntop(af, npc.npc_ips[NPF_DST], dbuf, sizeof(dbuf)); in checkresult()
210 CHECK_TRUE(match_addr(af, saddr, npc.npc_ips[NPF_SRC])); in checkresult()
212 CHECK_TRUE(match_addr(af, daddr, npc.npc_ips[NPF_DST])); in checkresult()
H A Dnpf_mbuf_subr.c310 npf_cache_t *npc = kmem_zalloc(sizeof(npf_cache_t), KM_SLEEP); in get_cached_pkt() local
314 npc->npc_info = 0; in get_cached_pkt()
315 npc->npc_ctx = npf_getkernctx(); in get_cached_pkt()
317 nbuf_init(npc->npc_ctx, nbuf, m, ifp); in get_cached_pkt()
318 npc->npc_nbuf = nbuf; in get_cached_pkt()
319 ret = npf_cache_all(npc); in get_cached_pkt()
322 return npc; in get_cached_pkt()
326 put_cached_pkt(npf_cache_t *npc) in put_cached_pkt() argument
328 struct mbuf *m = nbuf_head_mbuf(npc->npc_nbuf); in put_cached_pkt()
329 kmem_free(npc->npc_nbuf, sizeof(nbuf_t)); in put_cached_pkt()
[all …]
H A Dnpf_bpf_test.c50 npf_cache_t *npc; in test_bpf_code() local
58 npc = get_cached_pkt(m, NULL); in test_bpf_code()
60 bc_args.pkt = (const uint8_t *)nbuf_dataptr(npc->npc_nbuf); in test_bpf_code()
67 bc_args.arg = npc; in test_bpf_code()
80 put_cached_pkt(npc); in test_bpf_code()
H A Dnpf_state_test.c137 npf_cache_t *npc; in process_packet() local
146 npc = get_cached_pkt(construct_packet(p), NULL); in process_packet()
148 ret = npf_state_init(npc, nst); in process_packet()
152 ret = npf_state_inspect(npc, nst, in process_packet()
154 put_cached_pkt(npc); in process_packet()
H A Dnpf_rule_test.c201 npf_cache_t *npc;
207 npc = get_cached_pkt(m, t->ifname);
210 rl = npf_ruleset_inspect(npc, npf_config_ruleset(npf), t->di, NPF_LAYER_3);
219 put_cached_pkt(npc);
63 npf_cache_t *npc; run_raw_testcase() local
/netbsd-src/external/gpl3/binutils.old/dist/gprofng/libcollector/
H A Dunwind.c1601 unsigned long npc = adjust_ret_addr (ra, ra - tbgn, tend); in cache_get() local
1602 if (npc == 0) in cache_get()
1604 DprintfT (SP_DUMP_UNWIND, "unwind.c:%d cached pc=0x%lX\n", __LINE__, npc); in cache_get()
1605 wctx->pc = npc; in cache_get()
1719 unsigned long npc = adjust_ret_addr (ra, ra - tbgn, tend); in process_return_real() local
1720 if (npc == 0) in process_return_real()
1735 wctx->pc = npc; in process_return_real()
1846 is_after_ret (unsigned char * npc) in is_after_ret() argument
1848 if (*npc != 0xe8) in is_after_ret()
1850 unsigned char * onpc = npc; in is_after_ret()
[all …]
/netbsd-src/external/gpl3/binutils/dist/gprofng/libcollector/
H A Dunwind.c1607 unsigned long npc = adjust_ret_addr (ra, ra - tbgn, tend); in cache_get() local
1608 if (npc == 0) in cache_get()
1610 DprintfT (SP_DUMP_UNWIND, "unwind.c:%d cached pc=0x%lX\n", __LINE__, npc); in cache_get()
1611 wctx->pc = npc; in cache_get()
1725 unsigned long npc = adjust_ret_addr (ra, ra - tbgn, tend); in process_return_real() local
1726 if (npc == 0) in process_return_real()
1741 wctx->pc = npc; in process_return_real()
1852 is_after_ret (unsigned char * npc) in is_after_ret() argument
1854 if (*npc != 0xe8) in is_after_ret()
1856 unsigned char * onpc = npc; in is_after_ret()
[all …]
/netbsd-src/sys/arch/sparc64/dev/
H A Dpyro.c442 pci_chipset_tag_t npc; in pyro_alloc_chipset() local
444 npc = kmem_alloc(sizeof *npc, KM_SLEEP); in pyro_alloc_chipset()
445 memcpy(npc, pc, sizeof *pc); in pyro_alloc_chipset()
446 npc->cookie = pbm; in pyro_alloc_chipset()
447 npc->rootnode = node; in pyro_alloc_chipset()
448 npc->spc_conf_read = pyro_conf_read; in pyro_alloc_chipset()
449 npc->spc_conf_write = pyro_conf_write; in pyro_alloc_chipset()
450 npc->spc_intr_map = pyro_intr_map; in pyro_alloc_chipset()
451 npc->spc_intr_establish = pyro_pci_intr_establish; in pyro_alloc_chipset()
452 npc->spc_find_ino = NULL; in pyro_alloc_chipset()
[all …]
H A Dvpci.c465 pci_chipset_tag_t npc; in vpci_alloc_chipset() local
467 npc = kmem_alloc(sizeof *npc, KM_SLEEP); in vpci_alloc_chipset()
468 memcpy(npc, pc, sizeof *pc); in vpci_alloc_chipset()
469 npc->cookie = pbm; in vpci_alloc_chipset()
470 npc->rootnode = node; in vpci_alloc_chipset()
471 npc->spc_conf_read = vpci_conf_read; in vpci_alloc_chipset()
472 npc->spc_conf_write = vpci_conf_write; in vpci_alloc_chipset()
473 npc->spc_intr_map = vpci_intr_map; in vpci_alloc_chipset()
474 npc->spc_intr_establish = vpci_pci_intr_establish; in vpci_alloc_chipset()
475 npc->spc_find_ino = NULL; in vpci_alloc_chipset()
[all …]
/netbsd-src/sys/dev/nvmm/x86/
H A Dnvmm_x86.h53 uint64_t npc; member
58 uint64_t npc; member
64 uint64_t npc; member
68 uint64_t npc; member
/netbsd-src/external/bsd/openldap/dist/clients/tools/
H A Dldapmodify.c396 int npc=0; /* Num of LDIF controls */ in process_ldif_rec() local
398 while (lr.lr_ctrls[npc]) npc++; /* Count LDIF controls */ in process_ldif_rec()
401 (npc+ndefc+1)*sizeof(LDAPControl*)); in process_ldif_rec()
408 for (i=npc; i<npc+ndefc; i++) { in process_ldif_rec()
409 lr.lr_ctrls[i] = ldap_control_dup(defctrls[i-npc]); in process_ldif_rec()
415 lr.lr_ctrls[npc+ndefc] = NULL; in process_ldif_rec()

123