#define NDISC_NEXTHOP_APP_ID SD_ID128_MAKE(76,d2,0f,1f,76,1e,44,d1,97,3a,52,5c,05,68,b5,0d)
-static uint32_t ndisc_generate_nexthop_id(NextHop *nexthop, Link *link, sd_id128_t app_id, uint64_t trial) {
+static uint32_t ndisc_generate_nexthop_id(const NextHop *nexthop, Link *link, sd_id128_t app_id, uint64_t trial) {
assert(nexthop);
assert(link);
return (uint32_t) ((result & 0xffffffff) ^ (result >> 32));
}
-static bool ndisc_nexthop_equal(NextHop *a, NextHop *b) {
+static bool ndisc_nexthop_equal(const NextHop *a, const NextHop *b) {
assert(a);
assert(b);
return true;
}
-static bool ndisc_take_nexthop_id(NextHop *nexthop, NextHop *existing, Manager *manager) {
+static bool ndisc_take_nexthop_id(NextHop *nexthop, const NextHop *existing, Manager *manager) {
assert(nexthop);
+ assert(nexthop->id == 0);
assert(existing);
+ assert(existing->id > 0);
assert(manager);
if (!ndisc_nexthop_equal(nexthop, existing))
return false;
}
-static int ndisc_nexthop_new(Route *route, Link *link, NextHop **ret) {
+static int ndisc_nexthop_new(const Route *route, Link *link, NextHop **ret) {
_cleanup_(nexthop_unrefp) NextHop *nexthop = NULL;
int r;