X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Finterface.c;h=d05dd72309f80ffd79c6e94fbe2c9509d962afce;hb=e9b1ff6f13a7b203ec52a541aa468f23502c9584;hp=1c01f6ff773cf8e5bb92697b73e21e4bacee1663;hpb=9c8f3110063cf83fa146929d5f28f8ecf17a4ffd;p=collectd.git diff --git a/src/interface.c b/src/interface.c index 1c01f6ff..d05dd723 100644 --- a/src/interface.c +++ b/src/interface.c @@ -190,7 +190,7 @@ static int interface_read (void) struct ifaddrs *if_list; struct ifaddrs *if_ptr; -/* Darin/Mac OS X and possible other *BSDs */ +/* Darwin/Mac OS X and possible other *BSDs */ #if HAVE_STRUCT_IF_DATA # define IFA_DATA if_data # define IFA_RX_BYTES ifi_ibytes @@ -286,6 +286,10 @@ static int interface_read (void) incoming = atoll (fields[2]); outgoing = atoll (fields[10]); if_submit (device, "if_errors", incoming, outgoing); + + incoming = atoll (fields[3]); + outgoing = atoll (fields[11]); + if_submit (device, "if_dropped", incoming, outgoing); } fclose (fh); @@ -364,9 +368,8 @@ static int interface_read (void) if (pnif != nif || ifstat == NULL) { - if (ifstat != NULL) - free(ifstat); - ifstat = malloc(nif * sizeof(perfstat_netinterface_t)); + free(ifstat); + ifstat = malloc(nif * sizeof (*ifstat)); } pnif = nif;