Pārlūkot izejas kodu

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

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 11 gadus atpakaļ
vecāks
revīzija
452fb2d0a2

+ 1
- 48
src/hci/commands/dhcp_cmd.c Parādīt failu

@@ -41,53 +41,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
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 44
 /** "pxebs" options */
92 45
 struct pxebs_options {};
93 46
 
@@ -138,7 +91,7 @@ static int pxebs_exec ( int argc, char **argv ) {
138 91
 struct command dhcp_commands[] __command = {
139 92
 	{
140 93
 		.name = "dhcp",
141
-		.exec = dhcp_exec,
94
+		.exec = ifconf_exec, /* synonym for "ifconf" */
142 95
 	},
143 96
 	{
144 97
 		.name = "pxebs",

+ 1
- 1
src/hci/commands/ifmgmt_cmd.c Parādīt failu

@@ -238,7 +238,7 @@ static struct ifcommon_command_descriptor ifconf_cmd =
238 238
  * @v argv		Argument list
239 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 242
 	return ifcommon_exec ( argc, argv, &ifconf_cmd );
243 243
 }
244 244
 

+ 1
- 0
src/include/hci/ifmgmt_cmd.h Parādīt failu

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

Notiek ielāde…
Atcelt
Saglabāt