nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone
f725e3
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
f725e3
From: Andrei Borzenkov <arvidjaar@gmail.com>
f725e3
Date: Sun, 17 May 2015 22:38:30 +0300
f725e3
Subject: [PATCH] bootp: ignore gateway_ip (relay) field.
f725e3
f725e3
From RFC1542:
f725e3
f725e3
   The 'giaddr' field is rather poorly named.  It exists to facilitate
f725e3
   the transfer of BOOTREQUEST messages from a client, through BOOTP
f725e3
   relay agents, to servers on different networks than the client.
f725e3
   Similarly, it facilitates the delivery of BOOTREPLY messages from the
f725e3
   servers, through BOOTP relay agents, back to the client.  In no case
f725e3
   does it represent a general IP router to be used by the client.  A
f725e3
   BOOTP client MUST set the 'giaddr' field to zero (0.0.0.0) in all
f725e3
   BOOTREQUEST messages it generates.
f725e3
f725e3
   A BOOTP client MUST NOT interpret the 'giaddr' field of a BOOTREPLY
f725e3
   message to be the IP address of an IP router.  A BOOTP client SHOULD
f725e3
   completely ignore the contents of the 'giaddr' field in BOOTREPLY
f725e3
   messages.
f725e3
f725e3
Leave code ifdef'd out for the time being in case we see regression.
f725e3
f725e3
Suggested by: Rink Springer <rink@rink.nu>
f725e3
Closes: 43396
f725e3
---
f725e3
 grub-core/net/bootp.c | 7 +++++++
f725e3
 docs/grub.texi        | 6 ++++--
f725e3
 2 files changed, 11 insertions(+), 2 deletions(-)
f725e3
f725e3
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
f725e3
index b4b8159cdad..62d602d9645 100644
f725e3
--- a/grub-core/net/bootp.c
f725e3
+++ b/grub-core/net/bootp.c
f725e3
@@ -237,6 +237,12 @@ grub_net_configure_by_dhcp_ack (const char *name,
f725e3
   hwaddr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
f725e3
 
f725e3
   inter = grub_net_add_addr (name, card, &addr, &hwaddr, flags);
f725e3
+#if 0
f725e3
+  /* This is likely based on misunderstanding. gateway_ip refers to
f725e3
+     address of BOOTP relay and should not be used after BOOTP transaction
f725e3
+     is complete.
f725e3
+     See RFC1542, 3.4 Interpretation of the 'giaddr' field
f725e3
+   */
f725e3
   if (bp->gateway_ip)
f725e3
     {
f725e3
       grub_net_network_level_netaddress_t target;
f725e3
@@ -258,6 +264,7 @@ grub_net_configure_by_dhcp_ack (const char *name,
f725e3
       target.ipv4.masksize = 32;
f725e3
       grub_net_add_route (name, target, inter);
f725e3
     }
f725e3
+#endif
f725e3
 
f725e3
   if (size > OFFSET_OF (boot_file, bp))
f725e3
     grub_env_set_net_property (name, "boot_file", bp->boot_file,
f725e3
diff --git a/docs/grub.texi b/docs/grub.texi
f725e3
index ef09c832482..98138e04d5b 100644
f725e3
--- a/docs/grub.texi
f725e3
+++ b/docs/grub.texi
f725e3
@@ -5211,8 +5211,10 @@ by @var{shortname} which can be used to remove it (@pxref{net_del_route}).
f725e3
 Perform configuration of @var{card} using DHCP protocol. If no card name
f725e3
 is specified, try to configure all existing cards. If configuration was
f725e3
 successful, interface with name @var{card}@samp{:dhcp} and configured
f725e3
-address is added to @var{card}. If server provided gateway information in
f725e3
-DHCP ACK packet, it is added as route entry with the name @var{card}@samp{:dhcp:gw}. Additionally the following DHCP options are recognized and processed:
f725e3
+address is added to @var{card}.
f725e3
+@comment If server provided gateway information in
f725e3
+@comment DHCP ACK packet, it is added as route entry with the name @var{card}@samp{:dhcp:gw}.
f725e3
+Additionally the following DHCP options are recognized and processed:
f725e3
 
f725e3
 @table @samp
f725e3
 @item 1 (Subnet Mask)