In case the INF file is driver-isolation compatible the file
copied to directory other than %13% might be deleted on network
driver uninstall. In such case we should keep the protocol
running until other event happens, like protocol driver uninstall
or network driver installation.
Signed-off-by: Yuri Benditovich <[email protected]>
https://issues.redhat.com/browse/RHEL-31482
Before this commit: netkvmp.exe is installed by protocol INF
to system32 directory, INF also creates netkvmp service for
this binary. The netkvmp.exe works with netkvm driver using
IOCTLs and continues doing it in case the netkvm driver is
updated, so these binaries at some point might get out of sync.
In order to update the netkvmp.exe the protocol INF must be
reinstalled.
After this commit: netkvmp.exe is installed by netkvm INF to
system directory. When the netkvmp.exe is called to install
the protocol it first copies itself to system32\netkvmps.exe,
then it installs protocol INF, which creates netkvmp service
with existing netkvmps.exe file. The service from time to time
checks that the service binary (netkvmps.exe) is identical to
netkvmp.exe. When it detects they are out of sync, it starts
'netkvmp.exe restartservice' and stops. The netkvmp.exe
copies itself to netkvmps.exe and starts the service. Such a
way, the protocol service is always in sync with netkvm driver.
Signed-off-by: Yuri Benditovich <[email protected]>
Make service stop synchronous or asynchronous depending on
the state of running thread. Normally the service will complete
the stop asynchronously when the thread stops running. Also
in case the service thread will decide to finish (in later case of
self-update) it should indicate the stopped state correctly.
Signed-off-by: Yuri Benditovich <[email protected]>
Make it exactly as described in the decumentation:
'i' or 'install', 'u' or 'uninstall'
add usage for not recognized parameters.
Signed-off-by: Yuri Benditovich <[email protected]>
This flag was used to determine whether we need to restore
functional state of adapters on service stop. The proper way
to do that is to check whether the VIOPROT is installed.
Signed-off-by: Yuri Benditovich <[email protected]>
When network devices come to enabled/disabled state or
added/removed - process the change immediately and not only
via periodical polling
Signed-off-by: Yuri Benditovich <[email protected]>
"netkvmp i" must have vioprot.inf (and CAT) in the current
directory. To avoid misunderstandings, add a check for the
INF file in the current directory.
Signed-off-by: Yuri Benditovich <[email protected]>
The goal is to keep full functionality after protocol uninstall
in several major cases:
- VF present and the failover pair works
After uninstall the virtio-net should become link off (suppressed)
and the VF should obtain the IP address correctly
- VF not present and the virtio-net works
After uninstall the virtio-net should become link off (suppressed)
The flag 'NoRestoreOnStop' is for future possibility to stop/start
the service without protocol uninstall.
Signed-off-by: Yuri Benditovich <[email protected]>
Indicate stopped state only after the thread is finished.
Otherwise the structures in the memory might be unpredictably
modified.
Signed-off-by: Yuri Benditovich <[email protected]>
Add scan for INF files and uninstall of the protocol's INF file.
Now the uninstall script is not needed, just "netkvmp u".
Signed-off-by: Yuri Benditovich <[email protected]>
Add logic to the user-mode protocol service to replace and
extend the functionality of the notification object:
- install VIOPROT for all the network adapters
- disable all other protocols for relevant VF only when needed
- enable all the protocols on netkvm disable
- enable all the protocol on VIOPROT uninstall
- ... (see in the source code)
Signed-off-by: Yuri Benditovich <[email protected]>
The netkvmp service on protocol uninstall is stopped
automatically (by INF statement). Upon stop the service
will run its own binary with command-line ' -x' that
directs the executable to run post-uninstall action:
1. Send WMI set 'NetKvm_Standby.value=0' to force all
the instances that support standby feature to indicate
link off (return to their initial behavior)
2. Send WMI query for 'NetKvm_Standby' and parse the response.
Note friendly names of all the instances that support
standby feature. Access these instances via SetupAPI and
restart them.
Signed-off-by: Yuri Benditovich <[email protected]>