From 12767d2202e620e32aef3fbdd2c4ad30c4e5ac22 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Mon, 19 Sep 2011 17:30:39 +0100 Subject: [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 Signed-off-by: Michael Brown --- src/include/ipxe/dhcp.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/include') diff --git a/src/include/ipxe/dhcp.h b/src/include/ipxe/dhcp.h index dbca8e633..06fb33bc0 100644 --- a/src/include/ipxe/dhcp.h +++ b/src/include/ipxe/dhcp.h @@ -660,15 +660,18 @@ struct dhcphdr { /** Setting block name used for BootServerDHCP responses */ #define PXEBS_SETTINGS_NAME "pxebs" +extern uint32_t dhcp_last_xid; extern unsigned int dhcp_chaddr ( struct net_device *netdev, void *chaddr, uint16_t *flags ); extern int dhcp_create_packet ( struct dhcp_packet *dhcppkt, struct net_device *netdev, uint8_t msgtype, - const void *options, size_t options_len, - void *data, size_t max_len ); + uint32_t xid, const void *options, + size_t options_len, void *data, + size_t max_len ); extern int dhcp_create_request ( struct dhcp_packet *dhcppkt, struct net_device *netdev, - unsigned int msgtype, struct in_addr ciaddr, + unsigned int msgtype, uint32_t xid, + struct in_addr ciaddr, void *data, size_t max_len ); extern int start_dhcp ( struct interface *job, struct net_device *netdev ); extern int start_pxebs ( struct interface *job, struct net_device *netdev, -- cgit v1.2.3-55-g7522