|
|
27a4da |
From 0d757a7fa6596dc307bd98cda2121329f121c5ce Mon Sep 17 00:00:00 2001
|
|
|
27a4da |
From: Andrzej Kacprowski <andrzej.kacprowski@intel.com>
|
|
|
27a4da |
Date: Fri, 21 Apr 2017 09:20:38 +0200
|
|
|
27a4da |
Subject: [PATCH 247/260] Use xid to match DHCP replies
|
|
|
27a4da |
|
|
|
27a4da |
Transaction identifier (xid) from DHCP request
|
|
|
27a4da |
packet is stored in network level interface and used
|
|
|
27a4da |
to match request with the responses it generates.
|
|
|
27a4da |
|
|
|
27a4da |
Resolves: rhbz#1370642
|
|
|
27a4da |
|
|
|
27a4da |
Signed-off-by: Andrzej Kacprowski <andrzej.kacprowski@intel.com>
|
|
|
27a4da |
---
|
|
|
27a4da |
grub-core/net/bootp.c | 3 ++-
|
|
|
27a4da |
grub-core/net/ip.c | 1 +
|
|
|
27a4da |
include/grub/net.h | 3 ++-
|
|
|
27a4da |
3 files changed, 5 insertions(+), 2 deletions(-)
|
|
|
27a4da |
|
|
|
27a4da |
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
|
|
|
27a4da |
index 7df7f5511..dfdf7e08d 100644
|
|
|
27a4da |
--- a/grub-core/net/bootp.c
|
|
|
27a4da |
+++ b/grub-core/net/bootp.c
|
|
|
27a4da |
@@ -769,7 +769,8 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)),
|
|
|
27a4da |
grub_errno = GRUB_ERR_NONE;
|
|
|
27a4da |
t = 0;
|
|
|
27a4da |
}
|
|
|
27a4da |
- pack->ident = grub_cpu_to_be32 (t);
|
|
|
27a4da |
+ pack->xid = grub_cpu_to_be32 (t);
|
|
|
27a4da |
+ ifaces[j].dhcp_xid = pack->xid;
|
|
|
27a4da |
pack->seconds = grub_cpu_to_be16 (t);
|
|
|
27a4da |
|
|
|
27a4da |
grub_memcpy (&pack->mac_addr, &ifaces[j].hwaddress.mac, 6);
|
|
|
27a4da |
diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c
|
|
|
27a4da |
index 5a6095444..9e7930caa 100644
|
|
|
27a4da |
--- a/grub-core/net/ip.c
|
|
|
27a4da |
+++ b/grub-core/net/ip.c
|
|
|
27a4da |
@@ -271,6 +271,7 @@ handle_dgram (struct grub_net_buff *nb,
|
|
|
27a4da |
FOR_NET_NETWORK_LEVEL_INTERFACES (inf)
|
|
|
27a4da |
if (inf->card == card
|
|
|
27a4da |
&& inf->address.type == GRUB_NET_NETWORK_LEVEL_PROTOCOL_DHCP_RECV
|
|
|
27a4da |
+ && inf->dhcp_xid == bootp->xid
|
|
|
27a4da |
&& inf->hwaddress.type == GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET
|
|
|
27a4da |
&& grub_memcmp (inf->hwaddress.mac, &bootp->mac_addr,
|
|
|
27a4da |
sizeof (inf->hwaddress.mac)) == 0)
|
|
|
27a4da |
diff --git a/include/grub/net.h b/include/grub/net.h
|
|
|
27a4da |
index bd930f4dd..b1bc23048 100644
|
|
|
27a4da |
--- a/include/grub/net.h
|
|
|
27a4da |
+++ b/include/grub/net.h
|
|
|
27a4da |
@@ -279,6 +279,7 @@ struct grub_net_network_level_interface
|
|
|
27a4da |
grub_net_interface_flags_t flags;
|
|
|
27a4da |
struct grub_net_bootp_packet *dhcp_ack;
|
|
|
27a4da |
grub_size_t dhcp_acklen;
|
|
|
27a4da |
+ grub_uint32_t dhcp_xid;
|
|
|
27a4da |
void *data;
|
|
|
27a4da |
};
|
|
|
27a4da |
|
|
|
27a4da |
@@ -405,7 +406,7 @@ struct grub_net_bootp_packet
|
|
|
27a4da |
grub_uint8_t hw_type; /* hardware type. */
|
|
|
27a4da |
grub_uint8_t hw_len; /* hardware addr len. */
|
|
|
27a4da |
grub_uint8_t gate_hops; /* zero it. */
|
|
|
27a4da |
- grub_uint32_t ident; /* random number chosen by client. */
|
|
|
27a4da |
+ grub_uint32_t xid; /* transaction id chosen by client. */
|
|
|
27a4da |
grub_uint16_t seconds; /* seconds since did initial bootstrap. */
|
|
|
27a4da |
grub_uint16_t flags;
|
|
|
27a4da |
grub_uint32_t client_ip;
|
|
|
27a4da |
--
|
|
|
27a4da |
2.13.0
|
|
|
27a4da |
|