Blame SOURCES/0245-bootp-ignore-gateway_ip-relay-field.patch

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