Lines Matching refs:entry
123 #define SOFLOW_ENTRY_LOG(level, so, entry, debug, msg) … argument
125 …if (soflow_log_level >= level && entry && debug) { …
126 …soflow_entry_log(level, so, entry, msg); …
137 #define SOFLOW_ENABLE_DEBUG(so, entry) \ argument
138 …((soflow_log_port == 0 || !entry || soflow_log_port == ntohs(entry->soflow_lport) || soflow_log_po…
144 #define SOFLOW_ENTRY_FREE(entry) \ argument
145 if (entry && (os_ref_release(&entry->soflow_ref_count) == 0)) { \
146 soflow_entry_free(entry); \
212 soflow_entry_log(int level, struct socket *so, struct soflow_hash_entry *entry, const char* msg) in soflow_entry_log() argument
220 if (entry == NULL) { in soflow_entry_log()
224 switch (entry->soflow_family) { in soflow_entry_log()
226 addr = &entry->soflow_laddr.addr6; in soflow_entry_log()
228 addr = &entry->soflow_faddr.addr6; in soflow_entry_log()
232 addr = &entry->soflow_laddr.addr46.ia46_addr4.s_addr; in soflow_entry_log()
234 addr = &entry->soflow_faddr.addr46.ia46_addr4.s_addr; in soflow_entry_log()
241 …SOFLOW_LOG(level, so, entry->soflow_debug, "<%s>: %s <%s(%d) entry %p, featureID %llu, filter_ctl … in soflow_entry_log()
243 msg, entry->soflow_outgoing ? "OUT" : "IN ", in soflow_entry_log()
245 entry, entry->soflow_feat_ctxt_id, in soflow_entry_log()
246 entry->soflow_filter_control_unit, in soflow_entry_log()
247 entry->soflow_outifindex, in soflow_entry_log()
248 ntohs(entry->soflow_lport), ntohs(entry->soflow_fport), local, remote, in soflow_entry_log()
249 entry->soflow_flowhash, in soflow_entry_log()
250 … entry->soflow_rxpackets, entry->soflow_rxbytes, entry->soflow_txpackets, entry->soflow_txbytes); in soflow_entry_log()
254 soflow_fill_hash_entry_from_address(struct soflow_hash_entry *entry, bool isLocal, struct sockaddr … in soflow_fill_hash_entry_from_address() argument
259 if (entry == NULL || addr == NULL) { in soflow_fill_hash_entry_from_address()
271 entry->soflow_lport = sin->sin_port; in soflow_fill_hash_entry_from_address()
273 entry->soflow_lport_updated = TRUE; in soflow_fill_hash_entry_from_address()
277 entry->soflow_laddr.addr46.ia46_addr4.s_addr = sin->sin_addr.s_addr; in soflow_fill_hash_entry_from_address()
279 entry->soflow_laddr_updated = TRUE; in soflow_fill_hash_entry_from_address()
284 entry->soflow_fport = sin->sin_port; in soflow_fill_hash_entry_from_address()
287 entry->soflow_faddr.addr46.ia46_addr4.s_addr = sin->sin_addr.s_addr; in soflow_fill_hash_entry_from_address()
290 entry->soflow_family = AF_INET; in soflow_fill_hash_entry_from_address()
299 entry->soflow_lport = sin6->sin6_port; in soflow_fill_hash_entry_from_address()
301 entry->soflow_lport_updated = TRUE; in soflow_fill_hash_entry_from_address()
305 entry->soflow_laddr.addr6 = sin6->sin6_addr; in soflow_fill_hash_entry_from_address()
306 entry->soflow_laddr6_ifscope = sin6->sin6_scope_id; in soflow_fill_hash_entry_from_address()
309 entry->soflow_laddr_updated = TRUE; in soflow_fill_hash_entry_from_address()
314 entry->soflow_fport = sin6->sin6_port; in soflow_fill_hash_entry_from_address()
317 entry->soflow_faddr.addr6 = sin6->sin6_addr; in soflow_fill_hash_entry_from_address()
318 entry->soflow_faddr6_ifscope = sin6->sin6_scope_id; in soflow_fill_hash_entry_from_address()
322 entry->soflow_family = AF_INET6; in soflow_fill_hash_entry_from_address()
330 soflow_fill_hash_entry_from_inp(struct soflow_hash_entry *entry, bool isLocal, struct inpcb *inp, b… in soflow_fill_hash_entry_from_inp() argument
332 if (entry == NULL || inp == NULL) { in soflow_fill_hash_entry_from_inp()
339 entry->soflow_lport = inp->inp_lport; in soflow_fill_hash_entry_from_inp()
341 entry->soflow_lport_updated = TRUE; in soflow_fill_hash_entry_from_inp()
345 entry->soflow_laddr.addr6 = inp->in6p_laddr; in soflow_fill_hash_entry_from_inp()
346 entry->soflow_laddr6_ifscope = inp->inp_lifscope; in soflow_fill_hash_entry_from_inp()
347 in6_verify_ifscope(&entry->soflow_laddr.addr6, inp->inp_lifscope); in soflow_fill_hash_entry_from_inp()
349 entry->soflow_laddr_updated = TRUE; in soflow_fill_hash_entry_from_inp()
354 entry->soflow_fport = inp->inp_fport; in soflow_fill_hash_entry_from_inp()
357 entry->soflow_faddr.addr6 = inp->in6p_faddr; in soflow_fill_hash_entry_from_inp()
358 entry->soflow_faddr6_ifscope = inp->inp_fifscope; in soflow_fill_hash_entry_from_inp()
359 in6_verify_ifscope(&entry->soflow_faddr.addr6, inp->inp_fifscope); in soflow_fill_hash_entry_from_inp()
362 entry->soflow_family = AF_INET6; in soflow_fill_hash_entry_from_inp()
367 entry->soflow_lport = inp->inp_lport; in soflow_fill_hash_entry_from_inp()
369 entry->soflow_lport_updated = TRUE; in soflow_fill_hash_entry_from_inp()
373 entry->soflow_laddr.addr46.ia46_addr4.s_addr = inp->inp_laddr.s_addr; in soflow_fill_hash_entry_from_inp()
375 entry->soflow_laddr_updated = TRUE; in soflow_fill_hash_entry_from_inp()
380 entry->soflow_fport = inp->inp_fport; in soflow_fill_hash_entry_from_inp()
383 entry->soflow_faddr.addr46.ia46_addr4.s_addr = inp->inp_faddr.s_addr; in soflow_fill_hash_entry_from_inp()
386 entry->soflow_family = AF_INET; in soflow_fill_hash_entry_from_inp()
475 struct soflow_hash_entry *entry = NULL; in soflow_db_free() local
487 LIST_FOREACH_SAFE(entry, flowhash, soflow_entry_link, temp_entry) { in soflow_db_free()
488 SOFLOW_ENTRY_LOG(LOG_INFO, db->soflow_db_so, entry, entry->soflow_debug, "Remove entry"); in soflow_db_free()
489 soflow_db_remove_entry(db, entry); in soflow_db_free()
613 …struct soflow_hash_entry *entry = soflow_db_lookup_entry_internal(db, local, remote, remoteOnly, f… in soflow_db_lookup_entry() local
614 if (entry == NULL && remoteOnly == true) { in soflow_db_lookup_entry()
615 entry = soflow_db_lookup_entry_internal(db, local, remote, remoteOnly, true); in soflow_db_lookup_entry()
617 return entry; in soflow_db_lookup_entry()
721 struct soflow_hash_entry *entry = NULL; in soflow_db_add_entry() local
731 entry = kalloc_type(struct soflow_hash_entry, Z_WAITOK | Z_ZERO | Z_NOFAIL); in soflow_db_add_entry()
732 os_ref_init(&entry->soflow_ref_count, &soflow_refgrp); in soflow_db_add_entry()
735 soflow_fill_hash_entry_from_address(entry, TRUE, local, FALSE); in soflow_db_add_entry()
737 soflow_fill_hash_entry_from_inp(entry, TRUE, inp, FALSE); in soflow_db_add_entry()
740 soflow_fill_hash_entry_from_address(entry, FALSE, remote, FALSE); in soflow_db_add_entry()
742 soflow_fill_hash_entry_from_inp(entry, FALSE, inp, FALSE); in soflow_db_add_entry()
744 entry->soflow_lastused = net_uptime(); in soflow_db_add_entry()
745 entry->soflow_db = db; in soflow_db_add_entry()
746 entry->soflow_debug = SOFLOW_ENABLE_DEBUG(db->soflow_db_so, entry); in soflow_db_add_entry()
747 microuptime(&entry->soflow_timestamp); in soflow_db_add_entry()
750 hashkey_faddr = entry->soflow_faddr.addr6.s6_addr32[3]; in soflow_db_add_entry()
751 hashkey_laddr = entry->soflow_laddr.addr6.s6_addr32[3]; in soflow_db_add_entry()
753 hashkey_faddr = entry->soflow_faddr.addr46.ia46_addr4.s_addr; in soflow_db_add_entry()
754 hashkey_laddr = entry->soflow_laddr.addr46.ia46_addr4.s_addr; in soflow_db_add_entry()
756 entry->soflow_flowhash = SOFLOW_HASH(hashkey_laddr, hashkey_faddr, in soflow_db_add_entry()
757 entry->soflow_lport, entry->soflow_fport); in soflow_db_add_entry()
758 inp_hash_element = entry->soflow_flowhash & db->soflow_db_hashmask; in soflow_db_add_entry()
770 LIST_INSERT_HEAD(flowhash, entry, soflow_entry_link); in soflow_db_add_entry()
772 db->soflow_db_only_entry = entry; in soflow_db_add_entry()
778 return entry; in soflow_db_add_entry()
832 soflow_entry_local_address_needs_update(struct soflow_hash_entry *entry) in soflow_entry_local_address_needs_update() argument
834 if (entry->soflow_family == AF_INET6) { in soflow_entry_local_address_needs_update()
835 return IN6_IS_ADDR_UNSPECIFIED(&entry->soflow_laddr.addr6); in soflow_entry_local_address_needs_update()
836 } else if (entry->soflow_family == AF_INET) { in soflow_entry_local_address_needs_update()
837 return entry->soflow_laddr.addr46.ia46_addr4.s_addr == INADDR_ANY; in soflow_entry_local_address_needs_update()
843 soflow_entry_local_port_needs_update(struct socket *so, struct soflow_hash_entry *entry) in soflow_entry_local_port_needs_update() argument
846 return entry->soflow_lport == 0; in soflow_entry_local_port_needs_update()
852 soflow_entry_update_local(struct soflow_db *db, struct soflow_hash_entry *entry, struct sockaddr *l… in soflow_entry_update_local() argument
857 if (inp == NULL || entry == NULL) { in soflow_entry_update_local()
861 if (entry->soflow_outifindex == 0 && (inp->inp_last_outifp != NULL || rcv_ifindex != 0)) { in soflow_entry_update_local()
862 entry->soflow_outifindex = inp->inp_last_outifp ? inp->inp_last_outifp->if_index : rcv_ifindex; in soflow_entry_update_local()
863 SOFLOW_ENTRY_LOG(LOG_INFO, db->soflow_db_so, entry, entry->soflow_debug, "Updated outifp"); in soflow_entry_update_local()
866 if (soflow_entry_local_address_needs_update(entry)) { in soflow_entry_update_local()
872 …boolean_t result = soflow_udp_get_address_from_control(entry->soflow_family, control, &addr_ptr, &… in soflow_entry_update_local()
875 switch (entry->soflow_family) { in soflow_entry_update_local()
900 soflow_fill_hash_entry_from_address(entry, TRUE, local, TRUE); in soflow_entry_update_local()
902 soflow_fill_hash_entry_from_inp(entry, TRUE, inp, TRUE); in soflow_entry_update_local()
904 if (entry->soflow_laddr_updated) { in soflow_entry_update_local()
905 SOFLOW_ENTRY_LOG(LOG_INFO, db->soflow_db_so, entry, entry->soflow_debug, "Updated address"); in soflow_entry_update_local()
909 if (soflow_entry_local_port_needs_update(db->soflow_db_so, entry)) { in soflow_entry_update_local()
910 soflow_fill_hash_entry_from_inp(entry, TRUE, inp, TRUE); in soflow_entry_update_local()
911 if (entry->soflow_lport_updated) { in soflow_entry_update_local()
912 SOFLOW_ENTRY_LOG(LOG_INFO, db->soflow_db_so, entry, entry->soflow_debug, "Updated port"); in soflow_entry_update_local()
1260 soflow_free_flow(struct soflow_hash_entry *entry) in soflow_free_flow() argument
1262 SOFLOW_ENTRY_FREE(entry); in soflow_free_flow()
1377 struct soflow_hash_entry *entry = NULL; in soflow_gc_cleanup() local
1403 LIST_FOREACH_SAFE(entry, flowhash, soflow_entry_link, temp_entry) { in soflow_gc_cleanup()
1404 if (entry->soflow_gc || entry->soflow_feat_gc) { in soflow_gc_cleanup()
1405 if (entry->soflow_feat_ctxt != NULL && soflow_feat_gc_perform_func_ptr != NULL) { in soflow_gc_cleanup()
1406 soflow_feat_gc_perform_func_ptr(so, entry); in soflow_gc_cleanup()
1407 entry->soflow_feat_ctxt = NULL; in soflow_gc_cleanup()
1408 entry->soflow_feat_ctxt_id = 0; in soflow_gc_cleanup()
1410 entry->soflow_feat_gc = 0; in soflow_gc_cleanup()
1412 if (entry->soflow_gc) { in soflow_gc_cleanup()
1413 SOFLOW_ENTRY_LOG(LOG_INFO, so, entry, entry->soflow_debug, "GC cleanup entry"); in soflow_gc_cleanup()
1414 entry->soflow_gc = 0; in soflow_gc_cleanup()
1415 soflow_db_remove_entry(db, entry); in soflow_gc_cleanup()
1519 struct soflow_hash_entry *entry = NULL; in soflow_db_apply() local
1537 LIST_FOREACH_SAFE(entry, flowhash, soflow_entry_link, temp_entry) { in soflow_db_apply()
1538 if (entry_apply_fn(db->soflow_db_so, entry, context) == false) { in soflow_db_apply()