From 39e0358161212c5d662208360c1fdcb68ee6b64a Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Wed, 13 Jun 2018 11:59:26 +0200 Subject: ipcpd: Get mtu using ioctl before hw address The SIOCGIFMTU command uses the ifr struct, which is a union, so it can't store the hw address and the MTU at the same time. We now call SIOCGIFMTU and set the MTU before SIOCGIFHWADDR. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/ipcpd/eth/eth.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/ipcpd') diff --git a/src/ipcpd/eth/eth.c b/src/ipcpd/eth/eth.c index c76ef60a..7bac64ca 100644 --- a/src/ipcpd/eth/eth.c +++ b/src/ipcpd/eth/eth.c @@ -1243,12 +1243,6 @@ static int eth_ipcp_bootstrap(const struct ipcp_config * conf) return -1; } - if (ioctl(skfd, SIOCGIFHWADDR, &ifr)) { - log_err("Failed to get hwaddr."); - close(skfd); - return -1; - } - if (ioctl(skfd, SIOCGIFMTU, &ifr)) { log_err("Failed to get MTU."); close(skfd); @@ -1269,6 +1263,12 @@ static int eth_ipcp_bootstrap(const struct ipcp_config * conf) #endif log_dbg("Layer MTU is %d.", eth_data.mtu); + if (ioctl(skfd, SIOCGIFHWADDR, &ifr)) { + log_err("Failed to get hwaddr."); + close(skfd); + return -1; + } + close(skfd); idx = if_nametoindex(conf->dev); -- cgit v1.2.3