Blob Blame History Raw
From: Chris Leech <cleech@redhat.com>
Subject: iscsiuio: fix dhcpv6 transaction-id mismatch error

Bugzilla: ZZZ
Upstream Status:
Build Info: XXX
Tested:

commit 5fd6428435f3063b4e980ead1fe0671856a20183
Author: Nilesh Javali <nilesh.javali@cavium.com>
Date:   Thu Feb 16 08:44:19 2017 -0500

    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>
---
 iscsiuio/src/apps/dhcpc/dhcpv6.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/iscsiuio/src/apps/dhcpc/dhcpv6.c b/iscsiuio/src/apps/dhcpc/dhcpv6.c
index a4e25f0bdbbd..461af0ec2a11 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);