summaryrefslogtreecommitdiffstats
path: root/src/net/fakedhcp.c
diff options
context:
space:
mode:
authorMichael Brown2011-09-19 18:30:39 +0200
committerMichael Brown2011-09-19 18:35:42 +0200
commit12767d2202e620e32aef3fbdd2c4ad30c4e5ac22 (patch)
treeb10f28229de9af32f3b7302f0b63b5fd76c6f694 /src/net/fakedhcp.c
parent[util] Add romcheck.pl (diff)
downloadipxe-12767d2202e620e32aef3fbdd2c4ad30c4e5ac22.tar.gz
ipxe-12767d2202e620e32aef3fbdd2c4ad30c4e5ac22.tar.xz
ipxe-12767d2202e620e32aef3fbdd2c4ad30c4e5ac22.zip
[dhcp] Use a random DHCP transaction identifier (xid)
iPXE currently uses the last four bytes of the MAC address as the DHCP transaction identifier. Reduce the probability of collisions by generating a random transaction identifier. Originally-implemented-by: Amos Kong <akong@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/fakedhcp.c')
-rw-r--r--src/net/fakedhcp.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/net/fakedhcp.c b/src/net/fakedhcp.c
index b43e9b12..b182ab6f 100644
--- a/src/net/fakedhcp.c
+++ b/src/net/fakedhcp.c
@@ -114,7 +114,8 @@ int create_fakedhcpdiscover ( struct net_device *netdev,
int rc;
if ( ( rc = dhcp_create_request ( &dhcppkt, netdev, DHCPDISCOVER,
- ciaddr, data, max_len ) ) != 0 ) {
+ dhcp_last_xid, ciaddr, data,
+ max_len ) ) != 0 ) {
DBG ( "Could not create DHCPDISCOVER: %s\n",
strerror ( rc ) );
return rc;
@@ -139,7 +140,8 @@ int create_fakedhcpack ( struct net_device *netdev,
int rc;
/* Create base DHCPACK packet */
- if ( ( rc = dhcp_create_packet ( &dhcppkt, netdev, DHCPACK, NULL, 0,
+ if ( ( rc = dhcp_create_packet ( &dhcppkt, netdev, DHCPACK,
+ dhcp_last_xid, NULL, 0,
data, max_len ) ) != 0 ) {
DBG ( "Could not create DHCPACK: %s\n", strerror ( rc ) );
return rc;
@@ -190,7 +192,8 @@ int create_fakepxebsack ( struct net_device *netdev,
}
/* Create base DHCPACK packet */
- if ( ( rc = dhcp_create_packet ( &dhcppkt, netdev, DHCPACK, NULL, 0,
+ if ( ( rc = dhcp_create_packet ( &dhcppkt, netdev, DHCPACK,
+ dhcp_last_xid, NULL, 0,
data, max_len ) ) != 0 ) {
DBG ( "Could not create PXE BS ACK: %s\n",
strerror ( rc ) );