]> git.proxmox.com Git - mirror_frr.git/blobdiff - bfdd/bfd.c
Merge pull request #3403 from opensourcerouting/bfd-fix-mhop-bsd
[mirror_frr.git] / bfdd / bfd.c
index cf7c027db5d8f8022c1825a5473589cca5dae11a..814366f32060ad19735d537f04facd616000464d 100644 (file)
@@ -157,7 +157,8 @@ void ptm_bfd_echo_stop(struct bfd_session *bfd, int polling)
 void ptm_bfd_echo_start(struct bfd_session *bfd)
 {
        bfd->echo_detect_TO = (bfd->remote_detect_mult * bfd->echo_xmt_TO);
-       ptm_bfd_echo_xmt_TO(bfd);
+       if (bfd->echo_detect_TO > 0)
+               ptm_bfd_echo_xmt_TO(bfd);
 
        bfd->polling = 1;
        bfd->new_timers.desired_min_tx = bfd->up_min_tx;
@@ -324,7 +325,8 @@ int bfd_echo_xmt_cb(struct thread *t)
 {
        struct bfd_session *bs = THREAD_ARG(t);
 
-       ptm_bfd_echo_xmt_TO(bs);
+       if (bs->echo_xmt_TO > 0)
+               ptm_bfd_echo_xmt_TO(bs);
 
        return 0;
 }
@@ -859,15 +861,10 @@ static struct hash *bfd_vrf_hash;
 static struct hash *bfd_iface_hash;
 
 static unsigned int bfd_id_hash_do(void *p);
-static int bfd_id_hash_cmp(const void *n1, const void *n2);
 static unsigned int bfd_shop_hash_do(void *p);
-static int bfd_shop_hash_cmp(const void *n1, const void *n2);
 static unsigned int bfd_mhop_hash_do(void *p);
-static int bfd_mhop_hash_cmp(const void *n1, const void *n2);
 static unsigned int bfd_vrf_hash_do(void *p);
-static int bfd_vrf_hash_cmp(const void *n1, const void *n2);
 static unsigned int bfd_iface_hash_do(void *p);
-static int bfd_iface_hash_cmp(const void *n1, const void *n2);
 
 static void _shop_key(struct bfd_session *bs, const struct bfd_shop_key *shop);
 static void _shop_key2(struct bfd_session *bs, const struct bfd_shop_key *shop);
@@ -887,7 +884,7 @@ static unsigned int bfd_id_hash_do(void *p)
        return jhash_1word(bs->discrs.my_discr, 0);
 }
 
-static int bfd_id_hash_cmp(const void *n1, const void *n2)
+static bool bfd_id_hash_cmp(const void *n1, const void *n2)
 {
        const struct bfd_session *bs1 = n1, *bs2 = n2;
 
@@ -902,7 +899,7 @@ static unsigned int bfd_shop_hash_do(void *p)
        return jhash(&bs->shop, sizeof(bs->shop), 0);
 }
 
-static int bfd_shop_hash_cmp(const void *n1, const void *n2)
+static bool bfd_shop_hash_cmp(const void *n1, const void *n2)
 {
        const struct bfd_session *bs1 = n1, *bs2 = n2;
 
@@ -917,7 +914,7 @@ static unsigned int bfd_mhop_hash_do(void *p)
        return jhash(&bs->mhop, sizeof(bs->mhop), 0);
 }
 
-static int bfd_mhop_hash_cmp(const void *n1, const void *n2)
+static bool bfd_mhop_hash_cmp(const void *n1, const void *n2)
 {
        const struct bfd_session *bs1 = n1, *bs2 = n2;
 
@@ -932,7 +929,7 @@ static unsigned int bfd_vrf_hash_do(void *p)
        return jhash_1word(vrf->vrf_id, 0);
 }
 
-static int bfd_vrf_hash_cmp(const void *n1, const void *n2)
+static bool bfd_vrf_hash_cmp(const void *n1, const void *n2)
 {
        const struct bfd_vrf *v1 = n1, *v2 = n2;
 
@@ -947,7 +944,7 @@ static unsigned int bfd_iface_hash_do(void *p)
        return string_hash_make(iface->ifname);
 }
 
-static int bfd_iface_hash_cmp(const void *n1, const void *n2)
+static bool bfd_iface_hash_cmp(const void *n1, const void *n2)
 {
        const struct bfd_iface *i1 = n1, *i2 = n2;
 
@@ -1043,7 +1040,7 @@ struct bfd_session *bfd_mhop_lookup(struct bfd_mhop_key mhop)
 
        _mhop_key(&bs, &mhop);
 
-       return hash_lookup(bfd_shop_hash, &bs);
+       return hash_lookup(bfd_mhop_hash, &bs);
 }
 
 struct bfd_vrf *bfd_vrf_lookup(int vrf_id)