[DHCP] Fix up fake-packet creation as used by PXENV_GET_CACHED_INFO

Add dedicated functions create_dhcpdiscover(), create_dhcpack() and
create_proxydhcpack() for use by external code such as the PXE preboot
code.

Register ProxyDHCP options under the global scope "proxydhcp".

Unregister previously-acquired DHCP and ProxyDHCP settings when DHCP
succeeds.
This commit is contained in:
Michael Brown
2008-03-23 21:58:05 +00:00
parent 1741e3e761
commit ee4206a8a7
5 changed files with 148 additions and 79 deletions

View File

@@ -33,18 +33,12 @@
*/
int dhcp ( struct net_device *netdev ) {
struct settings *settings;
int rc;
/* Check we can open the interface first */
if ( ( rc = ifopen ( netdev ) ) != 0 )
return rc;
/* Unregister any option blocks acquired via DHCP */
settings = find_child_settings ( netdev_settings ( netdev ), "dhcp" );
if ( settings )
unregister_settings ( settings );
/* Perform DHCP */
printf ( "DHCP (%s %s)", netdev->name, netdev_hwaddr ( netdev ) );
if ( ( rc = start_dhcp ( &monojob, netdev ) ) == 0 )