summaryrefslogtreecommitdiff
path: root/nest/rt-attr.c
diff options
context:
space:
mode:
Diffstat (limited to 'nest/rt-attr.c')
-rw-r--r--nest/rt-attr.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/nest/rt-attr.c b/nest/rt-attr.c
index 8620d321..28d956bc 100644
--- a/nest/rt-attr.c
+++ b/nest/rt-attr.c
@@ -202,7 +202,7 @@ nexthop__same(struct nexthop *x, struct nexthop *y)
}
static int
-nexthop_compare_node(const struct nexthop *x, const struct nexthop *y)
+nexthop_compare_node(const struct nexthop *x, const struct nexthop *y)
{
int r;
@@ -278,18 +278,22 @@ nexthop_merge(struct nexthop *x, struct nexthop *y, int rx, int ry, int max, lin
while ((x || y) && max--)
{
int cmp = nexthop_compare_node(x, y);
+
if (cmp < 0)
{
+ ASSUME(x);
*n = rx ? x : nexthop_copy_node(x, lp);
x = x->next;
}
else if (cmp > 0)
{
+ ASSUME(y);
*n = ry ? y : nexthop_copy_node(y, lp);
y = y->next;
}
else
{
+ ASSUME(x && y);
*n = rx ? x : (ry ? y : nexthop_copy_node(x, lp));
x = x->next;
y = y->next;
@@ -786,7 +790,7 @@ ea_free(ea_list *o)
}
static int
-get_generic_attr(eattr *a, byte **buf, int buflen UNUSED)
+get_generic_attr(const eattr *a, byte **buf, int buflen UNUSED)
{
if (a->id == EA_GEN_IGP_METRIC)
{
@@ -798,7 +802,7 @@ get_generic_attr(eattr *a, byte **buf, int buflen UNUSED)
}
void
-ea_format_bitfield(struct eattr *a, byte *buf, int bufsize, const char **names, int min, int max)
+ea_format_bitfield(const struct eattr *a, byte *buf, int bufsize, const char **names, int min, int max)
{
byte *bound = buf + bufsize - 32;
u32 data = a->u.data;
@@ -894,7 +898,7 @@ ea_show_lc_set(struct cli *c, const struct adata *ad, byte *pos, byte *buf, byte
* get_attr() hook, it's consulted first.
*/
void
-ea_show(struct cli *c, eattr *e)
+ea_show(struct cli *c, const eattr *e)
{
struct protocol *p;
int status = GA_UNKNOWN;