mirror of https://github.com/ipxe/ipxe.git
[cmdline] Make "dhcp" command a synonym for "ifconf"
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/17/head
parent
506152d467
commit
452fb2d0a2
|
@ -41,53 +41,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** "dhcp" options */
|
|
||||||
struct dhcp_options {};
|
|
||||||
|
|
||||||
/** "dhcp" option list */
|
|
||||||
static struct option_descriptor dhcp_opts[] = {};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute "dhcp" command for a network device
|
|
||||||
*
|
|
||||||
* @v netdev Network device
|
|
||||||
* @v opts Command options
|
|
||||||
* @ret rc Return status code
|
|
||||||
*/
|
|
||||||
static int dhcp_payload ( struct net_device *netdev,
|
|
||||||
struct dhcp_options *opts __unused ) {
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
if ( ( rc = dhcp ( netdev ) ) != 0 ) {
|
|
||||||
printf ( "Could not configure %s: %s\n",
|
|
||||||
netdev->name, strerror ( rc ) );
|
|
||||||
|
|
||||||
/* Close device on failure, to avoid memory exhaustion */
|
|
||||||
netdev_close ( netdev );
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** "dhcp" command descriptor */
|
|
||||||
static struct ifcommon_command_descriptor dhcp_cmd =
|
|
||||||
IFCOMMON_COMMAND_DESC ( struct dhcp_options, dhcp_opts,
|
|
||||||
0, MAX_ARGUMENTS, "[<interface>...]",
|
|
||||||
dhcp_payload, 1 );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The "dhcp" command
|
|
||||||
*
|
|
||||||
* @v argc Argument count
|
|
||||||
* @v argv Argument list
|
|
||||||
* @ret rc Return status code
|
|
||||||
*/
|
|
||||||
static int dhcp_exec ( int argc, char **argv ) {
|
|
||||||
return ifcommon_exec ( argc, argv, &dhcp_cmd );
|
|
||||||
}
|
|
||||||
|
|
||||||
/** "pxebs" options */
|
/** "pxebs" options */
|
||||||
struct pxebs_options {};
|
struct pxebs_options {};
|
||||||
|
|
||||||
|
@ -138,7 +91,7 @@ static int pxebs_exec ( int argc, char **argv ) {
|
||||||
struct command dhcp_commands[] __command = {
|
struct command dhcp_commands[] __command = {
|
||||||
{
|
{
|
||||||
.name = "dhcp",
|
.name = "dhcp",
|
||||||
.exec = dhcp_exec,
|
.exec = ifconf_exec, /* synonym for "ifconf" */
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "pxebs",
|
.name = "pxebs",
|
||||||
|
|
|
@ -238,7 +238,7 @@ static struct ifcommon_command_descriptor ifconf_cmd =
|
||||||
* @v argv Argument list
|
* @v argv Argument list
|
||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
static int ifconf_exec ( int argc, char **argv ) {
|
int ifconf_exec ( int argc, char **argv ) {
|
||||||
return ifcommon_exec ( argc, argv, &ifconf_cmd );
|
return ifcommon_exec ( argc, argv, &ifconf_cmd );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,5 +67,6 @@ struct ifcommon_command_descriptor {
|
||||||
|
|
||||||
extern int ifcommon_exec ( int argc, char **argv,
|
extern int ifcommon_exec ( int argc, char **argv,
|
||||||
struct ifcommon_command_descriptor *cmd );
|
struct ifcommon_command_descriptor *cmd );
|
||||||
|
extern int ifconf_exec ( int argc, char **argv );
|
||||||
|
|
||||||
#endif /* _IFMGMT_CMD_H */
|
#endif /* _IFMGMT_CMD_H */
|
||||||
|
|
Loading…
Reference in New Issue