summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/test-dhcp-client.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2014-10-08 14:15:45 -0500
committerTom Gundersen <teg@jklm.no>2014-10-11 12:15:54 +0200
commit76253e73f9c9c24fec755e485516f3b55d0707b4 (patch)
treeae99dc09b50a8d8de2428dbc6e6b57f51ef6776c /src/libsystemd-network/test-dhcp-client.c
parent5482192e5774f52f2af0665a3b58539295e9c0a4 (diff)
downloadsystemd-76253e73f9c9c24fec755e485516f3b55d0707b4.tar.gz
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/test-dhcp-client.c')
-rw-r--r--src/libsystemd-network/test-dhcp-client.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/libsystemd-network/test-dhcp-client.c b/src/libsystemd-network/test-dhcp-client.c
index c48aa04b8d..7dab97de2f 100644
--- a/src/libsystemd-network/test-dhcp-client.c
+++ b/src/libsystemd-network/test-dhcp-client.c
@@ -196,7 +196,9 @@ int dhcp_network_send_raw_socket(int s, const union sockaddr_union *link,
return 575;
}
-int dhcp_network_bind_raw_socket(int index, union sockaddr_union *link, uint32_t id, struct ether_addr mac)
+int dhcp_network_bind_raw_socket(int index, union sockaddr_union *link,
+ uint32_t id, const uint8_t *addr,
+ size_t addr_len, uint16_t arp_type)
{
if (socketpair(AF_UNIX, SOCK_STREAM, 0, test_fd) < 0)
return -errno;
@@ -244,7 +246,10 @@ static void test_discover_message(sd_event *e)
assert_se(r >= 0);
assert_se(sd_dhcp_client_set_index(client, 42) >= 0);
- assert_se(sd_dhcp_client_set_mac(client, &mac_addr) >= 0);
+ assert_se(sd_dhcp_client_set_mac(client,
+ (const uint8_t *) &mac_addr,
+ sizeof (mac_addr),
+ ARPHRD_ETHER) >= 0);
assert_se(sd_dhcp_client_set_request_option(client, 248) >= 0);
@@ -462,7 +467,10 @@ static void test_addr_acq(sd_event *e) {
assert_se(r >= 0);
assert_se(sd_dhcp_client_set_index(client, 42) >= 0);
- assert_se(sd_dhcp_client_set_mac(client, &mac_addr) >= 0);
+ assert_se(sd_dhcp_client_set_mac(client,
+ (const uint8_t *) &mac_addr,
+ sizeof (mac_addr),
+ ARPHRD_ETHER) >= 0);
assert_se(sd_dhcp_client_set_callback(client, test_addr_acq_acquired, e)
>= 0);