diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-10-20 16:31:49 +0000 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-10-20 16:31:49 +0000 |
| commit | 0a538fc98fb662b4cf2d927ac29fd9af4a4fab03 (patch) | |
| tree | f6dbe2af92d44f9a77e4802cefb440811dd69584 /lib/zclient.c | |
| parent | e52702f29d003585dcfbb4914b2a52d77a177739 (diff) | |
| parent | 41246cb61418102f9f3bfa3e0acfce90c7798e67 (diff) | |
Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Conflicts:
isisd/isis_routemap.c
zebra/rt_netlink.c
Diffstat (limited to 'lib/zclient.c')
| -rw-r--r-- | lib/zclient.c | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/lib/zclient.c b/lib/zclient.c index fa8150c5a1..84f7314baa 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -80,20 +80,20 @@ zclient_free (struct zclient *zclient) XFREE (MTYPE_ZCLIENT, zclient); } -int +u_short * redist_check_instance (struct redist_proto *red, u_short instance) { struct listnode *node; u_short *id; if (!red->instances) - return 0; + return NULL; for (ALL_LIST_ELEMENTS_RO (red->instances, node, id)) if (*id == instance) - return 1; + return id; - return 0; + return NULL; } void @@ -106,7 +106,7 @@ redist_add_instance (struct redist_proto *red, u_short instance) if (!red->instances) red->instances = list_new(); - in = (u_short *)calloc(1, sizeof(u_short)); + in = calloc (1, sizeof(u_short)); *in = instance; listnode_add (red->instances, in); } @@ -114,25 +114,19 @@ redist_add_instance (struct redist_proto *red, u_short instance) void redist_del_instance (struct redist_proto *red, u_short instance) { - struct listnode *node; - u_short *id = NULL; + u_short *id; - if (!red->instances) + id = redist_check_instance (red, instance); + if (! id) return; - for (ALL_LIST_ELEMENTS_RO (red->instances, node, id)) - if (*id == instance) - break; - - if (id) + listnode_delete(red->instances, id); + free (id); + if (!red->instances->count) { - listnode_delete(red->instances, id); - if (!red->instances->count) - { - red->enabled = 0; - list_free(red->instances); - red->instances = NULL; - } + red->enabled = 0; + list_free(red->instances); + red->instances = NULL; } } @@ -167,11 +161,16 @@ zclient_stop (struct zclient *zclient) zclient->fail = 0; for (afi = AFI_IP; afi < AFI_MAX; afi++) - for (i = 0; i < ZEBRA_ROUTE_MAX; i++) - { - vrf_bitmap_free(zclient->redist[afi][i]); - zclient->redist[afi][i] = VRF_BITMAP_NULL; - } + { + for (i = 0; i < ZEBRA_ROUTE_MAX; i++) + { + vrf_bitmap_free(zclient->redist[afi][i]); + zclient->redist[afi][i] = VRF_BITMAP_NULL; + } + redist_del_instance(&zclient->mi_redist[afi][zclient->redist_default], + zclient->instance); + } + vrf_bitmap_free(zclient->default_information); zclient->default_information = VRF_BITMAP_NULL; } |
