Lines Matching refs:fle

86 #define	INACTIVE(fle)	(time_uptime - fle->f.last > priv->nfinfo_inact_t)  argument
87 #define AGED(fle) (time_uptime - fle->f.first > priv->nfinfo_act_t) argument
88 #define ISFREE(fle) (fle->f.packets == 0) argument
96 #define SMALL(fle) (fle->f.packets <= 4) argument
230 expire_flow(priv_p priv, fib_export_p fe, struct flow_entry *fle, int flags) in expire_flow() argument
233 uint16_t version = fle->f.version; in expire_flow()
242 uma_zfree_arg(priv->zone, fle, priv); in expire_flow()
246 if (export_add(exp.item, fle) > 0) in expire_flow()
257 uma_zfree_arg(priv->zone, fle, priv); in expire_flow()
260 uma_zfree_arg(priv->zone6, fle, priv); in expire_flow()
268 if (export9_add(exp.item9, exp.item9_opt, fle) > 0) in expire_flow()
276 uma_zfree_arg(priv->zone, fle, priv); in expire_flow()
279 uma_zfree_arg(priv->zone6, fle, priv); in expire_flow()
327 struct flow_entry *fle; in hash_insert() local
334 fle = uma_zalloc_arg(priv->zone, priv, M_NOWAIT); in hash_insert()
335 if (fle == NULL) { in hash_insert()
344 fle->f.version = IPVERSION; in hash_insert()
345 bcopy(r, &fle->f.r, sizeof(struct flow_rec)); in hash_insert()
346 fle->f.bytes = plen; in hash_insert()
347 fle->f.packets = 1; in hash_insert()
348 fle->f.tcp_flags = tcp_flags; in hash_insert()
350 fle->f.first = fle->f.last = time_uptime; in hash_insert()
360 sin.sin_addr = fle->f.r.r_dst; in hash_insert()
371 fle->f.fle_o_ifx = info.rti_ifp->if_index; in hash_insert()
375 fle->f.next_hop = in hash_insert()
379 fle->f.dst_mask = bitcount32(sin_mask.sin_addr.s_addr); in hash_insert()
382 fle->f.dst_mask = 32; in hash_insert()
393 sin.sin_addr = fle->f.r.r_src; in hash_insert()
403 fle->f.src_mask = in hash_insert()
407 fle->f.src_mask = 32; in hash_insert()
412 TAILQ_INSERT_TAIL(&hsh->head, fle, fle_hash); in hash_insert()
609 struct flow_entry *fle, *fle1; in ng_netflow_cache_flush() local
623 TAILQ_FOREACH_SAFE(fle, &hsh->head, fle_hash, fle1) { in ng_netflow_cache_flush()
624 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_cache_flush()
625 fe = priv_to_fib(priv, fle->f.r.fib); in ng_netflow_cache_flush()
626 expire_flow(priv, fe, fle, NG_QUEUE); in ng_netflow_cache_flush()
630 TAILQ_FOREACH_SAFE(fle, &hsh->head, fle_hash, fle1) { in ng_netflow_cache_flush()
631 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_cache_flush()
632 fe = priv_to_fib(priv, fle->f.r.fib); in ng_netflow_cache_flush()
633 expire_flow(priv, fe, fle, NG_QUEUE); in ng_netflow_cache_flush()
692 struct flow_entry *fle, *fle1; in ng_netflow_flow_add() local
764 TAILQ_FOREACH_REVERSE_SAFE(fle, &hsh->head, fhead, fle_hash, fle1) { in ng_netflow_flow_add()
765 if (bcmp(&r, &fle->f.r, sizeof(struct flow_rec)) == 0) in ng_netflow_flow_add()
767 if ((INACTIVE(fle) && SMALL(fle)) || AGED(fle)) { in ng_netflow_flow_add()
768 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_flow_add()
769 expire_flow(priv, priv_to_fib(priv, fle->f.r.fib), in ng_netflow_flow_add()
770 fle, NG_QUEUE); in ng_netflow_flow_add()
775 if (fle) { /* An existent entry. */ in ng_netflow_flow_add()
777 fle->f.bytes += plen; in ng_netflow_flow_add()
778 fle->f.packets ++; in ng_netflow_flow_add()
779 fle->f.tcp_flags |= tcp_flags; in ng_netflow_flow_add()
780 fle->f.last = time_uptime; in ng_netflow_flow_add()
788 if (tcp_flags & TH_FIN || tcp_flags & TH_RST || AGED(fle) || in ng_netflow_flow_add()
789 (fle->f.bytes >= (CNTR_MAX - IF_MAXMTU)) ) { in ng_netflow_flow_add()
790 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_flow_add()
791 expire_flow(priv, priv_to_fib(priv, fle->f.r.fib), in ng_netflow_flow_add()
792 fle, NG_QUEUE); in ng_netflow_flow_add()
800 if (fle != TAILQ_LAST(&hsh->head, fhead)) { in ng_netflow_flow_add()
801 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_flow_add()
802 TAILQ_INSERT_TAIL(&hsh->head, fle, fle_hash); in ng_netflow_flow_add()
820 struct flow_entry *fle = NULL, *fle1; in ng_netflow_flow6_add() local
882 TAILQ_FOREACH_REVERSE_SAFE(fle, &hsh->head, fhead, fle_hash, fle1) { in ng_netflow_flow6_add()
883 if (fle->f.version != IP6VERSION) in ng_netflow_flow6_add()
885 fle6 = (struct flow6_entry *)fle; in ng_netflow_flow6_add()
889 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_flow6_add()
890 expire_flow(priv, priv_to_fib(priv, fle->f.r.fib), fle, in ng_netflow_flow6_add()
896 if (fle != NULL) { /* An existent entry. */ in ng_netflow_flow6_add()
897 fle6 = (struct flow6_entry *)fle; in ng_netflow_flow6_add()
912 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_flow6_add()
913 expire_flow(priv, priv_to_fib(priv, fle->f.r.fib), fle, in ng_netflow_flow6_add()
922 if (fle != TAILQ_LAST(&hsh->head, fhead)) { in ng_netflow_flow6_add()
923 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_flow6_add()
924 TAILQ_INSERT_TAIL(&hsh->head, fle, fle_hash); in ng_netflow_flow6_add()
946 struct flow_entry *fle; in ng_netflow_flow_show() local
998 TAILQ_FOREACH(fle, &hsh->head, fle_hash) { in ng_netflow_flow_show()
1019 fle6 = (struct flow6_entry *)fle; in ng_netflow_flow_show()
1024 bcopy(&fle->f, data + resp->nentries, in ng_netflow_flow_show()
1025 sizeof(fle->f)); in ng_netflow_flow_show()
1084 export_add(item_p item, struct flow_entry *fle) in export_add() argument
1098 rec->src_addr = fle->f.r.r_src.s_addr; in export_add()
1099 rec->dst_addr = fle->f.r.r_dst.s_addr; in export_add()
1100 rec->next_hop = fle->f.next_hop.s_addr; in export_add()
1101 rec->i_ifx = htons(fle->f.fle_i_ifx); in export_add()
1102 rec->o_ifx = htons(fle->f.fle_o_ifx); in export_add()
1103 rec->packets = htonl(fle->f.packets); in export_add()
1104 rec->octets = htonl(fle->f.bytes); in export_add()
1105 rec->first = htonl(MILLIUPTIME(fle->f.first)); in export_add()
1106 rec->last = htonl(MILLIUPTIME(fle->f.last)); in export_add()
1107 rec->s_port = fle->f.r.r_sport; in export_add()
1108 rec->d_port = fle->f.r.r_dport; in export_add()
1109 rec->flags = fle->f.tcp_flags; in export_add()
1110 rec->prot = fle->f.r.r_ip_p; in export_add()
1111 rec->tos = fle->f.r.r_tos; in export_add()
1112 rec->dst_mask = fle->f.dst_mask; in export_add()
1113 rec->src_mask = fle->f.src_mask; in export_add()
1130 struct flow_entry *fle, *fle1; in ng_netflow_expire() local
1146 TAILQ_FOREACH_SAFE(fle, &hsh->head, fle_hash, fle1) { in ng_netflow_expire()
1158 if (used <= (NBUCKETS*2) && !INACTIVE(fle)) in ng_netflow_expire()
1161 if ((INACTIVE(fle) && (SMALL(fle) || in ng_netflow_expire()
1162 (used > (NBUCKETS*2)))) || AGED(fle)) { in ng_netflow_expire()
1163 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_expire()
1165 fle->f.r.fib), fle, NG_NOFLAGS); in ng_netflow_expire()
1184 TAILQ_FOREACH_SAFE(fle, &hsh->head, fle_hash, fle1) { in ng_netflow_expire()
1185 fle6 = (struct flow6_entry *)fle; in ng_netflow_expire()
1202 TAILQ_REMOVE(&hsh->head, fle, fle_hash); in ng_netflow_expire()
1204 fle->f.r.fib), fle, NG_NOFLAGS); in ng_netflow_expire()