From 0eb6aa7562ae8db51c09b2c370a65f01b0ac1cff Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 17 Nov 2015 15:15:08 +0100 Subject: [PATCH] device: fetch settings from external devices to make them usable for status output Signed-off-by: Felix Fietkau --- device.c | 2 ++ system-dummy.c | 4 ++++ system-linux.c | 2 +- system.h | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/device.c b/device.c index 67e9d9a..6dc4fa9 100644 --- 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; + + system_if_get_settings(dev, &dev->orig_settings); } else ret = dev->set_state(dev, true); diff --git a/system-dummy.c b/system-dummy.c index 76c6ffa..9c734ea 100644 --- a/system-dummy.c +++ b/system-dummy.c @@ -83,6 +83,10 @@ int system_if_down(struct device *dev) return 0; } +void system_if_get_settings(struct device *dev, struct device_settings *s) +{ +} + void system_if_clear_state(struct device *dev) { } diff --git a/system-linux.c b/system-linux.c index b190ec6..d3bb64d 100644 --- a/system-linux.c +++ b/system-linux.c @@ -1053,7 +1053,7 @@ int system_vlandev_del(struct device *vlandev) return system_link_del(vlandev->ifname); } -static void +void system_if_get_settings(struct device *dev, struct device_settings *s) { struct ifreq ifr; diff --git a/system.h b/system.h index 486fe14..b3298bd 100644 --- 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); +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); -- 2.30.2