[libvirt] [PATCH 22/28] util: provide default destination IP in alternate virNetDevIPRouteAdd()

John Ferlan jferlan at redhat.com
Fri Jun 24 13:08:41 UTC 2016



On 06/22/2016 01:37 PM, Laine Stump wrote:
> The version of virNetDevIPRouteAdd() has a bit of code to create the
> appropriate "0.0.0.0" or "::" virSocketAddr when the addr passed in is
> NULL or invalid, but the alternate implementation (used on platforms
> that don't support libnl) had no such code, making the two
> implementations semantically diferent. This patch corrects that
> oversight.
> ---
>  src/util/virnetdevip.c | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 

Seems like a reasonable and nice thing to do ...  although you could
have written a helper routine to return the result of
virSocketAddrFormat based on actualAddr... Avoids duplicated code and
the chance that someone only changes one in the future.

Interesting side note - can gateway be invalid and family doesn't have
AF_INET, thus you create an IPv6 default address?

ACK - with the helper routine...

John




More information about the libvir-list mailing list