Init ipvsInterface only when ipvs modules are present

This commit is contained in:
Weibin Lin
2018-05-17 14:33:47 +08:00
parent 09c9ecd3fd
commit ff8b70c409
2 changed files with 6 additions and 1 deletions

View File

@@ -92,9 +92,11 @@ func newProxyServer(
dbus = utildbus.New()
iptInterface = utiliptables.New(execer, dbus, protocol)
ipvsInterface = utilipvs.New(execer)
kernelHandler = ipvs.NewLinuxKernelHandler()
ipsetInterface = utilipset.New(execer)
if canUse, _ := ipvs.CanUseIPVSProxier(kernelHandler, ipsetInterface); canUse {
ipvsInterface = utilipvs.New(execer)
}
// We omit creation of pretty much everything if we run in cleanup mode
if cleanupAndExit {