From e4285cdc1bda303b01bbf2a43340d3f40f477820 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 12 Jul 2012 23:25:21 +0200 Subject: [PATCH] expose system_if_apply_settings, make it ignore the mac address for external devices --- system-dummy.c | 5 +++++ system-linux.c | 4 ++-- 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) diff --git a/system.h b/system.h index 5e275ca..701e44a 100644 --- 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); -- 2.11.0