mirror of
https://github.com/ipxe/ipxe
synced 2025-12-29 02:52:36 +03:00
[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>
This commit is contained in:
@@ -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 ) );
|
||||
|
||||
Reference in New Issue
Block a user