mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
libifconfig: fix incorrect carp output
If one interface has a carp address configured on it ifconfig would show this information on all interfaces. That's because the kernel does (as one would expect) not return any carp data for interface without carp configuration. However, this wound up not overwriting the data passed in by the caller, and leaving the (now stale) information in pace. As a result the caller thought carp was configured on the interface. Zero out the input structure before making the call to the kernel, so that we correctly return 0 if there is no carp configuration on the queried interface. Sponsored by: Rubicon Communications, LLC ("Netgate")
This commit is contained in:
parent
020edaea2a
commit
95bc3ba7fe
|
@ -77,6 +77,8 @@ _ifconfig_carp_get(ifconfig_handle_t *h, const char *name,
|
|||
|
||||
ifconfig_error_clear(h);
|
||||
|
||||
bzero(carp, sizeof(*carp) * ncarp);
|
||||
|
||||
if (! snl_init(&ss, NETLINK_GENERIC)) {
|
||||
ifconfig_error(h, NETLINK, ENOTSUP);
|
||||
return (-1);
|
||||
|
|
Loading…
Reference in a new issue