forked from Mirror/frr
zebra: clean pbr_iptable interface_name_list free
Clean up code related to pbr_iptable->interface_name_list free. This is a cosmetic change. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
This commit is contained in:
parent
92cddedffd
commit
55ea74d630
|
@ -3878,6 +3878,7 @@ static inline void zread_iptable(ZAPI_HANDLER_ARGS)
|
|||
s = msg;
|
||||
|
||||
zpi->interface_name_list = list_new();
|
||||
zpi->interface_name_list->del = zebra_pbr_iptable_interface_name_list_free;
|
||||
zpi->sock = client->sock;
|
||||
zpi->vrf_id = zvrf->vrf->vrf_id;
|
||||
STREAM_GETL(s, zpi->unique);
|
||||
|
|
|
@ -383,22 +383,15 @@ bool zebra_pbr_ipset_entry_hash_equal(const void *arg1, const void *arg2)
|
|||
static void _zebra_pbr_iptable_free_all(void *arg, bool all)
|
||||
{
|
||||
struct zebra_pbr_iptable *iptable;
|
||||
struct listnode *node, *nnode;
|
||||
char *name;
|
||||
|
||||
iptable = (struct zebra_pbr_iptable *)arg;
|
||||
|
||||
if (all)
|
||||
hook_call(zebra_pbr_iptable_update, 0, iptable);
|
||||
|
||||
if (iptable->interface_name_list) {
|
||||
for (ALL_LIST_ELEMENTS(iptable->interface_name_list, node,
|
||||
nnode, name)) {
|
||||
XFREE(MTYPE_PBR_IPTABLE_IFNAME, name);
|
||||
list_delete_node(iptable->interface_name_list, node);
|
||||
}
|
||||
if (iptable->interface_name_list)
|
||||
list_delete(&iptable->interface_name_list);
|
||||
}
|
||||
|
||||
XFREE(MTYPE_PBR_IPTABLE, iptable);
|
||||
}
|
||||
|
||||
|
@ -1003,6 +996,13 @@ void zebra_pbr_del_ipset_entry(struct zebra_pbr_ipset_entry *ipset)
|
|||
__func__);
|
||||
}
|
||||
|
||||
void zebra_pbr_iptable_interface_name_list_free(void *arg)
|
||||
{
|
||||
char *name = arg;
|
||||
|
||||
XFREE(MTYPE_PBR_IPTABLE_IFNAME, name);
|
||||
}
|
||||
|
||||
static void *pbr_iptable_alloc_intern(void *arg)
|
||||
{
|
||||
struct zebra_pbr_iptable *zpi;
|
||||
|
@ -1017,6 +1017,7 @@ static void *pbr_iptable_alloc_intern(void *arg)
|
|||
/* Deep structure copy */
|
||||
memcpy(new, zpi, sizeof(*zpi));
|
||||
new->interface_name_list = list_new();
|
||||
new->interface_name_list->del = zebra_pbr_iptable_interface_name_list_free;
|
||||
|
||||
if (zpi->interface_name_list) {
|
||||
for (ALL_LIST_ELEMENTS_RO(zpi->interface_name_list, ln, ifname))
|
||||
|
@ -1043,16 +1044,7 @@ void zebra_pbr_del_iptable(struct zebra_pbr_iptable *iptable)
|
|||
lookup = hash_lookup(zrouter.iptable_hash, iptable);
|
||||
(void)dplane_pbr_iptable_delete(iptable);
|
||||
if (lookup) {
|
||||
struct listnode *node, *nnode;
|
||||
char *name;
|
||||
|
||||
hash_release(zrouter.iptable_hash, lookup);
|
||||
for (ALL_LIST_ELEMENTS(lookup->interface_name_list,
|
||||
node, nnode, name)) {
|
||||
XFREE(MTYPE_PBR_IPTABLE_IFNAME, name);
|
||||
list_delete_node(lookup->interface_name_list,
|
||||
node);
|
||||
}
|
||||
list_delete(&lookup->interface_name_list);
|
||||
XFREE(MTYPE_PBR_IPTABLE, lookup);
|
||||
} else
|
||||
|
|
|
@ -196,6 +196,8 @@ struct zebra_pbr_ipset *zebra_pbr_lookup_ipset_pername(char *ipsetname);
|
|||
void zebra_pbr_add_ipset_entry(struct zebra_pbr_ipset_entry *ipset);
|
||||
void zebra_pbr_del_ipset_entry(struct zebra_pbr_ipset_entry *ipset);
|
||||
|
||||
void zebra_pbr_iptable_interface_name_list_free(void *arg);
|
||||
|
||||
void zebra_pbr_add_iptable(struct zebra_pbr_iptable *iptable);
|
||||
void zebra_pbr_del_iptable(struct zebra_pbr_iptable *iptable);
|
||||
void zebra_pbr_process_iptable(struct zebra_dplane_ctx *ctx);
|
||||
|
|
Loading…
Reference in a new issue