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