add ct-zone filtering inat src host#16
Conversation
4133437 to
a7976ff
Compare
|
|
||
| ht = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, NULL); | ||
| for (i = 0; i < num_ct_zones; i++) { | ||
| LOG(VERBOSE, "%s : Trying to insert %u ct_zone into ht", __func__, |
There was a problem hiding this comment.
you can remove this log.
or define:
int ct_zone = atoi(ct_zones_list[i])
and reuse in L101 and L103
| #include "log.h" | ||
|
|
||
|
|
||
| enum filter_type { |
There was a problem hiding this comment.
missing documentation.
| enum filter_type { | ||
| FILTER_BY_CT_ZONE, | ||
| FILTER_BY_IP | ||
| }; |
There was a problem hiding this comment.
nit: add line after this line.
| { | ||
| uint32_t ct_id; | ||
| struct conntrack_entry *ct_entry; | ||
|
|
| } | ||
|
|
||
| /** | ||
| * Deletes the entry from the conntrack_store. |
| __func__, strerror(ret)); | ||
| } | ||
|
|
||
| dump_conntrack(targs); |
There was a problem hiding this comment.
Is there a reason to use event args here? those were meant for different threads.
you can simply pass ct_zones_to_migrate as second arg right?
for IP case you can set it to NULL/empty:
dump_conntrack(ips_to_migrate, NULL);
for the ct-zone case set, ips_to_migrate as NULL/empty.
dump_conntrack(NULL, ct_zones_to_migrate);
| void | ||
| init_lmct_config(); | ||
|
|
||
| void |
There was a problem hiding this comment.
on another note, let us move this to common.h and the corresponding implementation in common.c instead.
lmct_config is basically something which is read from the conf file and populated.
filter_type is read from args instead.
| nfct_attr_is_set(ct, ATTR_ORIG_ZONE) > 0 || | ||
| nfct_attr_is_set(ct, ATTR_REPL_ZONE) > 0) { | ||
| return false; | ||
| if(fltr_type == FILTER_BY_IP) { |
| is_entry_useful = is_src_or_dst_in_hashtable(src_addr, dst_addr, | ||
| ips_to_migrate); | ||
| } else { | ||
| zone = nfct_get_attr_u16(ct, ATTR_ZONE); |
There was a problem hiding this comment.
you need to first check if the zone is actually present in the entry.
|
|
||
| update_conntrack_store(conn_store, ct, type); | ||
| bool add_to_conntrack_store = true; | ||
| if( fltr_type == FILTER_BY_CT_ZONE ){ |
No description provided.