* occur only when the user specifies an invalid configuration and therefore
* he deserves to get what he has asked for, but unfortunately they can also
* arise legitimately when the daemon is reconfigured and there exists (although
- * for a short time period only) an old protocol being shut down and a new one
+ * for a short time period only) an old protocol instance being shut down and a new one
* willing to start up on the same interface.
*
* The solution is very simple: when any protocol wishes to use a network port
- * or some other non-shareable resource, it asks the core to lock it and doesn't
+ * or some other non-shareable resource, it asks the core to lock it and it doesn't
* use the resource until it's notified that it has acquired the lock.
*
- * Object locks are represented by &object_lock which is in turn a kind of
- * resource. Lockable resources are uniquely determined by resource type
+ * Object locks are represented by &object_lock structures which are in turn a
+ * kind of resource. Lockable resources are uniquely determined by resource type
* (%OBJLOCK_UDP for a UDP port etc.), IP address (usually a broadcast or
- * multicast address the port is bound to), port number and interface.
+ * multicast address the port is bound to), port number, interface and optional
+ * instance ID.
*/
#undef LOCAL_DEBUG
return
x->type == y->type &&
x->iface == y->iface &&
+ x->vrf == y->vrf &&
x->port == y->port &&
+ x->inst == y->inst &&
ipa_equal(x->addr, y->addr);
}
DBG("olock: -> %p becomes locked\n", n);
q = SKIP_BACK(struct object_lock, n, n);
rem_node(n);
- add_tail_list(&l->waiters, &q->waiters);
+ add_tail_list(&q->waiters, &l->waiters);
q->state = OLOCK_STATE_EVENT;
add_head(&olock_list, n);
ev_schedule(olock_event);
struct object_lock *l = (struct object_lock *) r;
static char *olock_states[] = { "free", "locked", "waiting", "event" };
- debug("(%d:%s:%I:%d) [%s]\n", l->type, (l->iface ? l->iface->name : "?"), l->addr, l->port, olock_states[l->state]);
+ debug("(%d:%s:%I:%d:%d) [%s]\n", l->type, (l->iface ? l->iface->name : "?"), l->addr, l->port, l->inst, olock_states[l->state]);
if (!EMPTY_LIST(l->waiters))
debug(" [wanted]\n");
}
"ObjLock",
sizeof(struct object_lock),
olock_free,
- olock_dump
+ olock_dump,
+ NULL,
+ NULL,
};
/**
}
static void
-olock_run_event(void *unused)
+olock_run_event(void *unused UNUSED)
{
node *n;
struct object_lock *q;