diff --git a/bindata/scripts/load-kmod.sh b/bindata/scripts/load-kmod.sh index fb80eebf3..7f3d4dc58 100755 --- a/bindata/scripts/load-kmod.sh +++ b/bindata/scripts/load-kmod.sh @@ -1,7 +1,7 @@ #!/bin/sh # chroot /host/ modprobe $1 kmod_name=$(tr "-" "_" <<< $1) -chroot /host/ lsmod | grep $1 >& /dev/null +chroot /host/ lsmod | grep "^$1" >& /dev/null if [ $? -eq 0 ] then diff --git a/pkg/daemon/daemon.go b/pkg/daemon/daemon.go index a35b2db28..a5d9917b6 100644 --- a/pkg/daemon/daemon.go +++ b/pkg/daemon/daemon.go @@ -231,6 +231,7 @@ func (dn *Daemon) Run(stopCh <-chan struct{}, exitCh <-chan error) error { defer dn.workqueue.ShutDown() tryEnableRdma() + tryEnableTun() if err := sriovnetworkv1.InitNicIdMap(dn.kubeClient, namespace); err != nil { return err @@ -942,6 +943,12 @@ func registerPlugins(ns *sriovnetworkv1.SriovNetworkNodeState) []string { return nameList } +func tryEnableTun() { + if err := utils.LoadKernelModule("tun"); err != nil { + glog.Errorf("tryEnableTun(): TUN kernel module not loaded: %v", err) + } +} + func tryEnableRdma() (bool, error) { glog.V(2).Infof("tryEnableRdma()") var stdout, stderr bytes.Buffer