First we need to always set value to vz sdk parameter so
we can leverage setting code for device updates. This patch
resolves tristate default to off implicitly. This is easier
then extract default value from vz sdk itself. First current
default is off too, second this approach is already taken
for 'net->linkstate'.
Second dump this option in domain xml.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
src/vz/vz_sdk.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 328a5bc..6b9c10d 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -863,7 +863,7 @@ prlsdkGetNetInfo(PRL_HANDLE netAdapter, virDomainNetDefPtr net, bool
isCt)
PRL_UINT32 netAdapterIndex;
PRL_UINT32 emulatedType;
PRL_RESULT pret;
- PRL_BOOL isConnected;
+ PRL_BOOL isConnected, isMacFilter;
int ret = -1;
/* use device name, shown by prlctl as target device
@@ -962,6 +962,12 @@ prlsdkGetNetInfo(PRL_HANDLE netAdapter, virDomainNetDefPtr net, bool
isCt)
else
net->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN;
+ pret = PrlVmDevNet_IsPktFilterPreventMacSpoof(netAdapter, &isMacFilter);
+ prlsdkCheckRetGoto(pret, cleanup);
+
+ net->trustGuestRxFilters = isMacFilter ? VIR_TRISTATE_BOOL_YES :
+ VIR_TRISTATE_BOOL_NO;
+
ret = 0;
cleanup:
return ret;
@@ -3184,10 +3190,8 @@ static int prlsdkConfigureNet(vzDriverPtr driver,
prlsdkCheckRetGoto(pret, cleanup);
}
- if (net->trustGuestRxFilters == VIR_TRISTATE_BOOL_YES)
- pret = PrlVmDevNet_SetPktFilterPreventMacSpoof(sdknet, 0);
- else if (net->trustGuestRxFilters == VIR_TRISTATE_BOOL_NO)
- pret = PrlVmDevNet_SetPktFilterPreventMacSpoof(sdknet, 1);
+ pret = PrlVmDevNet_SetPktFilterPreventMacSpoof(sdknet,
+ net->trustGuestRxFilters == VIR_TRISTATE_BOOL_YES);
prlsdkCheckRetGoto(pret, cleanup);
ret = 0;
--
1.8.3.1