diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-07-12 23:25:21 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2012-07-12 23:25:21 +0200 |
commit | e4285cdc1bda303b01bbf2a43340d3f40f477820 (patch) | |
tree | 616ece985939699ba363a52da81162785918cf44 | |
parent | f096d021fb4119a449a7980e1667c2033491dba7 (diff) |
expose system_if_apply_settings, make it ignore the mac address for external devices
-rw-r--r-- | system-dummy.c | 5 | ||||
-rw-r--r-- | system-linux.c | 4 | ||||
-rw-r--r-- | system.h | 2 |
3 files changed, 9 insertions, 2 deletions
diff --git a/system-dummy.c b/system-dummy.c index a2411f3..f77d9c6 100644 --- a/system-dummy.c +++ b/system-dummy.c @@ -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; diff --git a/system-linux.c b/system-linux.c index d2e3d06..b3b58be 100644 --- a/system-linux.c +++ b/system-linux.c @@ -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) @@ -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); |