[ipxe-devel] [PATCH 3/3] Set correct 'origin' field in iBFT structure

Michael Brown mcb30 at ipxe.org
Sun Jun 1 22:39:26 UTC 2014


On 30/05/14 08:18, Hannes Reinecke wrote:
> The iBFT structure has an 'origin' field, which should specify
> the IP address origin. As we can do dhcp we should be filling
> in this structure to give the OS an indication here.
>
> +	/* Fill in origin */
> +	parent = netdev_settings( netdev );
> +	if (find_child_settings( parent, DHCP_SETTINGS_NAME ) != NULL)
> +		nic->origin = IBFT_NIC_ORIGIN_DHCP;
> +	else
> +		nic->origin = IBFT_NIC_ORIGIN_MANUAL;
> +

This is interesting.  The test as you've written it will detect if DHCP 
was ever performed on the network device.  If an address was obtained 
via DHCP and then overridden with a static address using "set net0/ip 
x.x.x.x" then the DHCP settings block will still exist and so the code 
would end up reporting DHCP as the origin of the address.

What does the origin field get used for?  Given that the iBFT NIC 
structure contains multiple settings which can come from different 
sources (e.g. IP address, DNS server, hostname), how ought we to 
determine which origin to report?

Michael



More information about the ipxe-devel mailing list