提交 bf913385 编写于 作者: L Laine Stump

util: fix missing broadcast address in bridge and tap device IP addresses

Commit b3d06987 added peer address setting to the low level
virNetDevSetIPAddress() function, but ended up causing a segfault in
cases where the caller passed NULL for peer address.

Commit a3510e33 fixed the segfault, but managed to cause us to
skip setting the broadcast address when setting an interface's IP
address. The result is that the broadcast address is 0.0.0.0 for all
libvirt-created bridges (and interfaces in lxc containers with IP
addresses set by libvirt).

This was reported on the mailing list:

  https://www.redhat.com/archives/libvir-list/2016-June/msg00027.html

but I was too busy to investigate at the time. I found it by accident
today while refactoring virNetDevSetIPAddress(). Since this regression
is present in the 1.3.5 release, I'm sending the bugfix as a separate
patch from my larger refactoring patchset.
上级 d5fb8f45
...@@ -1129,7 +1129,8 @@ int virNetDevSetIPAddress(const char *ifname, ...@@ -1129,7 +1129,8 @@ int virNetDevSetIPAddress(const char *ifname,
unsigned int recvbuflen; unsigned int recvbuflen;
/* The caller needs to provide a correct address */ /* The caller needs to provide a correct address */
if (VIR_SOCKET_ADDR_FAMILY(addr) == AF_INET && peer && !VIR_SOCKET_ADDR_VALID(peer)) { if (VIR_SOCKET_ADDR_FAMILY(addr) == AF_INET &&
!(peer && VIR_SOCKET_ADDR_VALID(peer))) {
/* compute a broadcast address if this is IPv4 */ /* compute a broadcast address if this is IPv4 */
if (VIR_ALLOC(broadcast) < 0) if (VIR_ALLOC(broadcast) < 0)
return -1; return -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册