summaryrefslogtreecommitdiffstats
path: root/sharpd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2020-10-17 03:44:29 +0200
committerDonald Sharp <sharpd@nvidia.com>2020-10-17 03:44:29 +0200
commit2b442f69e22d1592a67490731a6e9d7443351476 (patch)
tree1671d647793de2ae81371f89a45be3fa9c98808a /sharpd
parentMerge pull request #7235 from opensourcerouting/acl-wildcard-fix (diff)
downloadfrr-2b442f69e22d1592a67490731a6e9d7443351476.tar.xz
frr-2b442f69e22d1592a67490731a6e9d7443351476.zip
sharpd: Fix nexthop group name collision
If you have two nexthop groups named one oneone then the sharp daemon will treat them as the same nexthop group. This is because we are doign this: static int sharp_nhg_compare_func(const struct sharp_nhg *a, const struct sharp_nhg *b) { return strncmp(a->name, b->name, strlen(a->name)); } The strlen should be the size of the array of name. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'sharpd')
-rw-r--r--sharpd/sharp_nht.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sharpd/sharp_nht.c b/sharpd/sharp_nht.c
index 7484dd3b0..077e2b29e 100644
--- a/sharpd/sharp_nht.c
+++ b/sharpd/sharp_nht.c
@@ -77,7 +77,8 @@ struct sharp_nhg {
uint32_t id;
- char name[256];
+#define NHG_NAME_LEN 256
+ char name[NHG_NAME_LEN];
bool installed;
};
@@ -95,7 +96,7 @@ struct sharp_nhg_rb_head nhg_head;
static int sharp_nhg_compare_func(const struct sharp_nhg *a,
const struct sharp_nhg *b)
{
- return strncmp(a->name, b->name, strlen(a->name));
+ return strncmp(a->name, b->name, NHG_NAME_LEN);
}
DECLARE_RBTREE_UNIQ(sharp_nhg_rb, struct sharp_nhg, mylistitem,