X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fnetdev-linux.c;h=6541b1e9120fe7aa9557151f6bb15a0ea6f30ab9;hb=2ee6545f2bff7eb27e8c84965e3ff38dfa909bf6;hp=cc930e1d2b3fd0d3d973684eaa75c9332f974068;hpb=18a237816419e6f88ab0383b43d8060914d26a9a;p=sliver-openvswitch.git diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index cc930e1d2..6541b1e91 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -105,7 +105,7 @@ COVERAGE_DEFINE(netdev_ethtool); #define TC_RTAB_SIZE 1024 #endif -static struct nln_notifier netdev_linux_cache_notifier; +static struct nln_notifier *netdev_linux_cache_notifier = NULL; static int cache_notifier_refcount; enum { @@ -526,13 +526,15 @@ netdev_linux_create(const struct netdev_class *class, const char *name, struct netdev_dev **netdev_devp) { struct netdev_dev_linux *netdev_dev; - int error; if (!cache_notifier_refcount) { - error = rtnetlink_link_notifier_register(&netdev_linux_cache_notifier, - netdev_linux_cache_cb, NULL); - if (error) { - return error; + assert(!netdev_linux_cache_notifier); + + netdev_linux_cache_notifier = + rtnetlink_link_notifier_create(netdev_linux_cache_cb, NULL); + + if (!netdev_linux_cache_notifier) { + return EINVAL; } } cache_notifier_refcount++; @@ -622,7 +624,9 @@ netdev_linux_destroy(struct netdev_dev *netdev_dev_) cache_notifier_refcount--; if (!cache_notifier_refcount) { - rtnetlink_link_notifier_unregister(&netdev_linux_cache_notifier); + assert(netdev_linux_cache_notifier); + rtnetlink_link_notifier_destroy(netdev_linux_cache_notifier); + netdev_linux_cache_notifier = NULL; } } else if (class == &netdev_tap_class) { destroy_tap(netdev_dev);