Lines Matching refs:fle

91 #define	INACTIVE(fle)	(time_uptime - fle->f.last > priv->nfinfo_inact_t)  argument
92 #define AGED(fle) (time_uptime - fle->f.first > priv->nfinfo_act_t) argument
93 #define ISFREE(fle) (fle->f.packets == 0) argument
101 #define SMALL(fle) (fle->f.packets <= 4) argument
227 expire_flow(priv_p priv, fib_export_p fe, struct flow_entry *fle, int flags) in expire_flow() argument
230 uint16_t version = fle->f.version; in expire_flow()
239 uma_zfree_arg(priv->zone, fle, priv); in expire_flow()
243 if (export_add(exp.item, fle) > 0) in expire_flow()
254 uma_zfree_arg(priv->zone, fle, priv); in expire_flow()
257 uma_zfree_arg(priv->zone6, fle, priv); in expire_flow()
265 if (export9_add(exp.item9, exp.item9_opt, fle) > 0) in expire_flow()
273 uma_zfree_arg(priv->zone, fle, priv); in expire_flow()
276 uma_zfree_arg(priv->zone6, fle, priv); in expire_flow()
325 struct flow_entry *fle; in hash_insert() local
329 fle = uma_zalloc_arg(priv->zone, priv, M_NOWAIT); in hash_insert()
330 if (fle == NULL) { in hash_insert()
339 fle->f.version = IPVERSION; in hash_insert()
340 bcopy(r, &fle->f.r, sizeof(struct flow_rec)); in hash_insert()
341 fle->f.bytes = plen; in hash_insert()
342 fle->f.packets = 1; in hash_insert()
343 fle->f.tcp_flags = tcp_flags; in hash_insert()
345 fle->f.first = fle->f.last = time_uptime; in hash_insert()
355 rt = fib4_lookup_rt(r->fib, fle->f.r.r_dst, 0, NHR_NONE, &rnd); in hash_insert()
363 fle->f.fle_o_ifx = nh->nh_ifp->if_index; in hash_insert()
365 fle->f.next_hop = nh->gw4_sa.sin_addr; in hash_insert()
370 fle->f.dst_mask = plen; in hash_insert()
379 rt = fib4_lookup_rt(r->fib, fle->f.r.r_src, 0, NHR_NONE, &rnd); in hash_insert()
386 fle->f.src_mask = plen; in hash_insert()
391 TAILQ_INSERT_TAIL(&hsh->head, fle, fle_hash); in hash_insert()
573 struct flow_entry *fle, *fle1; in ng_netflow_cache_flush() local
587 TAILQ_FOREACH_SAFE(fle, &hsh->head, fle_hash, fle1) { in ng_netflow_cache_flush()
588 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_cache_flush()
589 fe = priv_to_fib(priv, fle->f.r.fib); in ng_netflow_cache_flush()
590 expire_flow(priv, fe, fle, NG_QUEUE); in ng_netflow_cache_flush()
594 TAILQ_FOREACH_SAFE(fle, &hsh->head, fle_hash, fle1) { in ng_netflow_cache_flush()
595 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_cache_flush()
596 fe = priv_to_fib(priv, fle->f.r.fib); in ng_netflow_cache_flush()
597 expire_flow(priv, fe, fle, NG_QUEUE); in ng_netflow_cache_flush()
657 struct flow_entry *fle, *fle1; in ng_netflow_flow_add() local
727 TAILQ_FOREACH_REVERSE_SAFE(fle, &hsh->head, fhead, fle_hash, fle1) { in ng_netflow_flow_add()
728 if (bcmp(&r, &fle->f.r, sizeof(struct flow_rec)) == 0) in ng_netflow_flow_add()
730 if ((INACTIVE(fle) && SMALL(fle)) || AGED(fle)) { in ng_netflow_flow_add()
731 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_flow_add()
732 expire_flow(priv, priv_to_fib(priv, fle->f.r.fib), in ng_netflow_flow_add()
733 fle, NG_QUEUE); in ng_netflow_flow_add()
738 if (fle) { /* An existent entry. */ in ng_netflow_flow_add()
740 fle->f.bytes += plen; in ng_netflow_flow_add()
741 fle->f.packets ++; in ng_netflow_flow_add()
742 fle->f.tcp_flags |= tcp_flags; in ng_netflow_flow_add()
743 fle->f.last = time_uptime; in ng_netflow_flow_add()
751 if (tcp_flags & TH_FIN || tcp_flags & TH_RST || AGED(fle) || in ng_netflow_flow_add()
752 (fle->f.bytes >= (CNTR_MAX - IF_MAXMTU)) ) { in ng_netflow_flow_add()
753 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_flow_add()
754 expire_flow(priv, priv_to_fib(priv, fle->f.r.fib), in ng_netflow_flow_add()
755 fle, NG_QUEUE); in ng_netflow_flow_add()
763 if (fle != TAILQ_LAST(&hsh->head, fhead)) { in ng_netflow_flow_add()
764 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_flow_add()
765 TAILQ_INSERT_TAIL(&hsh->head, fle, fle_hash); in ng_netflow_flow_add()
784 struct flow_entry *fle = NULL, *fle1; in ng_netflow_flow6_add() local
846 TAILQ_FOREACH_REVERSE_SAFE(fle, &hsh->head, fhead, fle_hash, fle1) { in ng_netflow_flow6_add()
847 if (fle->f.version != IP6VERSION) in ng_netflow_flow6_add()
849 fle6 = (struct flow6_entry *)fle; in ng_netflow_flow6_add()
853 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_flow6_add()
854 expire_flow(priv, priv_to_fib(priv, fle->f.r.fib), fle, in ng_netflow_flow6_add()
860 if (fle != NULL) { /* An existent entry. */ in ng_netflow_flow6_add()
861 fle6 = (struct flow6_entry *)fle; in ng_netflow_flow6_add()
876 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_flow6_add()
877 expire_flow(priv, priv_to_fib(priv, fle->f.r.fib), fle, in ng_netflow_flow6_add()
886 if (fle != TAILQ_LAST(&hsh->head, fhead)) { in ng_netflow_flow6_add()
887 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_flow6_add()
888 TAILQ_INSERT_TAIL(&hsh->head, fle, fle_hash); in ng_netflow_flow6_add()
910 struct flow_entry *fle; in ng_netflow_flow_show() local
962 TAILQ_FOREACH(fle, &hsh->head, fle_hash) { in ng_netflow_flow_show()
983 fle6 = (struct flow6_entry *)fle; in ng_netflow_flow_show()
988 bcopy(&fle->f, data + resp->nentries, in ng_netflow_flow_show()
989 sizeof(fle->f)); in ng_netflow_flow_show()
1047 export_add(item_p item, struct flow_entry *fle) in export_add() argument
1061 rec->src_addr = fle->f.r.r_src.s_addr; in export_add()
1062 rec->dst_addr = fle->f.r.r_dst.s_addr; in export_add()
1063 rec->next_hop = fle->f.next_hop.s_addr; in export_add()
1064 rec->i_ifx = htons(fle->f.fle_i_ifx); in export_add()
1065 rec->o_ifx = htons(fle->f.fle_o_ifx); in export_add()
1066 rec->packets = htonl(fle->f.packets); in export_add()
1067 rec->octets = htonl(fle->f.bytes); in export_add()
1068 rec->first = htonl(MILLIUPTIME(fle->f.first)); in export_add()
1069 rec->last = htonl(MILLIUPTIME(fle->f.last)); in export_add()
1070 rec->s_port = fle->f.r.r_sport; in export_add()
1071 rec->d_port = fle->f.r.r_dport; in export_add()
1072 rec->flags = fle->f.tcp_flags; in export_add()
1073 rec->prot = fle->f.r.r_ip_p; in export_add()
1074 rec->tos = fle->f.r.r_tos; in export_add()
1075 rec->dst_mask = fle->f.dst_mask; in export_add()
1076 rec->src_mask = fle->f.src_mask; in export_add()
1093 struct flow_entry *fle, *fle1; in ng_netflow_expire() local
1109 TAILQ_FOREACH_SAFE(fle, &hsh->head, fle_hash, fle1) { in ng_netflow_expire()
1121 if (used <= (NBUCKETS*2) && !INACTIVE(fle)) in ng_netflow_expire()
1124 if ((INACTIVE(fle) && (SMALL(fle) || in ng_netflow_expire()
1125 (used > (NBUCKETS*2)))) || AGED(fle)) { in ng_netflow_expire()
1126 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_expire()
1128 fle->f.r.fib), fle, NG_NOFLAGS); in ng_netflow_expire()
1147 TAILQ_FOREACH_SAFE(fle, &hsh->head, fle_hash, fle1) { in ng_netflow_expire()
1148 fle6 = (struct flow6_entry *)fle; in ng_netflow_expire()
1165 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_expire()
1167 fle->f.r.fib), fle, NG_NOFLAGS); in ng_netflow_expire()