On 11/28/18 4:38 AM, Julio Faracco wrote: > This commit fixes a bug when you have multiple network settings defined. > Basically, if you set an IPv6 or IPv4 gateway, it carries on next > network settings. It is happening because the data is not being > initialized when a new network type is defined. So, the old data still > persists into the pointer. > > Signed-off-by: Julio Faracco <jcfaracco@xxxxxxxxx> > --- > src/lxc/lxc_native.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c > index 9f6d4b3de8..246623d4a1 100644 > --- a/src/lxc/lxc_native.c > +++ b/src/lxc/lxc_native.c > @@ -583,6 +583,9 @@ lxcNetworkWalkCallback(const char *name, virConfValuePtr value, void *data) > parseData->ips = NULL; > parseData->nips = 0; > > + parseData->gateway_ipv4 = NULL; > + parseData->gateway_ipv6 = NULL; > + > /* Keep the new value */ > parseData->type = value->str; > } > So all members are reset except .def, .networks, .privnet. How about storing them in a temporary variables and calling memset? Alternatively, we can have a temp variable with c99 initialization + memcpy. This is just horrible. It's very easy to clear out new member (should they be added). Michal -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list