This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
RedBoot: add -b option to ip command to obtain IP using BOOTP
- From: David Vrabel <dvrabel at arcom dot com>
- To: eCos Patches <ecos-patches at ecos dot sourceware dot org>
- Date: Thu, 21 Apr 2005 14:35:28 +0100
- Subject: RedBoot: add -b option to ip command to obtain IP using BOOTP
Hi,
This patch adds an -b option to the ip command in RedBoot. This option
causes RedBoot to perform a BOOTP/DHCP request to obtain a new IP
address (etc.). It also updates the RedBoot documentation to cover the
new option.
It's more convinient to do a quick "ip -b" than to change the fconfig
setting and reboot.
David Vrabel
--
David Vrabel, Design Engineer
Arcom, Clifton Road Tel: +44 (0)1223 411200 ext. 3233
Cambridge CB1 7EA, UK Web: http://www.arcom.com/
%status
pending
%patch
Index: packages/redboot/current/ChangeLog
===================================================================
--- packages/redboot/current/ChangeLog.orig 2005-04-21 10:46:32.000000000 +0100
+++ packages/redboot/current/ChangeLog 2005-04-21 14:20:26.000000000 +0100
@@ -1,3 +1,11 @@
+2005-04-21 Ian Campbell <icampbell@arcom.com>
+
+ * src/net/net_io.c (do_ip_addr): Add a '-b' option to obtain IP
+ address using BOOTP/DHCP.
+
+ * doc/redboot_cmds.sgml: Document the new '-b' option to the
+ 'ip_address' command.
+
2005-04-21 David Vrabel <dvrabel@arcom.com>
* src/main.c (cyg_start): Use the workspace memory section
Index: packages/redboot/current/src/net/net_io.c
===================================================================
--- packages/redboot/current/src/net/net_io.c.orig 2005-04-21 10:55:33.000000000 +0100
+++ packages/redboot/current/src/net/net_io.c 2005-04-21 13:48:46.000000000 +0100
@@ -795,7 +795,11 @@
}
}
-static char usage[] = "[-l <local_ip_address>[/<mask_len>]] [-h <server_address>]";
+static char usage[] = "[-b] [-l <local_ip_address>[/<mask_len>]] [-h <server_address>]"
+#ifdef CYGPKG_REDBOOT_NETWORKING_DNS
+ " [-d <dns_server_address]"
+#endif
+ ;
// Exported CLI function
static void do_ip_addr(int argc, char *argv[]);
@@ -808,9 +812,10 @@
void
do_ip_addr(int argc, char *argv[])
{
- struct option_info opts[3];
+ struct option_info opts[4];
char *ip_addr, *host_addr;
bool ip_addr_set, host_addr_set;
+ bool do_bootp = false;
struct sockaddr_in host;
#ifdef CYGPKG_REDBOOT_NETWORKING_DNS
char *dns_addr;
@@ -822,9 +827,11 @@
(void *)&ip_addr, (bool *)&ip_addr_set, "local IP address");
init_opts(&opts[1], 'h', true, OPTION_ARG_TYPE_STR,
(void *)&host_addr, (bool *)&host_addr_set, "default server address");
- num_opts = 2;
+ init_opts(&opts[2], 'b', false, OPTION_ARG_TYPE_FLG,
+ &do_bootp, 0, "use BOOTP");
+ num_opts = 3;
#ifdef CYGPKG_REDBOOT_NETWORKING_DNS
- init_opts(&opts[2], 'd', true, OPTION_ARG_TYPE_STR,
+ init_opts(&opts[num_opts], 'd', true, OPTION_ARG_TYPE_STR,
(void *)&dns_addr, (bool *)&dns_addr_set, "DNS server address");
num_opts++;
#endif
@@ -834,6 +841,11 @@
if (!scan_opts(argc, argv, 1, opts, num_opts, 0, 0, "")) {
return;
}
+ if (do_bootp) {
+ if (__bootp_find_local_ip(&my_bootp_info) != 0) {
+ diag_printf("Failed to get BOOTP address\n");
+ }
+ }
if (ip_addr_set) {
#ifdef CYGSEM_REDBOOT_NETWORKING_USE_GATEWAY
char *slash_pos;
Index: packages/redboot/current/doc/redboot_cmds.sgml
===================================================================
--- packages/redboot/current/doc/redboot_cmds.sgml.orig 2004-11-09 19:12:55.000000000 +0000
+++ packages/redboot/current/doc/redboot_cmds.sgml 2005-04-21 14:15:57.000000000 +0100
@@ -1092,6 +1092,7 @@
<refsynopsisdiv>
<cmdsynopsis>
<command>ip_address</command>
+ <arg>-b</arg>
<arg>-l <replaceable> local_IP_address</replaceable>
<arg choice=opt>/<replaceable>netmask_length</replaceable></arg> </arg>
<arg>-h <replaceable> server_IP_address</replaceable></arg>
@@ -1116,6 +1117,12 @@
</row>
</thead>
<tbody>
+ <row>
+ <entry>-b</entry>
+ <entry>Boolean</entry>
+ <entry>Obtain an IP address using BOOTP or DHCP.</entry>
+ <entry>don't use BOOTP/DHCP</entry>
+ </row>
<row>
<entry>-l <replaceable>
local_IP_address</replaceable><option>[<replaceable>/netmask_length</replaceable>]</option></entry>