Browse Source

[cmdline] Make "dhcp" command a synonym for "ifconf"

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 11 years ago
parent
commit
452fb2d0a2
3 changed files with 3 additions and 49 deletions
  1. 1
    48
      src/hci/commands/dhcp_cmd.c
  2. 1
    1
      src/hci/commands/ifmgmt_cmd.c
  3. 1
    0
      src/include/hci/ifmgmt_cmd.h

+ 1
- 48
src/hci/commands/dhcp_cmd.c View File

41
  *
41
  *
42
  */
42
  */
43
 
43
 
44
-/** "dhcp" options */
45
-struct dhcp_options {};
46
-
47
-/** "dhcp" option list */
48
-static struct option_descriptor dhcp_opts[] = {};
49
-
50
-/**
51
- * Execute "dhcp" command for a network device
52
- *
53
- * @v netdev		Network device
54
- * @v opts		Command options
55
- * @ret rc		Return status code
56
- */
57
-static int dhcp_payload ( struct net_device *netdev,
58
-			  struct dhcp_options *opts __unused ) {
59
-	int rc;
60
-
61
-	if ( ( rc = dhcp ( netdev ) ) != 0 ) {
62
-		printf ( "Could not configure %s: %s\n",
63
-			 netdev->name, strerror ( rc ) );
64
-
65
-		/* Close device on failure, to avoid memory exhaustion */
66
-		netdev_close ( netdev );
67
-
68
-		return rc;
69
-	}
70
-
71
-	return 0;
72
-}
73
-
74
-/** "dhcp" command descriptor */
75
-static struct ifcommon_command_descriptor dhcp_cmd =
76
-	IFCOMMON_COMMAND_DESC ( struct dhcp_options, dhcp_opts,
77
-				0, MAX_ARGUMENTS, "[<interface>...]",
78
-				dhcp_payload, 1 );
79
-
80
-/**
81
- * The "dhcp" command
82
- *
83
- * @v argc		Argument count
84
- * @v argv		Argument list
85
- * @ret rc		Return status code
86
- */
87
-static int dhcp_exec ( int argc, char **argv ) {
88
-	return ifcommon_exec ( argc, argv, &dhcp_cmd );
89
-}
90
-
91
 /** "pxebs" options */
44
 /** "pxebs" options */
92
 struct pxebs_options {};
45
 struct pxebs_options {};
93
 
46
 
138
 struct command dhcp_commands[] __command = {
91
 struct command dhcp_commands[] __command = {
139
 	{
92
 	{
140
 		.name = "dhcp",
93
 		.name = "dhcp",
141
-		.exec = dhcp_exec,
94
+		.exec = ifconf_exec, /* synonym for "ifconf" */
142
 	},
95
 	},
143
 	{
96
 	{
144
 		.name = "pxebs",
97
 		.name = "pxebs",

+ 1
- 1
src/hci/commands/ifmgmt_cmd.c View File

238
  * @v argv		Argument list
238
  * @v argv		Argument list
239
  * @ret rc		Return status code
239
  * @ret rc		Return status code
240
  */
240
  */
241
-static int ifconf_exec ( int argc, char **argv ) {
241
+int ifconf_exec ( int argc, char **argv ) {
242
 	return ifcommon_exec ( argc, argv, &ifconf_cmd );
242
 	return ifcommon_exec ( argc, argv, &ifconf_cmd );
243
 }
243
 }
244
 
244
 

+ 1
- 0
src/include/hci/ifmgmt_cmd.h View File

67
 
67
 
68
 extern int ifcommon_exec (  int argc, char **argv,
68
 extern int ifcommon_exec (  int argc, char **argv,
69
 			    struct ifcommon_command_descriptor *cmd );
69
 			    struct ifcommon_command_descriptor *cmd );
70
+extern int ifconf_exec ( int argc, char **argv );
70
 
71
 
71
 #endif /* _IFMGMT_CMD_H */
72
 #endif /* _IFMGMT_CMD_H */

Loading…
Cancel
Save