Even if an interface of type 'network', setting 'floor' is only supported if the network's forward type is nat, route, open or none. Signed-off-by: Pavel Mores <pmores@xxxxxxxxxx> --- src/network/bridge_driver.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 94212eec77..3b70e52afd 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -5062,9 +5062,26 @@ networkCheckBandwidth(virNetworkObjPtr obj, unsigned long long tmp_floor_sum = virNetworkObjGetFloorSum(obj); unsigned long long tmp_new_rate = 0; char ifmac[VIR_MAC_STRING_BUFLEN]; + virNetworkForwardType fwdType; + bool floorSupported; + bool floorRequested; virMacAddrFormat(ifaceMac, ifmac); + fwdType = def->forward.type; + floorSupported = fwdType == VIR_NETWORK_FORWARD_NONE || + fwdType == VIR_NETWORK_FORWARD_NAT || + fwdType == VIR_NETWORK_FORWARD_ROUTE || + fwdType == VIR_NETWORK_FORWARD_OPEN; + + floorRequested = ifaceBand && ifaceBand->in && ifaceBand->in->floor != 0; + + if (floorRequested && !floorSupported) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("'floor' is only supported for interface type 'network' with forward type 'nat', 'route', 'open' or none")); + return -1; + } + if (ifaceBand && ifaceBand->in && ifaceBand->in->floor && !(netBand && netBand->in)) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, -- 2.24.1