diff options
author | Nilesh Javali <nilesh.javali@cavium.com> | 2017-02-16 08:44:19 -0500 |
---|---|---|
committer | Nilesh Javali <nilesh.javali@cavium.com> | 2017-05-15 05:22:51 -0400 |
commit | 5fd6428435f3063b4e980ead1fe0671856a20183 (patch) | |
tree | 08cd991a71f2a95259845fb463c52a0ff14adb2b | |
parent | 54f914c66bbfc436bc4cd426d664d6b4864492d6 (diff) | |
download | open-iscsi-5fd6428435f3063b4e980ead1fe0671856a20183.tar.gz |
iscsiuio: fix dhcpv6 transaction-id mismatch error
Initialize the transaction-id within the dhcpv6 packet with
correct byte order.
Signed-off-by: Nilesh Javali <nilesh.javali@cavium.com>
-rw-r--r-- | iscsiuio/src/apps/dhcpc/dhcpv6.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/iscsiuio/src/apps/dhcpc/dhcpv6.c b/iscsiuio/src/apps/dhcpc/dhcpv6.c index a4e25f0..461af0e 100644 --- a/iscsiuio/src/apps/dhcpc/dhcpv6.c +++ b/iscsiuio/src/apps/dhcpc/dhcpv6.c @@ -153,7 +153,7 @@ static u16_t dhcpv6_init_packet(struct dhcpv6_context *context, u8_t type) if (dhcpv6->dhcpv6_type != type) context->dhcpv6_transaction_id++; - dhcpv6->dhcpv6_trans_id = context->dhcpv6_transaction_id; + dhcpv6->dhcpv6_trans_id = HOST_TO_NET16(context->dhcpv6_transaction_id); dhcpv6->dhcpv6_type = type; /* Keep track of length of all DHCP options. */ @@ -265,8 +265,13 @@ void ipv6_udp_handle_dhcp(struct dhcpv6_context *context) dhcpv6 = (union dhcpv6_hdr *)((u8_t *)context->udp + sizeof(struct udp_hdr)); - if (dhcpv6->dhcpv6_trans_id != context->dhcpv6_transaction_id) + if (dhcpv6->dhcpv6_trans_id != + HOST_TO_NET16(context->dhcpv6_transaction_id)) { + LOG_ERR("DHCPv6 transaction-id error, sent %x, received %x", + HOST_TO_NET16(context->dhcpv6_transaction_id), + dhcpv6->dhcpv6_trans_id); return; + } dhcpv6_len = NET_TO_HOST16(context->udp->length) - sizeof(struct udp_hdr); |