expose system_if_apply_settings, make it ignore the mac address for external devices
authorFelix Fietkau <nbd@openwrt.org>
Thu, 12 Jul 2012 21:25:21 +0000 (23:25 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 12 Jul 2012 21:25:21 +0000 (23:25 +0200)
system-dummy.c
system-linux.c
system.h

index a2411f3..f77d9c6 100644 (file)
@@ -119,6 +119,11 @@ system_if_dump_stats(struct device *dev, struct blob_buf *b)
        return 0;
 }
 
+void
+system_if_apply_settings(struct device *dev, struct device_settings *s)
+{
+}
+
 int system_add_address(struct device *dev, struct device_addr *addr)
 {
        uint8_t *a = (uint8_t *) &addr->addr.in;
index d2e3d06..b3b58be 100644 (file)
@@ -632,7 +632,7 @@ system_if_get_settings(struct device *dev, struct device_settings *s)
        }
 }
 
-static void
+void
 system_if_apply_settings(struct device *dev, struct device_settings *s)
 {
        struct ifreq ifr;
@@ -649,7 +649,7 @@ system_if_apply_settings(struct device *dev, struct device_settings *s)
                if (ioctl(sock_ioctl, SIOCSIFTXQLEN, &ifr) < 0)
                        s->flags &= ~DEV_OPT_TXQUEUELEN;
        }
-       if (s->flags & DEV_OPT_MACADDR) {
+       if ((s->flags & DEV_OPT_MACADDR) && !dev->external) {
                ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER;
                memcpy(&ifr.ifr_hwaddr.sa_data, s->macaddr, sizeof(s->macaddr));
                if (ioctl(sock_ioctl, SIOCSIFHWADDR, &ifr) < 0)
index 5e275ca..701e44a 100644 (file)
--- a/system.h
+++ b/system.h
@@ -67,6 +67,8 @@ int system_if_dump_info(struct device *dev, struct blob_buf *b);
 int system_if_dump_stats(struct device *dev, struct blob_buf *b);
 struct device *system_if_get_parent(struct device *dev);
 bool system_if_force_external(const char *ifname);
+void system_if_apply_settings(struct device *dev, struct device_settings *s);
+
 
 int system_add_address(struct device *dev, struct device_addr *addr);
 int system_del_address(struct device *dev, struct device_addr *addr);