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

6b3c76
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
6b3c76
Subject: [PATCH 245/261] 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
---
d41074
 docs/grub.texi        | 6 ++++--
6b3c76
 grub-core/net/bootp.c | 7 +++++++
a85e8e
 2 files changed, 11 insertions(+), 2 deletions(-)
a85e8e
6b3c76
diff --git a/docs/grub.texi b/docs/grub.texi
6b3c76
index ef09c8324..98138e04d 100644
6b3c76
--- a/docs/grub.texi
6b3c76
+++ b/docs/grub.texi
6b3c76
@@ -5211,8 +5211,10 @@ by @var{shortname} which can be used to remove it (@pxref{net_del_route}).
6b3c76
 Perform configuration of @var{card} using DHCP protocol. If no card name
6b3c76
 is specified, try to configure all existing cards. If configuration was
6b3c76
 successful, interface with name @var{card}@samp{:dhcp} and configured
6b3c76
-address is added to @var{card}. If server provided gateway information in
6b3c76
-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:
6b3c76
+address is added to @var{card}.
6b3c76
+@comment If server provided gateway information in
6b3c76
+@comment DHCP ACK packet, it is added as route entry with the name @var{card}@samp{:dhcp:gw}.
6b3c76
+Additionally the following DHCP options are recognized and processed:
6b3c76
 
6b3c76
 @table @samp
6b3c76
 @item 1 (Subnet Mask)
a85e8e
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
6b3c76
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,
6b3c76
-- 
6b3c76
2.13.5
6b3c76