mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
nwfilter: Check for filter presence before open connect during teardown
https://bugzilla.redhat.com/show_bug.cgi?id=1608275 Instantiation of an nwfilter binding is only allowed when the net->filter is defined for the network; however, the teardown of the binding does not make this check. This leaves open the possibility that the teardown could be called during guest shutdown/teardown in session mode resulting in the following error being logged: error : nwfilterConnectOpen:383 : internal error: unexpected nwfilter URI path '/session', try nwfilter:///system So before going through the teardown processing, let's be sure the network had a filter and then attempt to get a connection. For session mode it's not even possible create an nwfilter binding. Signed-off-by: John Ferlan <jferlan@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
e773e1cbbc
commit
dbfe8acae5
@ -149,9 +149,12 @@ virDomainConfNWFilterTeardownImpl(virConnectPtr conn,
|
||||
void
|
||||
virDomainConfNWFilterTeardown(virDomainNetDefPtr net)
|
||||
{
|
||||
virConnectPtr conn = virGetConnectNWFilter();
|
||||
virConnectPtr conn;
|
||||
|
||||
if (!conn)
|
||||
if (!net->filter)
|
||||
return;
|
||||
|
||||
if (!(conn = virGetConnectNWFilter()))
|
||||
return;
|
||||
|
||||
virDomainConfNWFilterTeardownImpl(conn, net);
|
||||
@ -163,14 +166,19 @@ void
|
||||
virDomainConfVMNWFilterTeardown(virDomainObjPtr vm)
|
||||
{
|
||||
size_t i;
|
||||
virConnectPtr conn = virGetConnectNWFilter();
|
||||
virConnectPtr conn = NULL;
|
||||
|
||||
if (!conn)
|
||||
return;
|
||||
for (i = 0; i < vm->def->nnets; i++) {
|
||||
virDomainNetDefPtr net = vm->def->nets[i];
|
||||
|
||||
if (!net->filter)
|
||||
continue;
|
||||
|
||||
for (i = 0; i < vm->def->nnets; i++)
|
||||
virDomainConfNWFilterTeardownImpl(conn, vm->def->nets[i]);
|
||||
if (!conn && !(conn = virGetConnectNWFilter()))
|
||||
return;
|
||||
|
||||
virDomainConfNWFilterTeardownImpl(conn, net);
|
||||
}
|
||||
|
||||
virObjectUnref(conn);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user