summaryrefslogtreecommitdiff
path: root/lib/zclient.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/zclient.c')
-rw-r--r--lib/zclient.c44
1 files changed, 36 insertions, 8 deletions
diff --git a/lib/zclient.c b/lib/zclient.c
index 808aa18bbe..c5016d22e2 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -871,6 +871,37 @@ static int zapi_nexthop_cmp_no_labels(const struct zapi_nexthop *next1,
break;
}
+ if (next1->srte_color < next2->srte_color)
+ return -1;
+ if (next1->srte_color > next2->srte_color)
+ return 1;
+
+ if (CHECK_FLAG(next1->flags, NEXTHOP_FLAG_HAS_BACKUP) ||
+ CHECK_FLAG(next2->flags, NEXTHOP_FLAG_HAS_BACKUP)) {
+
+ if (!CHECK_FLAG(next1->flags, NEXTHOP_FLAG_HAS_BACKUP) &&
+ CHECK_FLAG(next2->flags, NEXTHOP_FLAG_HAS_BACKUP))
+ return -1;
+
+ if (CHECK_FLAG(next1->flags, NEXTHOP_FLAG_HAS_BACKUP) &&
+ !CHECK_FLAG(next2->flags, NEXTHOP_FLAG_HAS_BACKUP))
+ return 1;
+
+ if (next1->backup_num > 0 || next2->backup_num > 0) {
+
+ if (next1->backup_num < next2->backup_num)
+ return -1;
+
+ if (next1->backup_num > next2->backup_num)
+ return 1;
+
+ ret = memcmp(next1->backup_idx,
+ next2->backup_idx, next1->backup_num);
+ if (ret != 0)
+ return ret;
+ }
+ }
+
return 0;
}
@@ -1393,7 +1424,7 @@ int zapi_pbr_rule_encode(uint8_t cmd, struct stream *s, struct pbr_rule *zrule)
stream_putw(s, zrule->filter.fwmark); /* fwmark */
stream_putl(s, zrule->action.table);
- stream_putl(s, zrule->ifindex);
+ stream_put(s, zrule->ifname, INTERFACE_NAMSIZ);
/* Put length at the first point of the stream. */
stream_putw_at(s, 0, stream_get_endp(s));
@@ -1423,26 +1454,23 @@ stream_failure:
}
bool zapi_rule_notify_decode(struct stream *s, uint32_t *seqno,
- uint32_t *priority, uint32_t *unique,
- ifindex_t *ifindex,
+ uint32_t *priority, uint32_t *unique, char *ifname,
enum zapi_rule_notify_owner *note)
{
uint32_t prio, seq, uni;
- ifindex_t ifi;
STREAM_GET(note, s, sizeof(*note));
STREAM_GETL(s, seq);
STREAM_GETL(s, prio);
STREAM_GETL(s, uni);
- STREAM_GETL(s, ifi);
+ STREAM_GET(ifname, s, INTERFACE_NAMSIZ);
if (zclient_debug)
- zlog_debug("%s: %u %u %u %u", __func__, seq, prio, uni, ifi);
+ zlog_debug("%s: %u %u %u %s", __func__, seq, prio, uni, ifname);
*seqno = seq;
*priority = prio;
*unique = uni;
- *ifindex = ifi;
return true;
@@ -2037,7 +2065,7 @@ static void zebra_interface_if_set_value(struct stream *s,
uint8_t link_params_status = 0;
ifindex_t old_ifindex, new_ifindex;
- old_ifindex = ifp->ifindex;
+ old_ifindex = ifp->oldifindex;
/* Read interface's index. */
STREAM_GETL(s, new_ifindex);
if_set_index(ifp, new_ifindex);