*/
hashtable_t *routes;
+ /**
+ * mutex for routes
+ */
+ mutex_t *routes_lock;
+
/**
* interface changes which may trigger route reinstallation
*/
route_entry_t *route;
this->net_changes_lock->lock(this->net_changes_lock);
- this->mutex->lock(this->mutex);
+ this->routes_lock->lock(this->routes_lock);
enumerator = this->routes->create_enumerator(this->routes);
while (enumerator->enumerate(enumerator, NULL, (void**)&route))
}
}
enumerator->destroy(enumerator);
- this->mutex->unlock(this->mutex);
+ this->routes_lock->unlock(this->routes_lock);
net_changes_clear(this);
this->net_changes_lock->unlock(this->net_changes_lock);
.if_name = if_name,
};
- this->mutex->lock(this->mutex);
+ this->routes_lock->lock(this->routes_lock);
found = this->routes->get(this->routes, &route);
if (found)
{
- this->mutex->unlock(this->mutex);
+ this->routes_lock->unlock(this->routes_lock);
return ALREADY_DONE;
}
found = route_entry_clone(&route);
this->routes->put(this->routes, found, found);
status = manage_srcroute(this, RTM_NEWROUTE, NLM_F_CREATE | NLM_F_EXCL,
dst_net, prefixlen, gateway, src_ip, if_name);
- this->mutex->unlock(this->mutex);
+ this->routes_lock->unlock(this->routes_lock);
return status;
}
.if_name = if_name,
};
- this->mutex->lock(this->mutex);
+ this->routes_lock->lock(this->routes_lock);
found = this->routes->get(this->routes, &route);
if (!found)
{
- this->mutex->unlock(this->mutex);
+ this->routes_lock->unlock(this->routes_lock);
return NOT_FOUND;
}
this->routes->remove(this->routes, found);
route_entry_destroy(found);
status = manage_srcroute(this, RTM_DELROUTE, 0, dst_net, prefixlen,
gateway, src_ip, if_name);
- this->mutex->unlock(this->mutex);
+ this->routes_lock->unlock(this->routes_lock);
return status;
}
}
enumerator->destroy(enumerator);
this->routes->destroy(this->routes);
+ this->routes_lock->destroy(this->routes_lock);
DESTROY_IF(this->socket);
net_changes_clear(this);
(hashtable_equals_t)addr_map_entry_equals, 16),
.vips = hashtable_create((hashtable_hash_t)addr_map_entry_hash,
(hashtable_equals_t)addr_map_entry_equals, 16),
+ .routes_lock = mutex_create(MUTEX_TYPE_DEFAULT),
.net_changes_lock = mutex_create(MUTEX_TYPE_DEFAULT),
.ifaces = linked_list_create(),
.mutex = mutex_create(MUTEX_TYPE_RECURSIVE),