return num;
}
-struct nexthop *nexthop_exists(struct nexthop_group *nhg, struct nexthop *nh)
+struct nexthop *nexthop_exists(const struct nexthop_group *nhg,
+ const struct nexthop *nh)
{
struct nexthop *nexthop;
return NULL;
}
+bool nexthop_group_equal(const struct nexthop_group *nhg1,
+ const struct nexthop_group *nhg2)
+{
+ struct nexthop *nh = NULL;
+
+ if (nhg1 && !nhg2)
+ return false;
+
+ if (!nhg1 && !nhg2)
+ return false;
+
+ if (nexthop_group_nexthop_num(nhg1) != nexthop_group_nexthop_num(nhg2))
+ return false;
+
+ for (ALL_NEXTHOPS_PTR(nhg1, nh)) {
+ if (!nexthop_exists(nhg2, nh))
+ return false;
+ }
+
+ return true;
+}
+
struct nexthop_group *nexthop_group_new(void)
{
return XCALLOC(MTYPE_NEXTHOP_GROUP, sizeof(struct nexthop_group));
void nexthop_group_interface_state_change(struct interface *ifp,
ifindex_t oldifindex);
-extern struct nexthop *nexthop_exists(struct nexthop_group *nhg,
- struct nexthop *nh);
+extern struct nexthop *nexthop_exists(const struct nexthop_group *nhg,
+ const struct nexthop *nh);
+extern bool nexthop_group_equal(const struct nexthop_group *nhg1,
+ const struct nexthop_group *nhg2);
extern struct nexthop_group_cmd *nhgc_find(const char *name);