mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 05:17:59 +03:00
Disable nwfilter driver when running unprivileged
When opening a new connection to the driver, nwfilterOpen only succeeds if the driverState has been allocated. Move the privilege check in driver initialization before the state allocation to disable the driver. This changes the nwfilter-define error from: error: cannot create config directory (null): Bad address To: this function is not supported by the connection driver: virNWFilterDefineXML https://bugzilla.redhat.com/show_bug.cgi?id=1029266
This commit is contained in:
parent
7d58c7fc8e
commit
b7829f959b
@ -174,6 +174,9 @@ nwfilterStateInitialize(bool privileged,
|
||||
char *base = NULL;
|
||||
DBusConnection *sysbus = NULL;
|
||||
|
||||
if (!privileged)
|
||||
return 0;
|
||||
|
||||
#if WITH_DBUS
|
||||
if (virDBusHasSystemBus() &&
|
||||
!(sysbus = virDBusGetSystemBus()))
|
||||
@ -190,9 +193,6 @@ nwfilterStateInitialize(bool privileged,
|
||||
driverState->watchingFirewallD = (sysbus != NULL);
|
||||
driverState->privileged = privileged;
|
||||
|
||||
if (!privileged)
|
||||
return 0;
|
||||
|
||||
nwfilterDriverLock(driverState);
|
||||
|
||||
if (virNWFilterIPAddrMapInit() < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user