]> git.proxmox.com Git - mirror_frr.git/blobdiff - bfdd/ptm_adapter.c
zebra: include lib/queue.h in zebra dataplane
[mirror_frr.git] / bfdd / ptm_adapter.c
index 4287891621f06306c589b96ebeb9be04708508bb..f9c7c16fb1349e860c981ba223ae8e4336ed6bc7 100644 (file)
@@ -289,7 +289,7 @@ static int _ptm_msg_read(struct stream *msg, int command,
 {
        uint32_t pid;
        uint8_t ttl __attribute__((unused));
-       uint8_t ifnamelen;
+       size_t ifnamelen;
 
        /*
         * Register/Deregister/Update Message format:
@@ -381,6 +381,21 @@ static int _ptm_msg_read(struct stream *msg, int command,
                if (bpc->bpc_has_localif) {
                        STREAM_GET(bpc->bpc_localif, msg, ifnamelen);
                        bpc->bpc_localif[ifnamelen] = 0;
+
+                       /*
+                        * IPv6 link-local addresses must use scope id,
+                        * otherwise the session lookup will always fail
+                        * and we'll have multiple sessions showing up.
+                        *
+                        * This problem only happens with single hop
+                        * since it is not possible to have link-local
+                        * address for multi hop sessions.
+                        */
+                       if (bpc->bpc_ipv4 == false
+                           && IN6_IS_ADDR_LINKLOCAL(
+                                      &bpc->bpc_peer.sa_sin6.sin6_addr))
+                               bpc->bpc_peer.sa_sin6.sin6_scope_id =
+                                       ptm_bfd_fetch_ifindex(bpc->bpc_localif);
                }
        }
 
@@ -566,7 +581,7 @@ static void bfdd_zebra_connected(struct zclient *zc)
 
 void bfdd_zclient_init(struct zebra_privs_t *bfdd_priv)
 {
-       zclient = zclient_new_notify(master, &zclient_options_default);
+       zclient = zclient_new(master, &zclient_options_default);
        assert(zclient != NULL);
        zclient_init(zclient, ZEBRA_ROUTE_BFD, 0, bfdd_priv);