fix unannotated fall-through warnings
[project/netifd.git] / interface.c
index 24d90aa39613e741c9b81ac451bef3f4aeb2d6c0..2a8f604207c3fdd1e47348274fce0428727906bf 100644 (file)
@@ -245,7 +245,7 @@ interface_event(struct interface *iface, enum interface_event ev)
        case IFEV_UP:
                interface_error_flush(iface);
                adev = iface->l3_dev.dev;
-               /* fall through */
+               fallthrough;
        case IFEV_DOWN:
        case IFEV_UP_FAILED:
                alias_notify_device(iface->name, adev);
@@ -319,6 +319,7 @@ __interface_set_down(struct interface *iface, bool force)
        case IFS_DOWN:
                if (iface->main_dev.dev)
                        device_release(&iface->main_dev);
+               break;
        case IFS_TEARDOWN:
        default:
                break;
@@ -1038,7 +1039,8 @@ interface_remove_link(struct interface *iface, struct device *dev)
 }
 
 static int
-interface_add_link(struct interface *iface, struct device *dev, bool link_ext)
+interface_add_link(struct interface *iface, struct device *dev,
+                  struct blob_attr *vlan, bool link_ext)
 {
        struct device *mdev = iface->main_dev.dev;
 
@@ -1050,7 +1052,7 @@ interface_add_link(struct interface *iface, struct device *dev, bool link_ext)
 
        if (mdev) {
                if (mdev->hotplug_ops)
-                       return mdev->hotplug_ops->add(mdev, dev);
+                       return mdev->hotplug_ops->add(mdev, dev, vlan);
                else
                        return UBUS_STATUS_NOT_SUPPORTED;
        }
@@ -1064,7 +1066,8 @@ interface_add_link(struct interface *iface, struct device *dev, bool link_ext)
 }
 
 int
-interface_handle_link(struct interface *iface, const char *name, bool add, bool link_ext)
+interface_handle_link(struct interface *iface, const char *name,
+                     struct blob_attr *vlan, bool add, bool link_ext)
 {
        struct device *dev;
        int ret;
@@ -1079,9 +1082,10 @@ interface_handle_link(struct interface *iface, const char *name, bool add, bool
 
        if (add) {
                interface_set_device_config(iface, dev);
-               device_set_present(dev, true);
+               if (!link_ext)
+                       device_set_present(dev, true);
 
-               ret = interface_add_link(iface, dev, link_ext);
+               ret = interface_add_link(iface, dev, vlan, link_ext);
        } else {
                ret = interface_remove_link(iface, dev);
        }
@@ -1171,7 +1175,7 @@ interface_start_jail(const char *jail, const pid_t netns_pid)
                if (!iface->jail || strcmp(iface->jail, jail))
                        continue;
 
-               system_link_netns_move(iface->ifname, netns_fd, iface->jail_ifname);
+               system_link_netns_move(iface->main_dev.dev, netns_fd, iface->jail_ifname);
        }
 
        close(netns_fd);
@@ -1248,7 +1252,7 @@ interface_stop_jail(const char *jail, const pid_t netns_pid)
 
                interface_do_reload(iface);
                interface_set_down(iface);
-               system_link_netns_move(iface->ifname, root_netns, orig_ifname);
+               system_link_netns_move(iface->main_dev.dev, root_netns, orig_ifname);
        }
 
        close(root_netns);