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

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