Skip to content

Commit

Permalink
dbus,ifconfig: disabled interface refreshes
Browse files Browse the repository at this point in the history
  • Loading branch information
mtomaschewski committed Jul 22, 2014
1 parent 6b06856 commit 696629e
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 22 deletions.
5 changes: 2 additions & 3 deletions src/dbus-objects/addrconf.c
Expand Up @@ -103,9 +103,8 @@ ni_objectmodel_addrconf_path_to_device(const char *path)
if (ni_parse_uint(path, &ifindex, 10) < 0)
return NULL;

nc = ni_global_state_handle(1);
if (nc == NULL) {
ni_error("%s: unable to refresh interfaces", __func__);
if (!(nc = ni_global_state_handle(0))) {
ni_error("%s: unable to get global handle", __func__);
return NULL;
}

Expand Down
12 changes: 2 additions & 10 deletions src/dbus-objects/interface.c
Expand Up @@ -190,16 +190,8 @@ static const ni_dbus_class_t ni_objectmodel_netif_list_class = {
dbus_bool_t
ni_objectmodel_netif_list_refresh(ni_dbus_object_t *object)
{
ni_netconfig_t *nc;

if (!(nc = ni_global_state_handle(1))) {
ni_error("failed to refresh network interfaces");
return FALSE;
}

/* Note, we do not have to deal with removal of interfaces
* that have been destroyed. We should be notified of these
* automatically via RTM_DELLINK */
/* We're notified about automatically via RTM_NEW/DELLINK */
(void)object;

return TRUE;
}
Expand Down
5 changes: 2 additions & 3 deletions src/ifconfig.c
Expand Up @@ -101,7 +101,6 @@ int
ni_system_interface_link_change(ni_netdev_t *dev, const ni_netdev_req_t *ifp_req)
{
unsigned int ifflags;
int res;

if (dev == NULL)
return -NI_ERROR_INVALID_ARGS;
Expand Down Expand Up @@ -140,10 +139,10 @@ ni_system_interface_link_change(ni_netdev_t *dev, const ni_netdev_req_t *ifp_req
}
}

/* TODO: still needed? */
__ni_global_seqno++;

res = __ni_system_refresh_interface(ni_global_state_handle(0), dev);
return res;
return 0;
}

int
Expand Down
38 changes: 32 additions & 6 deletions src/iflist.c
Expand Up @@ -296,6 +296,7 @@ __ni_system_refresh_interfaces(ni_netconfig_t *nc)
int
__ni_system_refresh_all(ni_netconfig_t *nc, ni_netdev_t **del_list)
{
static int refresh = 0;
struct ni_rtnl_query query;
struct nlmsghdr *h;
ni_netdev_t **tail, *dev;
Expand All @@ -304,6 +305,15 @@ __ni_system_refresh_all(ni_netconfig_t *nc, ni_netdev_t **del_list)

seqno = ++__ni_global_seqno;

if (!refresh) {
refresh = 1;
ni_debug_verbose(NI_LOG_DEBUG1, NI_TRACE_EVENTS,
"Full refresh of all interfaces (bootstrap)");
} else {
ni_debug_verbose(NI_LOG_DEBUG, NI_TRACE_EVENTS,
"Full refresh of all interfaces (enforced)");
}

if (ni_rtnl_query(&query, 0) < 0)
goto failed;

Expand Down Expand Up @@ -451,8 +461,11 @@ __ni_system_refresh_interface(ni_netconfig_t *nc, ni_netdev_t *dev)
struct nlmsghdr *h;
int res = -1;

__ni_global_seqno++;
ni_debug_verbose(NI_LOG_DEBUG1, NI_TRACE_EVENTS,
"Full refresh of %s interface",
dev->name);

__ni_global_seqno++;
if (ni_rtnl_query(&query, dev->link.ifindex) < 0)
goto failed;

Expand Down Expand Up @@ -507,8 +520,11 @@ __ni_system_refresh_interface_addrs(ni_netconfig_t *nc, ni_netdev_t *dev)
struct nlmsghdr *h;
int res = -1;

__ni_global_seqno++;
ni_debug_verbose(NI_LOG_DEBUG1, NI_TRACE_EVENTS,
"Refresh of %s interface address",
dev->name);

__ni_global_seqno++;
if (ni_rtnl_query_addr_info(&query, dev->link.ifindex) < 0)
goto failed;

Expand Down Expand Up @@ -540,8 +556,11 @@ __ni_system_refresh_interface_routes(ni_netconfig_t *nc, ni_netdev_t *dev)
struct nlmsghdr *h;
int res = -1;

__ni_global_seqno++;
ni_debug_verbose(NI_LOG_DEBUG1, NI_TRACE_EVENTS,
"Refresh of %s interface routes",
dev->name);

__ni_global_seqno++;
if (ni_rtnl_query_route_info(&query, dev->link.ifindex) < 0)
goto failed;

Expand Down Expand Up @@ -572,10 +591,16 @@ __ni_device_refresh_link_info(ni_netconfig_t *nc, ni_linkinfo_t *link)
{
struct ni_rtnl_query query;
struct nlmsghdr *h;
ni_netdev_t *dev;
int rv = 0;

__ni_global_seqno++;
dev = nc ? ni_netdev_by_index(nc, link->ifindex) : NULL;
ni_debug_verbose(NI_LOG_DEBUG1, NI_TRACE_EVENTS,
"Link %s[%u] info refresh",
dev ? dev->name : "",
link->ifindex);

__ni_global_seqno++;
if ((rv = ni_rtnl_query_link(&query, link->ifindex)) < 0)
goto done;

Expand Down Expand Up @@ -606,10 +631,11 @@ __ni_device_refresh_ipv6_link_info(ni_netconfig_t *nc, ni_netdev_t *dev)
struct nlmsghdr *h;
int rv = 0;

(void)nc; /* unused */
ni_debug_verbose(NI_LOG_DEBUG1, NI_TRACE_EVENTS,
"IPv6 link info refresh of %s interface",
dev->name);

__ni_global_seqno++;

if ((rv = ni_rtnl_query_ipv6_link(&query, dev->link.ifindex)) < 0)
goto done;

Expand Down

0 comments on commit 696629e

Please sign in to comment.