From 2d831a99f4b17fc2365526d7d1154fa5a8b03326 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Mon, 19 Dec 2005 22:00:39 +0000 Subject: [PATCH] net_interface_config.mtu for AIX, HPUX and Solaris --- src/sigar.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/sigar.c b/src/sigar.c index e7a8a7cf..323a8cba 100644 --- a/src/sigar.c +++ b/src/sigar.c @@ -1276,9 +1276,21 @@ int sigar_net_interface_config_get(sigar_t *sigar, const char *name, #endif } -#ifdef __linux__ +#if defined(SIOCGLIFMTU) && !defined(__hpux) + { + struct lifreq lifr; + SIGAR_SSTRCPY(lifr.lifr_name, name); + if(!ioctl(sock, SIOCGLIFMTU, &lifr)) { + ifconfig->mtu = lifr.lifr_mtu; + } + } +#elif defined(SIOCGIFMTU) if (!ioctl(sock, SIOCGIFMTU, &ifr)) { +# if defined(__hpux) + ifconfig->mtu = ifr.ifr_metric; +# else ifconfig->mtu = ifr.ifr_mtu; +#endif } #else ifconfig->mtu = 0; /*XXX*/