X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=lib%2Fnetdev-linux.c;h=1efbfd88a26e2bec680b288c689119367d1b6c70;hb=406e37ecf554529e9380ef06863d85ccc94009d1;hp=b7447f8e9822af0b3989acbfb9bb0c7a8772250e;hpb=98563392dba5c82a9b952c421dec8b16c8a24023;p=openvswitch diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index b7447f8e..1efbfd88 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -53,6 +53,7 @@ #include "netdev-provider.h" #include "netdev-vport.h" #include "netlink.h" +#include "netlink-socket.h" #include "ofpbuf.h" #include "openflow/openflow.h" #include "packets.h" @@ -597,20 +598,22 @@ static void netdev_linux_destroy(struct netdev_dev *netdev_dev_) { struct netdev_dev_linux *netdev_dev = netdev_dev_linux_cast(netdev_dev_); - const char *type = netdev_dev_get_type(netdev_dev_); + const struct netdev_class *class = netdev_dev_get_class(netdev_dev_); if (netdev_dev->tc && netdev_dev->tc->ops->tc_destroy) { netdev_dev->tc->ops->tc_destroy(netdev_dev->tc); } - if (!strcmp(type, "system")) { + if (class == &netdev_linux_class || class == &netdev_internal_class) { cache_notifier_refcount--; if (!cache_notifier_refcount) { rtnetlink_notifier_unregister(&netdev_linux_cache_notifier); } - } else if (!strcmp(type, "tap")) { + } else if (class == &netdev_tap_class) { destroy_tap(netdev_dev); + } else { + NOT_REACHED(); } free(netdev_dev);