1
0
mirror of https://github.com/rancher/os.git synced 2025-07-04 02:26:13 +00:00

Revert "Change dhcpcd master node startup function"

This reverts commit b1c5892b87.
This commit is contained in:
niusmallnan 2018-11-19 11:56:12 +08:00
parent b1c5892b87
commit ec0fbd6e2c

View File

@ -24,11 +24,10 @@ const (
) )
var ( var (
defaultDhcpArgs = []string{"dhcpcd", "-MA4"} defaultDhcpArgs = []string{"dhcpcd", "-MA4"}
inactiveDhcpArgs = []string{"dhcpcd", "-MA4", "--inactive"} exitDhcpArgs = []string{"dhcpcd", "-x"}
exitDhcpArgs = []string{"dhcpcd", "-x"} exitWpaArgs = []string{"wpa_cli", "terminate"}
exitWpaArgs = []string{"wpa_cli", "terminate"} dhcpReleaseCmd = "dhcpcd --release"
dhcpReleaseCmd = "dhcpcd --release"
) )
func createInterfaces(netCfg *NetworkConfig) { func createInterfaces(netCfg *NetworkConfig) {
@ -179,12 +178,7 @@ func ApplyNetworkConfigs(netCfg *NetworkConfig, userSetHostname, userSetDNS bool
wg := sync.WaitGroup{} wg := sync.WaitGroup{}
// Don't start any interfaces other than those specified on the command line. //apply network config
// This allows dhcpcd to be started in Master mode.
// Then wait for subsequent dhcpcd commands to start each interface as required.
runInactiveDhcp()
// apply network config
for _, link := range links { for _, link := range links {
applyOuter(link, netCfg, &wg, userSetHostname, userSetDNS) applyOuter(link, netCfg, &wg, userSetHostname, userSetDNS)
} }
@ -288,15 +282,6 @@ func hasDhcp(iface string) bool {
return len(out) > 0 return len(out) > 0
} }
func runInactiveDhcp() {
cmd := exec.Command(inactiveDhcpArgs[0], inactiveDhcpArgs[1:]...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
log.Errorf("Failed to run command [%v]: %v", cmd, err)
}
}
func runDhcp(netCfg *NetworkConfig, iface string, argstr string, setHostname, setDNS bool) { func runDhcp(netCfg *NetworkConfig, iface string, argstr string, setHostname, setDNS bool) {
args := []string{} args := []string{}
if argstr != "" { if argstr != "" {