/src/sys/net/npf/ |
npf_inet.c | 250 npf_tcpsaw(const npf_cache_t *npc, tcp_seq *seq, tcp_seq *ack, uint32_t *win) 252 const struct tcphdr *th = npc->npc_l4.tcp; 255 KASSERT(npf_iscached(npc, NPC_TCP)); 262 if (npf_iscached(npc, NPC_IP4)) { 263 const struct ip *ip = npc->npc_ip.v4; 264 return ntohs(ip->ip_len) - npc->npc_hlen - thlen; 265 } else if (npf_iscached(npc, NPC_IP6)) { 266 const struct ip6_hdr *ip6 = npc->npc_ip.v6; 268 (npc->npc_hlen - sizeof(*ip6)) - thlen; 277 npf_fetch_tcpopts(npf_cache_t *npc, uint16_t *mss, int *wscale [all...] |
npf_sendpkt.c | 60 #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) 75 const struct ifnet *rcvif = npc->npc_nbuf->nb_ifp; 92 npf_return_tcp(npf_cache_t *npc) 94 npf_t *npf = npc->npc_ctx; 104 KASSERT(npf_iscached(npc, NPC_IP46)); 105 KASSERT(npf_iscached(npc, NPC_LAYER4)); 106 tcpdlen = npf_tcpsaw(npc, &seq, &ack, &win); 107 oth = npc->npc_l4.tcp [all...] |
npf_alg_icmp.c | 74 npfa_icmp_match(npf_cache_t *npc, npf_nat_t *nt, int di) 76 const int proto = npc->npc_proto; 77 const struct ip *ip = npc->npc_ip.v4; 80 KASSERT(npf_iscached(npc, NPC_IP46)); 81 KASSERT(npf_iscached(npc, NPC_LAYER4)); 90 const struct tcphdr *th = npc->npc_l4.tcp; 95 const struct udphdr *uh = npc->npc_l4.udp; 123 * the nbuf nor npc is touched. 127 npfa_icmp4_inspect(const int type, npf_cache_t *npc, bool *hasqid) 129 nbuf_t *nbuf = npc->npc_nbuf [all...] |
npf_handler.c | 82 npf_reassembly(npf_t *npf, npf_cache_t *npc, bool *mff) 84 nbuf_t *nbuf = npc->npc_nbuf; 91 if (npf_iscached(npc, NPC_IP4) && npf->ip4_reassembly) { 93 } else if (npf_iscached(npc, NPC_IP6) && npf->ip6_reassembly) { 94 error = ip6_reass_packet(&m, npc->npc_hlen); 122 npc->npc_info = 0; 124 if (npf_cache_all(npc) & (NPC_IPFRAG|NPC_FMTERR)) { 147 npf_cache_t npc; local in function:npfk_packet_handler 162 memset(&npc, 0, sizeof(npf_cache_t)); 163 npc.npc_ctx = npf 350 npf_cache_t npc; local in function:npfk_layer2_handler [all...] |
npf_bpf.c | 85 npf_bpf_prepare(npf_cache_t *npc, bpf_args_t *args, uint32_t *M) 87 nbuf_t *nbuf = npc->npc_nbuf; 101 args->arg = npc; 111 const u_int alen = npc->npc_alen; 121 M[BPF_MW_L4OFF] = npc->npc_hlen; 122 M[BPF_MW_L4PROTO] = npc->npc_proto; 156 const npf_cache_t * const npc = (const npf_cache_t *)args->arg; local in function:npf_cop_l3 157 const uint32_t ver = (npc->npc_alen & 4) | ((npc->npc_alen >> 4) * 6); 161 M[BPF_MW_L4OFF] = npc->npc_hlen 176 const npf_cache_t * const npc = (const npf_cache_t *)args->arg; local in function:npf_cop_table [all...] |
npf_socket.c | 89 npf_socket_lookup_rid(npf_cache_t *npc, get_rid_t get_rid, uint32_t *rid, int dir) 93 KASSERT(npf_iscached(npc, NPC_IP46)); 96 if (npf_iscached(npc, NPC_IP4)) { 97 so = npf_ip_socket(npc, dir); 99 } else if (npf_iscached(npc, NPC_IP6)) { 100 so = npf_ip6_socket(npc, dir); 114 npf_ip_socket(npf_cache_t *npc, int dir) 127 KASSERT(npf_iscached(npc, NPC_LAYER4)); 128 KASSERT(npf_iscached(npc, NPC_IP4)); 130 struct tcphdr *tcp = npc->npc_l4.tcp [all...] |
npf_ext_normalize.c | 103 npf_normalize_ip4(npf_cache_t *npc, npf_normalize_t *np) 105 struct ip *ip = npc->npc_ip.v4; 144 npf_normalize(npf_cache_t *npc, void *params, const npf_match_info_t *mi, 160 if (npf_iscached(npc, NPC_IP4) && (np->n_random_id || np->n_minttl)) { 161 npf_normalize_ip4(npc, np); 163 th = npc->npc_l4.tcp; 169 if (maxmss == 0 || !npf_iscached(npc, NPC_TCP) || 175 if (!npf_fetch_tcpopts(npc, &mss, &wscale)) { 191 if (npf_set_mss(npc, maxmss, old, new, &mid) && 192 !nbuf_cksum_barrier(npc->npc_nbuf, mi->mi_di)) [all...] |
npf_nat.c | 413 npf_nat_inspect(npf_cache_t *npc, const unsigned di) 415 npf_t *npf = npc->npc_ctx; 421 rl = npf_ruleset_inspect(npc, rlset, di, NPF_RULE_LAYER_3); 433 npf_nat_algo_netmap(const npf_cache_t *npc, const npf_natpolicy_t *np, 436 const npf_addr_t *orig_addr = npc->npc_ips[which]; 443 npf_addr_mask(&np->n_taddr, np->n_tmask, npc->npc_alen, addr); 444 npf_addr_bitor(orig_addr, np->n_tmask, npc->npc_alen, addr); 448 npf_nat_getaddr(npf_cache_t *npc, npf_natpolicy_t *np, const unsigned alen) 464 npc->npc_ips[NPF_SRC], 465 npc->npc_ips[NPF_DST]) [all...] |
npf_state.c | 145 npf_state_init(npf_cache_t *npc, npf_state_t *nst) 147 const int proto = npc->npc_proto; 150 KASSERT(npf_iscached(npc, NPC_IP46)); 151 KASSERT(npf_iscached(npc, NPC_LAYER4)); 158 ret = npf_state_tcp(npc, nst, NPF_FLOW_FORW); 187 npf_state_inspect(npf_cache_t *npc, npf_state_t *nst, const npf_flow_t flow) 189 const int proto = npc->npc_proto; 195 ret = npf_state_tcp(npc, nst, flow);
|
npf_connkey.c | 226 npf_conn_conkey(const npf_cache_t *npc, npf_connkey_t *key, 229 const npf_conn_params_t *params = npc->npc_ctx->params[NPF_PARAMS_CONN]; 230 const nbuf_t *nbuf = npc->npc_nbuf; 231 const unsigned proto = npc->npc_proto; 232 const unsigned alen = npc->npc_alen; 238 if (npc->npc_ckey) { 243 return npf_connkey_copy(npc->npc_ckey, key, invert); 248 KASSERT(npf_iscached(npc, NPC_TCP)); 249 th = npc->npc_l4.tcp; 254 KASSERT(npf_iscached(npc, NPC_UDP)) [all...] |
npf_alg.c | 219 npf_alg_match(npf_cache_t *npc, npf_nat_t *nt, int di) 221 npf_t *npf = npc->npc_ctx; 227 KASSERTMSG(npf_iscached(npc, NPC_IP46), "expecting protocol number"); 236 if (match_func && match_func(npc, nt, di)) { 255 npf_alg_exec(npf_cache_t *npc, npf_nat_t *nt, const npf_flow_t flow) 257 npf_t *npf = npc->npc_ctx; 270 translate_func(npc, nt, flow); 294 npf_alg_conn(npf_cache_t *npc, int di) 296 npf_t *npf = npc->npc_ctx; 309 if (inspect_func && (con = inspect_func(npc, di)) != NULL) [all...] |
npf_state_tcp.c | 292 npf_tcp_inwindow(npf_cache_t *npc, npf_state_t *nst, const npf_flow_t flow) 295 const struct tcphdr * const th = npc->npc_l4.tcp; 302 params = npc->npc_ctx->params[NPF_PARAMS_TCP_STATE]; 303 KASSERT(npf_iscached(npc, NPC_TCP)); 323 tcpdlen = npf_tcpsaw(__UNCONST(npc), &seq, &ack, &win); 358 (void)npf_fetch_tcpopts(npc, NULL, &fstate->nst_wscale); 378 (void)npf_fetch_tcpopts(npc, NULL, &fstate->nst_wscale); 408 npf_stats_inc(npc->npc_ctx, NPF_STAT_INVALID_STATE_TCP1); 414 npf_stats_inc(npc->npc_ctx, NPF_STAT_INVALID_STATE_TCP2); 425 npf_stats_inc(npc->npc_ctx, NPF_STAT_INVALID_STATE_TCP3) [all...] |
npf_ext_log.c | 83 npf_log(npf_cache_t *npc, void *meta, const npf_match_info_t *mi, int *decision) 85 struct mbuf *m = nbuf_head_mbuf(npc->npc_nbuf); 93 if (npf_iscached(npc, NPC_IP4)) { 95 } else if (npf_iscached(npc, NPC_IP6)) { 106 struct nbuf *nb = npc->npc_nbuf; 107 npf_ifmap_copyname(npc->npc_ctx, nb ? nb->nb_ifid : 0,
|
npf_conn.c | 257 npf_conn_trackable_p(const npf_cache_t *npc) 259 const npf_t *npf = npc->npc_ctx; 268 if (!npf_iscached(npc, NPC_IP46) || !npf_iscached(npc, NPC_LAYER4)) { 326 npf_conn_lookup(const npf_cache_t *npc, const unsigned di, npf_flow_t *flow) 328 npf_t *npf = npc->npc_ctx; 329 const nbuf_t *nbuf = npc->npc_nbuf; 334 if (!npf_conn_conkey(npc, &key, di, NPF_FLOW_FORW)) { 341 KASSERT(npc->npc_proto == atomic_load_relaxed(&con->c_proto)); 360 npf_conn_inspect(npf_cache_t *npc, const unsigned di, int *error [all...] |
npf_rproc.c | 366 npf_rproc_run(npf_cache_t *npc, npf_rproc_t *rp, const npf_match_info_t *mi, 371 KASSERT(!nbuf_flag_p(npc->npc_nbuf, NBUF_DATAREF_RESET)); 380 if (!extops->proc(npc, rp->rp_ext_meta[i], mi, decision)) { 384 if (nbuf_flag_p(npc->npc_nbuf, NBUF_DATAREF_RESET)) { 385 npf_recache(npc);
|
/src/usr.sbin/npf/npftest/libnpftest/ |
npf_bpf_test.c | 50 npf_cache_t *npc; local in function:test_bpf_code 58 npc = get_cached_pkt(m, NULL, NPF_RULE_LAYER_3); 60 bc_args.pkt = (const uint8_t *)nbuf_dataptr(npc->npc_nbuf); 67 bc_args.arg = npc; 80 put_cached_pkt(npc);
|
npf_nat_test.c | 168 npf_cache_t npc; local in function:checkresult 179 memset(&npc, 0, sizeof(npf_cache_t)); 180 npc.npc_ctx = npf_getkernctx(); 181 npc.npc_nbuf = &nbuf; 183 if (!npf_cache_all(&npc)) { 188 const struct udphdr *uh = npc.npc_l4.udp; 193 npf_inet_ntop(af, npc.npc_ips[NPF_SRC], sbuf, sizeof(sbuf)); 194 npf_inet_ntop(af, npc.npc_ips[NPF_DST], dbuf, sizeof(dbuf)); 210 CHECK_TRUE(match_addr(af, saddr, npc.npc_ips[NPF_SRC])); 212 CHECK_TRUE(match_addr(af, daddr, npc.npc_ips[NPF_DST])) [all...] |
npf_mbuf_subr.c | 335 npf_cache_t *npc = kmem_zalloc(sizeof(npf_cache_t), KM_SLEEP); local in function:get_cached_pkt 339 npc->npc_info = 0; 340 npc->npc_ctx = npf_getkernctx(); 342 nbuf_init(npc->npc_ctx, nbuf, m, ifp); 343 npc->npc_nbuf = nbuf; 346 ret = npf_cache_all(npc); 348 ret = npf_cache_ether(npc); 351 return npc; 355 put_cached_pkt(npf_cache_t *npc) 357 struct mbuf *m = nbuf_head_mbuf(npc->npc_nbuf) [all...] |
npf_state_test.c | 137 npf_cache_t *npc; local in function:process_packet 146 npc = get_cached_pkt(construct_packet(p), NULL, NPF_RULE_LAYER_3); 148 ret = npf_state_init(npc, nst); 152 ret = npf_state_inspect(npc, nst, 154 put_cached_pkt(npc);
|
npf_l2rule_test.c | 75 npf_cache_t *npc; local in function:run_raw_testcase 81 npc = get_cached_pkt(m, t->ifname, NPF_RULE_LAYER_2); 84 rl = npf_ruleset_inspect(npc, npf_config_ruleset(npf), t->di, NPF_RULE_LAYER_2); 93 put_cached_pkt(npc);
|
npf_rid_test.c | 113 npf_cache_t *npc; local in function:run_raw_testcase 119 npc = get_cached_pkt(m, t->ifname, NPF_RULE_LAYER_3); 122 rl = npf_ruleset_inspect(npc, npf_config_ruleset(npf), t->di, NPF_RULE_LAYER_3); 127 id_match = npf_rule_match_rid(rl, npc, t->di); 132 error = npf_rule_reverse(npc, &mi, error); 140 put_cached_pkt(npc);
|
npf_gc_test.c | 52 npf_cache_t *npc = get_cached_pkt(m, NULL, NPF_RULE_LAYER_3); local in function:enqueue_connection 55 con = npf_conn_establish(npc, PFIL_IN, true); 61 put_cached_pkt(npc);
|
/src/sys/arch/sparc64/dev/ |
pyro.c | 442 pci_chipset_tag_t npc; local in function:pyro_alloc_chipset 444 npc = kmem_alloc(sizeof *npc, KM_SLEEP); 445 memcpy(npc, pc, sizeof *pc); 446 npc->cookie = pbm; 447 npc->rootnode = node; 448 npc->spc_conf_read = pyro_conf_read; 449 npc->spc_conf_write = pyro_conf_write; 450 npc->spc_intr_map = pyro_intr_map; 451 npc->spc_intr_establish = pyro_pci_intr_establish [all...] |
vpci.c | 465 pci_chipset_tag_t npc; local in function:vpci_alloc_chipset 467 npc = kmem_alloc(sizeof *npc, KM_SLEEP); 468 memcpy(npc, pc, sizeof *pc); 469 npc->cookie = pbm; 470 npc->rootnode = node; 471 npc->spc_conf_read = vpci_conf_read; 472 npc->spc_conf_write = vpci_conf_write; 473 npc->spc_intr_map = vpci_intr_map; 474 npc->spc_intr_establish = vpci_pci_intr_establish [all...] |
/src/sys/dev/nvmm/x86/ |
nvmm_x86.h | 53 uint64_t npc; member in struct:nvmm_x86_exit_io 58 uint64_t npc; member in struct:nvmm_x86_exit_rdmsr 64 uint64_t npc; member in struct:nvmm_x86_exit_wrmsr 68 uint64_t npc; member in struct:nvmm_x86_exit_insn
|