예제 #1
0
// Checks if iptables version has a "wait" flag
func getIPTablesWaitFlag(vstring string) []string {
	version, err := utilversion.ParseGeneric(vstring)
	if err != nil {
		glog.Errorf("vstring (%s) is not a valid version string: %v", vstring, err)
		return nil
	}

	minVersion, err := utilversion.ParseGeneric(MinWaitVersion)
	if err != nil {
		glog.Errorf("MinWaitVersion (%s) is not a valid version string: %v", MinWaitVersion, err)
		return nil
	}
	if version.LessThan(minVersion) {
		return nil
	}

	minVersion, err = utilversion.ParseGeneric(MinWait2Version)
	if err != nil {
		glog.Errorf("MinWait2Version (%s) is not a valid version string: %v", MinWait2Version, err)
		return nil
	}
	if version.LessThan(minVersion) {
		return []string{"-w"}
	} else {
		return []string{"-w2"}
	}
}
예제 #2
0
// Checks if iptables has the "-C" flag
func getIPTablesHasCheckCommand(vstring string) bool {
	minVersion, err := utilversion.ParseGeneric(MinCheckVersion)
	if err != nil {
		glog.Errorf("MinCheckVersion (%s) is not a valid version string: %v", MinCheckVersion, err)
		return true
	}
	version, err := utilversion.ParseGeneric(vstring)
	if err != nil {
		glog.Errorf("vstring (%s) is not a valid version string: %v", vstring, err)
		return true
	}
	return version.AtLeast(minVersion)
}