mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix: dhcp hostname not compatible with some os
This commit is contained in:
@@ -182,10 +182,12 @@ func (s *SGuestDHCPServer) getGuestConfig(
|
||||
conf.ServerIP = net.ParseIP(v4Ip.NetAddr(int8(masklen)).String())
|
||||
conf.SubnetMask = net.ParseIP(netutils2.Netlen2Mask(int(masklen)))
|
||||
conf.BroadcastAddr = v4Ip.BroadcastAddr(int8(masklen)).ToBytes()
|
||||
conf.Hostname = guestDesc.Name
|
||||
if len(guestDesc.Hostname) > 0 {
|
||||
conf.Hostname = guestDesc.Hostname
|
||||
} else {
|
||||
conf.Hostname = guestDesc.Name
|
||||
}
|
||||
conf.Hostname = strings.ToLower(conf.Hostname)
|
||||
conf.Domain = nicdesc.Domain
|
||||
|
||||
// get main ip
|
||||
|
||||
@@ -59,11 +59,7 @@ type ResponseConfig struct {
|
||||
}
|
||||
|
||||
func (conf ResponseConfig) GetHostname() string {
|
||||
hostname := conf.Hostname
|
||||
if conf.Domain != "" {
|
||||
hostname = fmt.Sprintf("%s.%s", hostname, conf.Domain)
|
||||
}
|
||||
return hostname
|
||||
return conf.Hostname
|
||||
}
|
||||
|
||||
func GetOptUint16(val uint16) []byte {
|
||||
|
||||
Reference in New Issue
Block a user