diff options
author | Michael Brown <mcb30@ipxe.org> | 2012-08-29 23:34:14 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2012-08-31 21:22:59 +0100 |
commit | 03f0c23f8b1a60575f788dd1b9d4ea47debf2345 (patch) | |
tree | 60b2312a0d56d6707a25aef4ce5bb4f6874359d6 /src/net/udp/dhcp.c | |
parent | f54a61e43450fae7d045bebabc4c368d325e71d3 (diff) | |
download | ipxe-03f0c23f8b1a60575f788dd1b9d4ea47debf2345.zip ipxe-03f0c23f8b1a60575f788dd1b9d4ea47debf2345.tar.gz ipxe-03f0c23f8b1a60575f788dd1b9d4ea47debf2345.tar.bz2 |
[ipoib] Expose Ethernet-compatible eIPoIB link-layer addresses and headers
Almost all clients of the raw-packet interfaces (UNDI and SNP) can
handle only Ethernet link layers. Expose an Ethernet-compatible link
layer to local clients, while remaining compatible with IPoIB on the
wire. This requires manipulation of ARP (but not DHCP) packets within
the IPoIB driver.
This is ugly, but it's the only viable way to allow IPoIB devices to
be driven via the raw-packet interfaces.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/udp/dhcp.c')
-rw-r--r-- | src/net/udp/dhcp.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/net/udp/dhcp.c b/src/net/udp/dhcp.c index a720616..e652503 100644 --- a/src/net/udp/dhcp.c +++ b/src/net/udp/dhcp.c @@ -938,10 +938,18 @@ int dhcp_create_packet ( struct dhcp_packet *dhcppkt, dhcphdr->magic = htonl ( DHCP_MAGIC_COOKIE ); dhcphdr->htype = ntohs ( netdev->ll_protocol->ll_proto ); dhcphdr->op = dhcp_op[msgtype]; - dhcphdr->hlen = dhcp_chaddr ( netdev, dhcphdr->chaddr, - &dhcphdr->flags ); + dhcphdr->hlen = netdev->ll_protocol->ll_addr_len; + memcpy ( dhcphdr->chaddr, netdev->ll_addr, + netdev->ll_protocol->ll_addr_len ); memcpy ( dhcphdr->options, options, options_len ); + /* If the local link-layer address functions only as a name + * (i.e. cannot be used as a destination address), then + * request broadcast responses. + */ + if ( netdev->ll_protocol->flags & LL_NAME_ONLY ) + dhcphdr->flags |= htons ( BOOTP_FL_BROADCAST ); + /* If the network device already has an IPv4 address then * unicast responses from the DHCP server may be rejected, so * request broadcast responses. |