mirror of https://github.com/ipxe/ipxe.git
Fix creation of the htype field; the ll_proto field from which it is
derived is a 16-bit big-endian field, but htype is only 8 bits wide.pull/1/head
parent
35b0233baa
commit
6c01d3bb95
|
@ -23,7 +23,9 @@ struct dhcp_packet {
|
||||||
uint8_t op;
|
uint8_t op;
|
||||||
/** Hardware address type
|
/** Hardware address type
|
||||||
*
|
*
|
||||||
* This is an ARPHRD_XXX constant.
|
* This is an ARPHRD_XXX constant. Note that ARPHRD_XXX
|
||||||
|
* constants are nominally 16 bits wide; this could be
|
||||||
|
* considered to be a bug in the BOOTP/DHCP specification.
|
||||||
*/
|
*/
|
||||||
uint8_t htype;
|
uint8_t htype;
|
||||||
/** Hardware address length */
|
/** Hardware address length */
|
||||||
|
@ -274,6 +276,14 @@ struct dhcp_option_block {
|
||||||
signed int priority;
|
signed int priority;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** A DHCP session */
|
||||||
|
struct dhcp_session {
|
||||||
|
/** Network device being configured */
|
||||||
|
struct net_device *netdev;
|
||||||
|
/** Transaction ID, in network-endian order */
|
||||||
|
uint32_t xid;
|
||||||
|
};
|
||||||
|
|
||||||
extern unsigned long dhcp_num_option ( struct dhcp_option *option );
|
extern unsigned long dhcp_num_option ( struct dhcp_option *option );
|
||||||
extern struct dhcp_option *
|
extern struct dhcp_option *
|
||||||
find_dhcp_option ( struct dhcp_option_block *options, unsigned int tag );
|
find_dhcp_option ( struct dhcp_option_block *options, unsigned int tag );
|
||||||
|
|
|
@ -29,11 +29,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct dhcp_session {
|
|
||||||
struct net_device *netdev;
|
|
||||||
uint32_t xid;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** DHCP operation types
|
/** DHCP operation types
|
||||||
*
|
*
|
||||||
* This table maps from DHCP message types (i.e. values of the @c
|
* This table maps from DHCP message types (i.e. values of the @c
|
||||||
|
@ -186,7 +181,7 @@ size_t dhcp_assemble ( struct dhcp_session *dhcp, void *data,
|
||||||
dhcppkt->op = dhcp_op[dhcp_message_type];
|
dhcppkt->op = dhcp_op[dhcp_message_type];
|
||||||
|
|
||||||
/* Fill in NIC details */
|
/* Fill in NIC details */
|
||||||
dhcppkt->htype = dhcp->netdev->ll_protocol->ll_proto;
|
dhcppkt->htype = ntohs ( dhcp->netdev->ll_protocol->ll_proto );
|
||||||
dhcppkt->hlen = dhcp->netdev->ll_protocol->ll_addr_len;
|
dhcppkt->hlen = dhcp->netdev->ll_protocol->ll_addr_len;
|
||||||
memcpy ( dhcppkt->chaddr, dhcp->netdev->ll_addr, dhcppkt->hlen );
|
memcpy ( dhcppkt->chaddr, dhcp->netdev->ll_addr, dhcppkt->hlen );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue