diff --git a/include/sigar_private.h b/include/sigar_private.h index 24b11b04..48c76c83 100644 --- a/include/sigar_private.h +++ b/include/sigar_private.h @@ -234,4 +234,8 @@ int sigar_group_name_get(sigar_t *sigar, int gid, char *buf, int buflen); int sigar_get_iftype(const char *name, int *type, int *inst); #endif +#define SIGAR_NIC_LOOPBACK "Local Loopback" +#define SIGAR_NIC_ETHERNET "Ethernet" +#define SIGAR_NIC_NETROM "AMPR NET/ROM" + #endif diff --git a/src/sigar.c b/src/sigar.c index 7b392736..9614165a 100644 --- a/src/sigar.c +++ b/src/sigar.c @@ -1172,11 +1172,11 @@ static void get_interface_type(sigar_net_interface_config_t *ifconfig, switch (family) { case ARPHRD_NETROM: - type = "AMPR NET/ROM"; + type = SIGAR_NIC_NETROM; break; /* XXX more */ default: - type = "Ethernet"; + type = SIGAR_NIC_ETHERNET; break; } @@ -1244,7 +1244,8 @@ int sigar_net_interface_config_get(sigar_t *sigar, const char *name, ifconfig->destination = ifconfig->address; ifconfig->broadcast = 0; sigar_hwaddr_set_null(ifconfig); - SIGAR_SSTRCPY(ifconfig->type, "Local Loopback"); + SIGAR_SSTRCPY(ifconfig->type, + SIGAR_NIC_LOOPBACK); } else { if (!ioctl(sock, SIOCGIFDSTADDR, &ifr)) { @@ -1263,10 +1264,12 @@ int sigar_net_interface_config_get(sigar_t *sigar, const char *name, } #elif defined(_AIX) || defined(__osf__) hwaddr_aix_lookup(sigar, ifconfig); - SIGAR_SSTRCPY(ifconfig->type, "Ethernet"); + SIGAR_SSTRCPY(ifconfig->type, + SIGAR_NIC_ETHERNET); #else hwaddr_arp_lookup(ifconfig, sock); - SIGAR_SSTRCPY(ifconfig->type, "Ethernet"); + SIGAR_SSTRCPY(ifconfig->type, + SIGAR_NIC_ETHERNET); #endif }