func()

in cni/vmconf/vmconf.go [99:148]


func (c StaticNetworkConf) IPBootParam() string {
	// See "ip=" section of kernel linked above for details on each field listed below.

	// client-ip is really just the ip that will be assigned to the primary interface
	clientIP := c.VMIPConfig.Address.IP.String()

	// don't set nfs server IP
	const serverIP = ""

	// default gateway for the network; used to generate a corresponding route table entry
	defaultGateway := c.VMIPConfig.Gateway.String()

	// subnet mask used to generate a corresponding route table entry for the primary interface
	// (must be provided in dotted decimal notation)
	subnetMask := fmt.Sprintf("%d.%d.%d.%d",
		c.VMIPConfig.Address.Mask[0],
		c.VMIPConfig.Address.Mask[1],
		c.VMIPConfig.Address.Mask[2],
		c.VMIPConfig.Address.Mask[3],
	)

	// the "hostname" field actually just configures a hostname value for DHCP requests, thus no need to set it
	const dhcpHostname = ""

	// If blank, use the only network device present in the VM
	device := c.VMIfName

	// Don't do any autoconfiguration (i.e. DHCP, BOOTP, RARP)
	const autoconfiguration = "off"

	// up to two nameservers (if any were provided)
	var nameservers [2]string
	copy(nameservers[:], c.VMNameservers)

	// TODO(sipsma) should we support configuring an NTP server?
	const ntpServer = ""

	return strings.Join([]string{
		clientIP,
		serverIP,
		defaultGateway,
		subnetMask,
		dhcpHostname,
		device,
		autoconfiguration,
		nameservers[0],
		nameservers[1],
		ntpServer,
	}, ":")
}