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