|
@@ -1,10 +1,7 @@
|
|
|
package macvlan
|
|
|
|
|
|
import (
|
|
|
- "bufio"
|
|
|
"fmt"
|
|
|
- "os"
|
|
|
- "os/exec"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
|
|
@@ -76,25 +73,6 @@ func parentExists(ifaceStr string) bool {
|
|
|
return true
|
|
|
}
|
|
|
|
|
|
-// kernelSupport for the necessary kernel module for the driver type
|
|
|
-func kernelSupport(networkTpe string) error {
|
|
|
- // attempt to load the module, silent if successful or already loaded
|
|
|
- exec.Command("modprobe", macvlanType).Run()
|
|
|
- f, err := os.Open("/proc/modules")
|
|
|
- if err != nil {
|
|
|
- return err
|
|
|
- }
|
|
|
- defer f.Close()
|
|
|
- s := bufio.NewScanner(f)
|
|
|
- for s.Scan() {
|
|
|
- if strings.Contains(s.Text(), macvlanType) {
|
|
|
- return nil
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return fmt.Errorf("unable to load the Linux kernel module %s", macvlanType)
|
|
|
-}
|
|
|
-
|
|
|
// createVlanLink parses sub-interfaces and vlan id for creation
|
|
|
func createVlanLink(parentName string) error {
|
|
|
if strings.Contains(parentName, ".") {
|