Re: [PATCH 2/2] netdev: Use the correct pointer type for virSocketAddrFormat()

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

 



  Andrea Bolognani wrote:

> virSocketAddrFormat() wants a single pointer, not a double pointer.
> 
> Fixes the following compilation error on FreeBSD:
> 
>   util/virnetdev.c:1448:72: error: incompatible pointer types passing
>    'virSocketAddr **' to parameter of type 'const virSocketAddr *';
>    remove & [-Werror,-Wincompatible-pointer-types]
>       if (VIR_SOCKET_ADDR_VALID(peer) && !(peerstr = virSocketAddrFormat(&peer)))
>                                                                          ^~~~~
>   ./util/virsocketaddr.h:92:48: note: passing argument to parameter 'addr' here
>   char *virSocketAddrFormat(const virSocketAddr *addr);
>                                                  ^
> ---
>  src/util/virnetdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
> index 6e32ebb..712c3bc 100644
> --- a/src/util/virnetdev.c
> +++ b/src/util/virnetdev.c
> @@ -1445,7 +1445,7 @@ int virNetDevSetIPAddress(const char *ifname,
>      if (!(addrstr = virSocketAddrFormat(addr)))
>          goto cleanup;
>  
> -    if (VIR_SOCKET_ADDR_VALID(peer) && !(peerstr = virSocketAddrFormat(&peer)))
> +    if (VIR_SOCKET_ADDR_VALID(peer) && !(peerstr = virSocketAddrFormat(peer)))
>          goto cleanup;
>  
>      /* format up a broadcast address if this is IPv4 */

ACK (having the same one in my queue :-) ).

On a related note, there's one more issue in this function related to
the peer address support addition. It contains a code like this:

1466     if (peerstr)
1467         virCommandAddArgList(cmd, "pointopoint", peerstr, NULL);

This should work on Linux, but FreeBSD's ifconfig has no support for the
"pointopoint" keyword, the syntax is just "ifconfig $if $addr
$peer_addr". I'll add a fix for that a little later as soon as I figure
out how to give it a real test. Unfortunately, I see no easy way to
detect presence of this keyword in ifconfig, so I guess it's going to be
one more "#ifdef __linux__" knob.

PS Also, appears that a command like this:

ifconfig tun0 inet 192.168.77.0/24 192.168.77.12 broadcast 192.168.77.255

Actually sets peer address to 192.168.77.255. So need to figure out if
we need to set broadcast if have peer address.

Roman Bogorodskiy

--
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]