device: fetch settings from external devices to make them usable for status output
authorFelix Fietkau <nbd@openwrt.org>
Tue, 17 Nov 2015 14:15:08 +0000 (15:15 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 17 Nov 2015 14:15:08 +0000 (15:15 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
device.c
system-dummy.c
system-linux.c
system.h

index 67e9d9ac63624b9d657176240f61e0f5c2f40187..6dc4fa9b1acb92e8dc31b7b3b5e19088e1e024ed 100644 (file)
--- a/device.c
+++ b/device.c
@@ -337,6 +337,8 @@ int device_claim(struct device_user *dep)
                device_set_ifindex(dev, system_if_resolve(dev));
                if (!dev->ifindex)
                        ret = -1;
                device_set_ifindex(dev, system_if_resolve(dev));
                if (!dev->ifindex)
                        ret = -1;
+
+               system_if_get_settings(dev, &dev->orig_settings);
        } else
                ret = dev->set_state(dev, true);
 
        } else
                ret = dev->set_state(dev, true);
 
index 76c6ffa7d032d8bbbf37f05bd51ee633c55cbca3..9c734ea5955820f4c551b1ab2198d4d6f13746fc 100644 (file)
@@ -83,6 +83,10 @@ int system_if_down(struct device *dev)
        return 0;
 }
 
        return 0;
 }
 
+void system_if_get_settings(struct device *dev, struct device_settings *s)
+{
+}
+
 void system_if_clear_state(struct device *dev)
 {
 }
 void system_if_clear_state(struct device *dev)
 {
 }
index b190ec64b35a5d15c8209adcfdfe43e5dcd6824d..d3bb64d7bec93d909ac54d65a0144d586fe54d9f 100644 (file)
@@ -1053,7 +1053,7 @@ int system_vlandev_del(struct device *vlandev)
        return system_link_del(vlandev->ifname);
 }
 
        return system_link_del(vlandev->ifname);
 }
 
-static void
+void
 system_if_get_settings(struct device *dev, struct device_settings *s)
 {
        struct ifreq ifr;
 system_if_get_settings(struct device *dev, struct device_settings *s)
 {
        struct ifreq ifr;
index 486fe1423bedbf27bd8ef72d2161647258591901..b3298bd46fb4af525bc259a8ddb7d9e1afc01585 100644 (file)
--- a/system.h
+++ b/system.h
@@ -114,6 +114,7 @@ int system_vlan_del(struct device *dev);
 int system_vlandev_add(struct device *vlandev, struct device *dev, struct vlandev_config *cfg);
 int system_vlandev_del(struct device *vlandev);
 
 int system_vlandev_add(struct device *vlandev, struct device *dev, struct vlandev_config *cfg);
 int system_vlandev_del(struct device *vlandev);
 
+void system_if_get_settings(struct device *dev, struct device_settings *s);
 void system_if_clear_state(struct device *dev);
 int system_if_up(struct device *dev);
 int system_if_down(struct device *dev);
 void system_if_clear_state(struct device *dev);
 int system_if_up(struct device *dev);
 int system_if_down(struct device *dev);