From beecba5195b2f1180f0bdfb6f61f0dbd3dff0eba Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 19 Oct 2011 01:12:15 +0200 Subject: [PATCH] apply low level device settings --- system-linux.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/system-linux.c b/system-linux.c index 3d6230d..e313cbc 100644 --- a/system-linux.c +++ b/system-linux.c @@ -470,9 +470,32 @@ int system_vlan_del(struct device *dev) return system_vlan(dev, -1); } -int system_if_up(struct device *dev) +static void +system_if_apply_settings(struct device *dev) { + struct ifreq ifr; + + memset(&ifr, 0, sizeof(ifr)); + strncpy(ifr.ifr_name, dev->ifname, sizeof(ifr.ifr_name)); + if (dev->flags & DEV_OPT_MTU) { + ifr.ifr_mtu = dev->mtu; + ioctl(sock_ioctl, SIOCSIFMTU, &ifr); + } + if (dev->flags & DEV_OPT_TXQUEUELEN) { + ifr.ifr_qlen = dev->txqueuelen; + ioctl(sock_ioctl, SIOCSIFTXQLEN, &ifr); + } + if (dev->flags & DEV_OPT_MACADDR) { + memcpy(&ifr.ifr_hwaddr, dev->macaddr, sizeof(dev->macaddr)); + ioctl(sock_ioctl, SIOCSIFHWADDR, &ifr); + } + dev->ifindex = system_if_resolve(dev); +} + +int system_if_up(struct device *dev) +{ + system_if_apply_settings(dev); return system_if_flags(dev->ifname, IFF_UP, 0); } -- 2.30.2