[ovs-dev] rtnetlink_notifier_register() function

Gaetano Catalli gaetano.catalli at gmail.com
Mon Nov 28 15:19:07 UTC 2011


Hi all,

the following is a snippet of code taken from the
netdev_linux_create_system() function in lib/netdev-linux.c. It wants
to attach a callback to interfaces status change events. The notifier
is unique for all devices so it is created when the first port is
attached to the switch and deleted when the last port is removed(in
netdev_linux_destroy()). I can't understand why this code is present
only in netdev_linux_create_system(), while it is missing in
netdev_linux_tap_create(). Does anybody have an explanation for that?

    ...
    if (!cache_notifier_refcount) {
        error = rtnetlink_notifier_register(&netdev_linux_cache_notifier,
                                            netdev_linux_cache_cb, NULL);
        if (error) {
            return error;
        }
    }
    cache_notifier_refcount++;
    ...

thanks.
-- 
gaetano catalli



More information about the dev mailing list