summaryrefslogtreecommitdiffstats
path: root/src/vnet/dhcp/dhcp_api.c
diff options
context:
space:
mode:
authorjackiechen1985 <xiaobo.chen@tieto.com>2019-04-29 12:00:43 +0800
committerDave Barach <openvpp@barachs.net>2019-05-06 12:03:24 +0000
commit56bc738dc371f6d5384f5772087899bdac42fc17 (patch)
treecbd8e4a0fc449a795f73f9667139a021962e93ec /src/vnet/dhcp/dhcp_api.c
parentfa0c1f4dfc91726140d868d9077bfb3e25c1f1fe (diff)
Fix VPP-1487 DHCP client does not support option 6-domain server
Change-Id: I36ad1ef2a53af3d3f3a6348bc189b17e9e4e21bd Signed-off-by: jackiechen1985 <xiaobo.chen@tieto.com>
Diffstat (limited to 'src/vnet/dhcp/dhcp_api.c')
-rw-r--r--src/vnet/dhcp/dhcp_api.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/vnet/dhcp/dhcp_api.c b/src/vnet/dhcp/dhcp_api.c
index c96c3e1e085..d71ffe93c2d 100644
--- a/src/vnet/dhcp/dhcp_api.c
+++ b/src/vnet/dhcp/dhcp_api.c
@@ -218,6 +218,7 @@ dhcp_client_lease_encode (vl_api_dhcp_lease_t * lease,
const dhcp_client_t * client)
{
size_t len;
+ u8 i;
lease->is_ipv6 = 0; // only support IPv6 clients
lease->sw_if_index = ntohl (client->sw_if_index);
@@ -227,8 +228,16 @@ dhcp_client_lease_encode (vl_api_dhcp_lease_t * lease,
lease->hostname[len] = 0;
lease->mask_width = client->subnet_mask_width;
- clib_memcpy (&lease->host_address[0], (u8 *) & client->leased_address, 4);
- clib_memcpy (&lease->router_address[0], (u8 *) & client->router_address, 4);
+ clib_memcpy (&lease->host_address[0], (u8 *) & client->leased_address,
+ sizeof (ip4_address_t));
+ clib_memcpy (&lease->router_address[0], (u8 *) & client->router_address,
+ sizeof (ip4_address_t));
+
+ lease->count = vec_len (client->domain_server_address);
+ for (i = 0; i < lease->count; i++)
+ clib_memcpy (&lease->domain_server[i].address,
+ (u8 *) & client->domain_server_address[i],
+ sizeof (ip4_address_t));
if (NULL != client->l2_rewrite)
clib_memcpy (&lease->host_mac[0], client->l2_rewrite + 6, 6);