Re: [PATCH] util: Clear output broadcast address before filling it in

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/03/2015 06:54 AM, Martin Kletzander wrote:
> Since commit 55ace7c4789c8a7408139460f4b639cee00e5125, the sockettest
> fails without VIR_TEST_DEBUG set.  The problem is found by test number
> 42 (co-incidence?), which tests range '192.168.122.1' -
> '192.168.122.255' in network '192.168.122.0/24'.  That is supposed to
> fail because the end address is equal to the broadcast address.

Interesting that this test did "fail" for me (over many separate runs,
including once again just now). I guess I was lucky to randomly get a 0
in the port every time.


>
> When comparing these two in 'virSocketAddrEqual(end, &broadcast)',
> there is a check for sin_addr as well as for sin_port.  That port,
> however, is different when we do not enable test debugging.  With the
> testing enabled, the port is 0 (correctly initialized), but without that
> it has a random number there.  And that's because the structure is not
> initialized anywhere.
>
> By zeroing the structure before filling in the info, we make sure we
> return only the address and not any information that was not requested.
> And the test work once again.

ACK.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]