Skip to content

Commit

Permalink
* pre_tag_map: deprecated nat_event key (replaced by is_nel, is_nsel)
Browse files Browse the repository at this point in the history
  • Loading branch information
paololucente committed Nov 27, 2024
1 parent 58da79c commit eebedd9
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 45 deletions.
1 change: 0 additions & 1 deletion src/pretag-data.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const struct _map_dictionary_line tag_map_dictionary[] = {
{"flowset_id", PT_map_flowset_id_handler},
{"sample_type", PT_map_sample_type_handler},
{"direction", PT_map_direction_handler},
{"nat_event", PT_map_nat_event_handler}, /* XXX: to be deprecated */
{"src_as", PT_map_src_as_handler},
{"dst_as", PT_map_dst_as_handler},
{"peer_src_as", PT_map_peer_src_as_handler},
Expand Down
1 change: 0 additions & 1 deletion src/pretag.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ struct id_entry_key {
pt_uint8_t is_nsel;
pt_uint8_t is_nel;
pt_uint8_t direction;
pt_uint8_t nat_event;
pt_uint32_t src_as;
pt_uint32_t dst_as;
pt_uint32_t peer_src_as;
Expand Down
41 changes: 0 additions & 41 deletions src/pretag_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -825,25 +825,6 @@ int PT_map_direction_handler(char *filename, struct id_entry *e, char *value, st
return FALSE;
}

int PT_map_nat_event_handler(char *filename, struct id_entry *e, char *value, struct plugin_requests *req, int acct_type)
{
int x = 0;

e->key.nat_event.neg = pt_check_neg(&value, &((struct id_table *) req->key_value_table)->flags);
e->key.nat_event.n = atoi(value);
for (x = 0; e->func[x]; x++) {
if (e->func_type[x] == PRETAG_NAT_EVENT) {
Log(LOG_WARNING, "WARN ( %s/%s ): [%s] Multiple 'nat_event' clauses part of the same statement.\n", config.name, config.type, filename);
return TRUE;
}
}

if (config.acct_type == ACCT_NF) e->func[x] = pretag_nat_event_handler;
if (e->func[x]) e->func_type[x] = PRETAG_NAT_EVENT;

return FALSE;
}

int PT_map_src_as_handler(char *filename, struct id_entry *e, char *value, struct plugin_requests *req, int acct_type)
{
as_t tmp;
Expand Down Expand Up @@ -2388,28 +2369,6 @@ int pretag_direction_handler(struct packet_ptrs *pptrs, void *unused, void *e)
}
}

int pretag_nat_event_handler(struct packet_ptrs *pptrs, void *unused, void *e)
{
struct id_entry *entry = e;
struct struct_header_v5 *hdr = (struct struct_header_v5 *) pptrs->f_header;
struct template_cache_entry *tpl = (struct template_cache_entry *) pptrs->f_tpl;
u_int8_t nat_event = 0;

if (!pptrs->f_data) return TRUE;

switch (hdr->version) {
case 10:
case 9:
if (OTPL_LAST_LEN(NF9_NAT_EVENT) == 1) {
OTPL_CP_LAST(&nat_event, NF9_NAT_EVENT, 1);
}
if (entry->key.nat_event.n == nat_event) return (FALSE | entry->key.nat_event.neg);
else return (TRUE ^ entry->key.nat_event.neg);
default:
return TRUE; /* this field does not exist: condition is always true */
}
}

int pretag_mpls_vpn_id_in_handler(struct packet_ptrs *pptrs, void *unused, void *e)
{
struct id_entry *entry = e;
Expand Down
2 changes: 0 additions & 2 deletions src/pretag_handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ extern int PT_map_is_bi_flow_handler(char *, struct id_entry *, char *, struct p
extern int PT_map_is_nsel_handler(char *, struct id_entry *, char *, struct plugin_requests *, int);
extern int PT_map_is_nel_handler(char *, struct id_entry *, char *, struct plugin_requests *, int);
extern int PT_map_direction_handler(char *, struct id_entry *, char *, struct plugin_requests *, int);
extern int PT_map_nat_event_handler(char *, struct id_entry *, char *, struct plugin_requests *, int);
extern int PT_map_src_as_handler(char *, struct id_entry *, char *, struct plugin_requests *, int);
extern int PT_map_dst_as_handler(char *, struct id_entry *, char *, struct plugin_requests *, int);
extern int PT_map_peer_src_as_handler(char *, struct id_entry *, char *, struct plugin_requests *, int);
Expand Down Expand Up @@ -181,7 +180,6 @@ extern int pretag_is_bi_flow_handler(struct packet_ptrs *, void *, void *);
extern int pretag_is_nsel_handler(struct packet_ptrs *, void *, void *);
extern int pretag_is_nel_handler(struct packet_ptrs *, void *, void *);
extern int pretag_direction_handler(struct packet_ptrs *, void *, void *);
extern int pretag_nat_event_handler(struct packet_ptrs *, void *, void *);
extern int pretag_mpls_vpn_id_in_handler(struct packet_ptrs *, void *, void *);
extern int pretag_mpls_vpn_id_out_handler(struct packet_ptrs *, void *, void *);
extern int pretag_mpls_vpn_rd_handler(struct packet_ptrs *, void *, void *);
Expand Down

0 comments on commit eebedd9

Please sign in to comment.