eclipse-threadx / netxduo

Eclipse ThreadX - NetXDuo is an advanced, industrial-grade TCP/IP network stack designed specifically for deeply embedded real-time and IoT applications
https://github.com/eclipse-threadx/rtos-docs/blob/main/rtos-docs/netx-duo/index.md
MIT License
230 stars 131 forks source link

DHCPv6 Server instance sends IPv6 response packets on incorrect index when DHCPv6 Client and DHCPv6 Server are brought up simultaneously #262

Open matheeb opened 3 months ago

matheeb commented 3 months ago

DHCPv6 Server Bug When DHCPv6 Client and DHCPv6 Server are brought up simultaneously. When a 3rd party client connects to DHCPv6 Server doesn't get IPv6 address.

When DHCPv6 Server is started after the DHCPv6 Client, The connected clients to the DHCPv6 Server are not getting an IPv6 address. The issue is in IPv6 path of the DHCPv6 Server response path. Upon receiving the SOLICIT from 3rd party client our DHCPv6 Server tries to send the ADVERTISE packet to the client. The function used to send this response from DHCPv6 Server expects an nx_ipv6_address[] index but we are passing nx_ip_interface[] index which is incorrect.

below is the piece of code that is causing this functional issue :

/* Send the response packet to the client.  */    
status = nxd_udp_socket_interface_send(&(dhcpv6_server_ptr -> nx_dhcpv6_server_socket), packet_ptr, 
                                       &dhcpv6_client_ptr -> nx_dhcp_source_ip_address, NX_DHCPV6_CLIENT_UDP_PORT, 
                                       dhcpv6_server_ptr -> nx_dhcpv6_server_interface_index);

You can find the same snippet in netxduo/addons/dhcp/nxd_dhcpv6_server.c : 5437