Commit Graph
30 Commits
Author SHA1 Message Date
Vitalii Chulak 44375571e4 RHEL-69071: fix broken style for ProtocolService folder in NetKVM
Signed-off-by: Vitalii Chulak <[email protected]>
2025-01-15 11:39:46 +02:00
Vitalii Chulak 61466d2972 RHEL-69071: clang-format for ProtocolService folder in NetKVM
Signed-off-by: Vitalii Chulak <[email protected]>
2025-01-15 11:39:46 +02:00
Yuri Benditovich 918a814456 netkvm-prot: fix typo in printout
Signed-off-by: Yuri Benditovich <[email protected]>
2024-06-25 10:30:06 +03:00
Yuri Benditovich 0c536eb25d netkvm-prot: do not stop service if the netkvmp.exe is deleted
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]>
2024-06-25 10:30:06 +03:00
Yuri Benditovich 66246289fd netkvm-prot: update protocol service binary at runtime
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]>
2024-04-05 16:47:02 +03:00
Yuri Benditovich 1be84c81fe netkvm-prot: add system directory getter class
Signed-off-by: Yuri Benditovich <[email protected]>
2024-04-05 16:47:02 +03:00
Yuri Benditovich 3ae4694b64 netkvm-prot: support delayed stop of the service
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]>
2024-04-05 16:47:02 +03:00
Yuri Benditovich a3739eee82 netkvm-prot: rework processing of app parameters
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]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich 3ae46f9c9b netkvm-prot: split large function CNetCfg::EnableComponents
Signed-off-by: Yuri Benditovich <[email protected]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich 97400cde06 netkvm-prot: fixes in protocol teardown flow
Now the protocol service works correctly in both uninstall
and temporary service stop flows.

Signed-off-by: Yuri Benditovich <[email protected]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich 56aa0f26e3 netkvm-prot: discard old unneeded uninstall option
Signed-off-by: Yuri Benditovich <[email protected]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich c5135401c0 netkvm-prot: remove explicit "norestore" flag
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]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich 2cfd4a4207 netkvmp-prot: add device notification to trigger working thread
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]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich b5548aeab9 netkvm-prot: refactor CInterfaceTable for flexibility
Signed-off-by: Yuri Benditovich <[email protected]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich 235e6e7f20 netkvm-prot: add ability to dump existing network adapters
"netkvmp e" - for internal purposes

Signed-off-by: Yuri Benditovich <[email protected]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich 936106aead netkvm-prot: check for vioprot.inf on install
"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]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich ff174d21f3 netkvm-prot: add query whether VIOPROT installed
Signed-off-by: Yuri Benditovich <[email protected]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich 9641b25a97 netkvm-prot: add sequence for case of protocol uninstall
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]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich 56e0fe767a netkvm-prot: make CheckBinding more flexible
Add several useful binding settings (bind VIOPROT only, other
only, all, disable/enable tcpip).

Signed-off-by: Yuri Benditovich <[email protected]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich d9e2854861 netkvm-prot: move SET_LINK command to separate procedure
We'll reuse it later.

Signed-off-by: Yuri Benditovich <[email protected]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich 32ea737009 netkvm-prot: fix stopped state indication
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]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich 9f1e4e6be3 netkvm-prot: fix INetCfg WriteLock usage
Make it exactly as in the Microsoft example.

Signed-off-by: Yuri Benditovich <[email protected]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich 0f423bf5fe netkvm-prot: make state machine table explicitly static
Signed-off-by: Yuri Benditovich <[email protected]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich 9e3e49a6be netkvm-prot: add INF uninstall to the uninstall procedure
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]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich 88d3797583 netkvm-prot: add d(ump) command to the netkvmp
Signed-off-by: Yuri Benditovich <[email protected]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich fd5ab060f4 netkvm-prot: install/uninstall protocol via netkvmp.exe
netkvmp i/u installs and uninstalls the protocol.
The goal is to avoid additional batch files.

Signed-off-by: Yuri Benditovich <[email protected]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich 705aaea93d netkvm-prot: add protocol state machine
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]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich 289f2e4ae6 netkvm: handle protocol uninstallation
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]>
2021-04-01 15:11:46 +03:00
Yuri Benditovich f1723b6e40 netkvm: protocol service: add copyright text
Signed-off-by: Yuri Benditovich <[email protected]>
2020-07-09 15:23:33 +03:00
Yuri Benditovich aa303f9a86 netkvm: introduce dummy service project
This service binary will be used as an executable for the
installation of the protocol.

Signed-off-by: Yuri Benditovich <[email protected]>
2020-07-07 17:53:39 +03:00