for (if_ptr = if_list; if_ptr != NULL; if_ptr = if_ptr->ifa_next)
{
- if ((if_data = (struct IFA_DATA *) if_ptr->ifa_data) == NULL)
- continue;
+ if (if_ptr->ifa_addr != NULL && if_ptr->ifa_addr->sa_family == AF_LINK) {
+ if_data = (struct IFA_DATA *) if_ptr->ifa_data;
- if_submit (if_ptr->ifa_name, "if_octets",
+ if_submit (if_ptr->ifa_name, "if_octets",
if_data->IFA_RX_BYTES,
if_data->IFA_TX_BYTES);
- if_submit (if_ptr->ifa_name, "if_packets",
+ if_submit (if_ptr->ifa_name, "if_packets",
if_data->IFA_RX_PACKT,
if_data->IFA_TX_PACKT);
- if_submit (if_ptr->ifa_name, "if_errors",
+ if_submit (if_ptr->ifa_name, "if_errors",
if_data->IFA_RX_ERROR,
if_data->IFA_TX_ERROR);
+ }
}
freeifaddrs (if_list);