dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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