diff options
author | Dan Williams <dcbw@redhat.com> | 2014-10-08 14:15:45 -0500 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-10-11 12:15:54 +0200 |
commit | 76253e73f9c9c24fec755e485516f3b55d0707b4 (patch) | |
tree | ae99dc09b50a8d8de2428dbc6e6b57f51ef6776c /src/libsystemd-network/dhcp-packet.c | |
parent | 5482192e5774f52f2af0665a3b58539295e9c0a4 (diff) |
sd-dhcp-client: support non-Ethernet hardware addresses
Like Infiniband. See RFC 4390 section 2.1 for details on DHCP
and Infiniband; chaddr is zeroed, hlen is set to 0, and htype
is set to ARPHRD_INFINIBAND because IB hardware addresses
are 20 bytes in length.
Diffstat (limited to 'src/libsystemd-network/dhcp-packet.c')
-rw-r--r-- | src/libsystemd-network/dhcp-packet.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libsystemd-network/dhcp-packet.c b/src/libsystemd-network/dhcp-packet.c index 9f850fdebb..7581daeeeb 100644 --- a/src/libsystemd-network/dhcp-packet.c +++ b/src/libsystemd-network/dhcp-packet.c @@ -38,15 +38,17 @@ #define DHCP_CLIENT_MIN_OPTIONS_SIZE 312 int dhcp_message_init(DHCPMessage *message, uint8_t op, uint32_t xid, - uint8_t type, size_t optlen, size_t *optoffset) { + uint8_t type, uint16_t arp_type, size_t optlen, + size_t *optoffset) { size_t offset = 0; int r; assert(op == BOOTREQUEST || op == BOOTREPLY); + assert(arp_type == ARPHRD_ETHER || arp_type == ARPHRD_INFINIBAND); message->op = op; - message->htype = ARPHRD_ETHER; - message->hlen = ETHER_ADDR_LEN; + message->htype = arp_type; + message->hlen = (arp_type == ARPHRD_ETHER) ? ETHER_ADDR_LEN : 0; message->xid = htobe32(xid); message->magic = htobe32(DHCP_MAGIC_COOKIE); |