230 |
|
|
231 |
|
/* Create new network_stats */ |
232 |
|
if (VECTOR_RESIZE(network_stats, interfaces + 1) < 0) { |
233 |
+ |
kstat_close(kc); |
234 |
|
return NULL; |
235 |
|
} |
236 |
|
network_stat_ptr=network_stats+interfaces; |
277 |
|
/* Read interface name */ |
278 |
|
if (sg_update_string(&network_stat_ptr->interface_name, |
279 |
|
ksp->ks_name) < 0) { |
280 |
+ |
kstat_close(kc); |
281 |
|
return NULL; |
282 |
|
} |
283 |
|
|
667 |
|
|
668 |
|
if ((sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP)) < 0) { |
669 |
|
sg_set_error_with_errno(SG_ERROR_SOCKET, NULL); |
670 |
+ |
kstat_close(kc); |
671 |
|
return NULL; |
672 |
|
} |
673 |
|
|
684 |
|
} |
685 |
|
|
686 |
|
if (VECTOR_RESIZE(network_iface_stats, ifaces + 1) < 0) { |
687 |
+ |
kstat_close(kc); |
688 |
|
return NULL; |
689 |
|
} |
690 |
|
network_iface_stat_ptr = network_iface_stats + ifaces; |
692 |
|
|
693 |
|
if (sg_update_string(&network_iface_stat_ptr->interface_name, |
694 |
|
ksp->ks_name) < 0) { |
695 |
+ |
kstat_close(kc); |
696 |
|
return NULL; |
697 |
|
} |
698 |
|
|
699 |
|
if ((ifr.ifr_flags & IFF_UP) != 0) { |
700 |
|
network_iface_stat_ptr->up = 1; |
701 |
|
} else { |
702 |
< |
network_iface_stat_ptr->up = 1; |
702 |
> |
network_iface_stat_ptr->up = 0; |
703 |
|
} |
704 |
|
|
705 |
|
if ((knp = kstat_data_lookup(ksp, "ifspeed")) != NULL) { |