[netcf-devel] [PATCH] netlink: Do not provide caches, not needed and only complicates thread safety

Laine Stump laine at laine.org
Tue Dec 18 18:07:25 UTC 2012


On 12/18/2012 01:05 PM, Laine Stump wrote:
> From: Thomas Graf <tgraf at redhat.com>
>
> netcf does not utilize any of the functionality that would require
> providing the caches. Doing so only exposes the cache to possibly
> unwanted users.

(note that Thomas had sent this to the list and Cc'ed me. The copy came
to me, but the original never made it to the list for some reason.

ACK and pushed. Note that this also eliminates a potential segfault when
used in combination with older libnl's that don't have a properly
threadsafe version of nl_cache_mngt_provide() (and other cache functions).


>
> Signed-off-by: Thomas Graf <tgraf at redhat.com>
> ---
>  src/dutil_linux.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/src/dutil_linux.c b/src/dutil_linux.c
> index 1fe9b26..271c515 100644
> --- a/src/dutil_linux.c
> +++ b/src/dutil_linux.c
> @@ -611,12 +611,10 @@ int netlink_init(struct netcf *ncf) {
>      ncf->driver->link_cache = __rtnl_link_alloc_cache(ncf->driver->nl_sock);
>      if (ncf->driver->link_cache == NULL)
>          goto error;
> -    nl_cache_mngt_provide(ncf->driver->link_cache);
>  
>      ncf->driver->addr_cache = __rtnl_addr_alloc_cache(ncf->driver->nl_sock);
>      if (ncf->driver->addr_cache == NULL)
>          goto error;
> -    nl_cache_mngt_provide(ncf->driver->addr_cache);
>  
>      int netlink_fd = nl_socket_get_fd(ncf->driver->nl_sock);
>      if (netlink_fd >= 0)



More information about the netcf-devel mailing list