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

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