]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Allow zebra_find_client to match on instance as well 1438/head
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 27 Nov 2017 14:25:32 +0000 (09:25 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 27 Nov 2017 14:25:32 +0000 (09:25 -0500)
zebra_find_client needs to match on instance as well so
protocols like ospfd will work correctly for notification.

Modify the zebra_find_client code to accept the instance
number and to pass it in appropriately.

Signed-off-by: Doanld Sharp <sharpd@cumulusnetworks.com>
zebra/zebra_rib.c
zebra/zebra_vxlan.c
zebra/zserv.c
zebra/zserv.h

index b7b68b72722d5709d7e801e469e7192c7a1c2dd1..791f319120be91c1a175511340c6e95bf54b631a 100644 (file)
@@ -1033,8 +1033,9 @@ int rib_install_kernel(struct route_node *rn, struct route_entry *re,
         * know that they've lost
         */
        if (old && old != re)
-               zsend_route_notify_owner(old->type, old->vrf_id,
-                                        p, ZAPI_ROUTE_BETTER_ADMIN_WON);
+               zsend_route_notify_owner(old->type, old->instance,
+                                        old->vrf_id, p,
+                                        ZAPI_ROUTE_BETTER_ADMIN_WON);
 
        /*
         * Make sure we update the FPM any time we send new information to
@@ -1055,10 +1056,10 @@ int rib_install_kernel(struct route_node *rn, struct route_entry *re,
                        else
                                UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
                }
-               zsend_route_notify_owner(re->type, re->vrf_id,
+               zsend_route_notify_owner(re->type, re->instance, re->vrf_id,
                                         p, ZAPI_ROUTE_INSTALLED);
        } else
-               zsend_route_notify_owner(re->type, re->vrf_id,
+               zsend_route_notify_owner(re->type, re->instance, re->vrf_id,
                                         p, ZAPI_ROUTE_FAIL_INSTALL);
 
        return ret;
index f5caf9d0b965f6512f76c11f8b5bc1084b028644..9c70b55a1a4e4cb4a4d82567efa2620ccbc0d50b 100644 (file)
@@ -759,7 +759,7 @@ static int zvni_macip_send_msg_to_client(vni_t vni,
        char buf[ETHER_ADDR_STRLEN];
        char buf2[INET6_ADDRSTRLEN];
 
-       client = zebra_find_client(ZEBRA_ROUTE_BGP);
+       client = zebra_find_client(ZEBRA_ROUTE_BGP, 0);
        /* BGP may not be running. */
        if (!client)
                return 0;
@@ -2122,7 +2122,7 @@ static int zvni_send_add_to_client(zebra_vni_t *zvni)
        struct zserv *client;
        struct stream *s;
 
-       client = zebra_find_client(ZEBRA_ROUTE_BGP);
+       client = zebra_find_client(ZEBRA_ROUTE_BGP, 0);
        /* BGP may not be running. */
        if (!client)
                return 0;
@@ -2154,7 +2154,7 @@ static int zvni_send_del_to_client(vni_t vni)
        struct zserv *client;
        struct stream *s;
 
-       client = zebra_find_client(ZEBRA_ROUTE_BGP);
+       client = zebra_find_client(ZEBRA_ROUTE_BGP, 0);
        /* BGP may not be running. */
        if (!client)
                return 0;
index 7b1839930ed4eb55be25d9658e944ee7e3e74d6d..b6d70084c0c389c6c379f11e954884918b732ed3 100644 (file)
@@ -988,15 +988,15 @@ static int zsend_ipv4_nexthop_lookup_mrib(struct zserv *client,
        return zebra_server_send_message(client);
 }
 
-int zsend_route_notify_owner(u_char proto, vrf_id_t vrf_id,
-                            struct prefix *p,
+int zsend_route_notify_owner(u_char proto, u_short instance,
+                            vrf_id_t vrf_id, struct prefix *p,
                             enum zapi_route_notify_owner note)
 {
        struct zserv *client;
        struct stream *s;
        uint8_t blen;
 
-       client = zebra_find_client(proto);
+       client = zebra_find_client(proto, instance);
        if (!client || !client->notify_owner) {
                if (IS_ZEBRA_DEBUG_PACKET) {
                        char buff[PREFIX_STRLEN];
@@ -3003,13 +3003,14 @@ static void zebra_show_client_brief(struct vty *vty, struct zserv *client)
                client->v6_route_del_cnt);
 }
 
-struct zserv *zebra_find_client(u_char proto)
+struct zserv *zebra_find_client(u_char proto, u_short instance)
 {
        struct listnode *node, *nnode;
        struct zserv *client;
 
        for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) {
-               if (client->proto == proto)
+               if (client->proto == proto &&
+                   client->instance == instance)
                        return client;
        }
 
index a62f1c89fc4adef6a0e708103840e04281383d7a..6077dc105a42e26cb50c55d2d14d03ae42bf9302 100644 (file)
@@ -185,8 +185,8 @@ extern int zsend_interface_vrf_update(struct zserv *, struct interface *,
 extern int zsend_interface_link_params(struct zserv *, struct interface *);
 extern int zsend_pw_update(struct zserv *, struct zebra_pw *);
 
-extern int zsend_route_notify_owner(u_char proto, vrf_id_t vrf_id,
-                                   struct prefix *p,
+extern int zsend_route_notify_owner(u_char proto, u_short instance,
+                                   vrf_id_t vrf_id, struct prefix *p,
                                    enum zapi_route_notify_owner note);
 
 extern pid_t pid;
@@ -197,7 +197,7 @@ extern void zserv_nexthop_num_warn(const char *, const struct prefix *,
                                   const unsigned int);
 extern int zebra_server_send_message(struct zserv *client);
 
-extern struct zserv *zebra_find_client(u_char proto);
+extern struct zserv *zebra_find_client(u_char proto, u_short instance);
 
 #if defined(HANDLE_ZAPI_FUZZING)
 extern void zserv_read_file(char *input);