struct rtnetlink {
struct nl_sock *notify_sock; /* Rtnetlink socket. */
struct list all_notifiers; /* All rtnetlink notifiers. */
+ bool has_run; /* Guard for run and wait functions. */
/* Passed in by rtnetlink_create(). */
int multicast_group; /* Multicast group we listen on. */
rtn->multicast_group = multicast_group;
rtn->parse = parse;
rtn->change = change;
+ rtn->has_run = false;
list_init(&rtn->all_notifiers);
return rtn;
{
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
- if (!rtn->notify_sock) {
+ if (!rtn->notify_sock || rtn->has_run) {
return;
}
+ rtn->has_run = true;
for (;;) {
struct ofpbuf *buf;
int error;
void
rtnetlink_notifier_wait(struct rtnetlink *rtn)
{
+ rtn->has_run = false;
if (rtn->notify_sock) {
nl_sock_wait(rtn->notify_sock, POLLIN);
}