cancel
Showing results for 
Search instead for 
Did you mean: 

BUG AZRTOS NetXDuo v6.4 netx-duo-dhcpv6-client function nx_dhcpv6_request_solicit()

mbarg.1
Senior

 

According to manual below, function should SEND out a SOLICIT message.

Function returns NX_SUCCESS (0x00) means SOLICIT message successfully sent.

 

Actually code, after some checks, just set nx_dhcpv6_state variable in DHCPv6 to NX_DHCPV6_STATE_SENDING_SOLICIT value and returns ALWAYS NX_SUCCESS, regardless of what DHCPv6 thread will do.

 

Therefore we will get NX_SUCCESS before actual sending the SOLICIT packet and even if this packet is not sent at all by DHCPv6 thread for any reason, e.g. no packets available in packet pool.

 

Also very critical, there is no high level function that user can use yo check for status end errors in DHCPv6 thread, no way to implement correctives actions unless to access global variables and void any quality certification.

 

nx_dhcpv6_request_solicit

Send a SOLICIT message

Prototype

UINT nx_dhcpv6_request_solicit(NX_DHCPV6 *dhcpv6_ptr);

Description

This service sends a SOLICIT message out on the network. If the message is successfully sent, a successful status is returned. A successful completion does not mean the Client received a response or has been granted an IPv6 address yet. The DHCPv6 Client thread task waits for a reply (an ADVERTISE message) from a DHCPv6 Server. If one is received, it checks the reply is valid, stores the data to the Client record and promotes the Client to the REQUEST state.

Note: If the Rapid Commit option is set, the DHCPv6 Client will go directly to the Bound state if it receives a valid Server ADVERTISE message. See the service description for nx_dhcpv6_request_solicit_rapid for more details.

Input Parameters

  • dhcpv6_ptr: Pointer to DHCPv6 Client instance

Return Values

  • NX_SUCCESS (0x00) SOLICIT message successfully sent

  • NX_PTR_ERROR (0x16) Invalid pointer input

  • NX_CALLER_ERROR (0x11) Must be called from thread

Allowed From

Threads

3 REPLIES 3
STea
ST Employee

Hello @mbarg.1 ,

what tests you did that confirm this statement :
"Therefore, we will get NX_SUCCESS before actual sending the SOLICIT packet and even if this packet is not sent at all by DHCPv6 thread for any reason, e.g. no packets available in packet pool."
did you see status return set to success without any request sent?
also, I think that a correct calling flow will ensure that DHCP start is executed correctly before calling the solicit function.

see the example netxduo/samples/demo_netxduo_dhcpv6_client.c at master · eclipse-threadx/netxduo · GitHub
for more details.
Regards

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

I can confirm that I discovered this bug because I did THIS mistake in my code:

did not initialize packet pool.

Now, DHCPv6_create() and DHCPv6_start executed with  nx_dhcpv6_request_solicit, as well as nx_dhcpv6_request_solicit(), but no packet were sent out from interface.

To double check bug, I initialized correctly the packet pool, used all packets in the pool for other functions, than call nx_dhcpv6_request_solicit() and again I got nx_dhcpv6_request_solicit but no packet were sent out of interface and no error was reported anywhere.

The problem come from _nx_dhcpv6_process() function that does not return errors and ignores errors in called functions.

In case NX_DHCPV6_STATE_SENDING_SOLICIT:

@line 3830:

/* The caller has requested to send a solicit message. */

case NX_DHCPV6_STATE_SENDING_SOLICIT:

{

dhcpv6_ptr -> nx_dhcpv6_message_hdr.nx_message_type = NX_DHCPV6_MESSAGE_TYPE_SOLICIT;

dhcpv6_ptr -> nx_dhcpv6_solicitations_sent++;

/* Send the DHCPV6 Solicit message. */

status = _nx_dhcpv6_send_request(dhcpv6_ptr);

/* Check for error. */

if (status != NX_SUCCESS)

{

/* Return. Can't do any more now. */

return;

}

..........

 

Obviously thread tries again and again but if empty or invalid pool condition is not cleared, packet are not sent; on other side, application cannot be informed that we have a proble and we are stuck in infinite loop.