Hi Okuji,
Although my tftpserver override patch was not reversed, it was not
against the latest version in cvs as this one is.
Regards,
-Neal
On Sat, Apr 29, 2000 at 11:43:35PM +0900, OKUJI Yoshinori wrote:
> For developers: I realize that contributors sometimes send reversed
> patches. Please don't reverse patches, because that confuses me very
> much. If you'd like to make patches for a release version, do this:
>
> $ diff -urN grub-0.5.xx grub-0.5.xx-with-your-patches
>
> But don't do this:
>
> $ diff -urN grub-0.5.xx-with-your-patches grub-0.5.xx
>
> However, please make patches for the CVS version, if possible. This
> is safer because "cvs diff" doesn't reverse patches unless you specify
> some options explicitly.
>
> Thanks,
> Okuji
>
--
----------------------------------------------------------------------------
Neal Walfield [EMAIL PROTECTED]
UMass Lowell - Fox 1512 Phone: 978-934-5347
Fax: 603-415-3645
Love is the triumph of imagination over intelligence.
-- H. L. Mencken
Index: ChangeLog
===================================================================
RCS file: /cvs/grub/ChangeLog,v
retrieving revision 1.225
diff -u -r1.225 ChangeLog
--- ChangeLog 2000/04/29 16:30:13 1.225
+++ ChangeLog 2000/04/29 22:34:41
@@ -1,3 +1,17 @@
+2000-04-29 Neal H Walfield <[EMAIL PROTECTED]>
+
+ * stage2/builtins.c: Added the print_network_configuration_func
+ (`network') command to dump the current network configuration via
+ print_network_configuration ().
+ Added the tftpserver_func (`tftpserver') command to change the
+ tftpserver retrieved via dhcp, bootp or rarp.
+
+ * netboot/main.c: Added the function arp_server_override.
+ This function takes a string holding a network address and
+ replaces the current server with it (arptable[ARP_SERVER]).
+
+ * netboot/etherboot.h: Added the arp_server_override prototype.
+
2000-04-29 OKUJI Yoshinori <[EMAIL PROTECTED]>
* stage2/builtins.c (setup_func): Use SECTOR_BITS instead of
Index: netboot/etherboot.h
===================================================================
RCS file: /cvs/grub/netboot/etherboot.h,v
retrieving revision 1.4
diff -u -r1.4 etherboot.h
--- netboot/etherboot.h 2000/04/22 01:17:09 1.4
+++ netboot/etherboot.h 2000/04/29 22:34:41
@@ -457,6 +457,7 @@
/* main.c */
#ifdef GRUB
extern void print_network_configuration P((void));
+extern int arp_server_override P((char *buf));
#endif /* GRUB */
#ifndef GRUB
Index: netboot/main.c
===================================================================
RCS file: /cvs/grub/netboot/main.c,v
retrieving revision 1.6
diff -u -r1.6 main.c
--- netboot/main.c 2000/04/22 01:17:09 1.6
+++ netboot/main.c 2000/04/29 22:34:42
@@ -167,6 +167,115 @@
}
}
+int
+arp_server_override (char *buffer)
+{
+
+ int addr[4];
+
+ /* ip presentation to number */
+ static int inet_pton (char *input, int addr[4])
+ {
+ int i;
+ int octet;
+ char *str;
+ int invalid;
+ int have_digit;
+
+ /* The buffer should point to a valid ip address */
+ str = input;
+
+ /* Ignore white space */
+ while (*str == ' ')
+ str++;
+
+ invalid = 0;
+ octet = 0;
+ i = 0;
+ have_digit = 0;
+ for (;;)
+ {
+ /* Digit */
+ if (*str >= '0' && *str <= '9')
+ {
+ octet = octet * 10 + *str - '0';
+ have_digit = 1;
+ str ++;
+ continue;
+ }
+
+ /* Seperator */
+ if (*str == '.')
+ {
+ if (! have_digit)
+ {
+ invalid = 1;
+ break;
+ }
+ addr[i++] = octet;
+ octet = 0;
+ have_digit = 0;
+ str++;
+
+ if (i == 4)
+ break;
+ else
+ continue;
+ }
+
+ /* End of string? */
+ if (! *str)
+ {
+ if (have_digit)
+ addr[i++] = octet;
+ break;
+ }
+
+ invalid = 1;
+ break;
+ }
+
+ if (invalid)
+ return 1;
+
+ /* Eat any trailing white space */
+ while (*str == ' ')
+ str++;
+ /* Make sure we are at the end of the string */
+ if (*str != '\0')
+ return 1;
+
+ /* Is the address a nice a a.b.c.d? If not, convert */
+ if (i < 4)
+ {
+ int j;
+
+ octet = addr[i - 1];
+ for (j = 3; j >= i - 1; j--)
+ {
+ addr[j] = octet & 0xFF;
+ octet >>= 8;
+ }
+ }
+
+ /* Acceptable */
+ return 0;
+ }
+
+ if (inet_pton (buffer, addr) != 0)
+ {
+ grub_printf ("Invalid ip address.\n");
+ return 0;
+ }
+
+ grub_printf("tftpserver is: %d.%d.%d.%d\n", addr[0], addr[1], addr[2], addr[3]);
+
+ arptable[ARP_SERVER].ipaddr.s_addr = (addr[0]) + (addr[1] << 8)
+ + (addr[2] << 16) + (addr[3] << 24);
+
+ return 0;
+}
+
/**************************************************************************
DEFAULT_NETMASK - Return default netmask for IP address
**************************************************************************/
Index: stage2/builtins.c
===================================================================
RCS file: /cvs/grub/stage2/builtins.c,v
retrieving revision 1.59
diff -u -r1.59 builtins.c
--- stage2/builtins.c 2000/04/29 16:30:13 1.59
+++ stage2/builtins.c 2000/04/29 22:34:47
@@ -2273,6 +2273,29 @@
};
+static int
+print_network_configuration_func (char *arg, int flags)
+{
+#ifdef SUPPORT_NETBOOT
+ /* Notify the configuration. */
+ print_network_configuration ();
+ return 0;
+#else
+ errnum = ERR_UNRECOGNIZED;
+ return 1;
+#endif
+}
+
+static struct builtin builtin_network =
+{
+ "network",
+ print_network_configuration_func,
+ BUILTIN_CMDLINE,
+ "network",
+ "Print the current network configuration."
+};
+
+
/* Print the root device information. */
static void
print_root_device (void)
@@ -2944,6 +2967,39 @@
};
+/* tftpserver */
+static int
+tftpserver_func (char *arg, int flags)
+{
+#ifdef SUPPORT_NETBOOT
+ /* Check that a server was specified */
+ if (! *arg)
+ {
+ grub_printf ("Specify an ip address.\n");
+ return 1;
+ }
+
+ arp_server_override(arg);
+ return 0;
+
+#else
+ errnum = ERR_UNRECOGNIZED;
+ return 1;
+#endif
+}
+
+static struct builtin builtin_tftpserver =
+{
+ "tftpserver",
+ tftpserver_func,
+ BUILTIN_CMDLINE,
+ "tftpserver IPADDR",
+ "Override the tftp server retrieved from the dhcp, bootp or rarp server."
+ " This is useful when the server either assigns the wrong tftp server"
+ " or does not assign one."
+};
+
+
/* timeout */
static int
timeout_func (char *arg, int flags)
@@ -3067,6 +3123,7 @@
&builtin_map,
&builtin_module,
&builtin_modulenounzip,
+ &builtin_network,
&builtin_password,
&builtin_pause,
&builtin_quit,
@@ -3077,6 +3134,7 @@
&builtin_setkey,
&builtin_setup,
&builtin_testload,
+ &builtin_tftpserver,
&builtin_timeout,
&builtin_title,
&builtin_unhide,