DHCPv6 renew message

Uwe Glaeser uwe.glaeser at dormakaba.com
Fri Jul 31 06:48:28 UTC 2020


Hi,

Subject: DHCPv6 renew  in /networking/udhcp/d6_dhcpc.c

as stated in the RFC3315-comment of the function send_d6_renew()  the message type should be set to D6_MSG_RENEW and not DHCPREQUEST (which is an IPv4 value).
Or is there a reason for the DHCPREQUEST ?


/* Unicast or broadcast a DHCP renew message
*
* RFC 3315 18.1.3. Creation and Transmission of Renew Messages
*
* To extend the valid and preferred lifetimes for the addresses
* associated with an IA, the client sends a Renew message to the server
* from which the client obtained the addresses in the IA containing an
* IA option for the IA.  The client includes IA Address options in the
* IA option for the addresses associated with the IA.  The server
* determines new lifetimes for the addresses in the IA according to the
* administrative configuration of the server.  The server may also add
* new addresses to the IA.  The server may remove addresses from the IA
* by setting the preferred and valid lifetimes of those addresses to
* zero.
*
* The server controls the time at which the client contacts the server
* to extend the lifetimes on assigned addresses through the T1 and T2
* parameters assigned to an IA.
*
* At time T1 for an IA, the client initiates a Renew/Reply message
* exchange to extend the lifetimes on any addresses in the IA.  The
* client includes an IA option with all addresses currently assigned to
* the IA in its Renew message.
*
* If T1 or T2 is set to 0 by the server (for an IA_NA) or there are no
* T1 or T2 times (for an IA_TA), the client may send a Renew or Rebind
* message, respectively, at the client's discretion.
*
* The client sets the "msg-type" field to RENEW.  The client generates
* a transaction ID and inserts this value in the "transaction-id"
* field.
*
* The client places the identifier of the destination server in a
* Server Identifier option.
*
* The client MUST include a Client Identifier option to identify itself
* to the server.  The client adds any appropriate options, including
* one or more IA options.  The client MUST include the list of
* addresses the client currently has associated with the IAs in the
* Renew message.
*
* The client MUST include an Option Request option (see section 22.7)
* to indicate the options the client is interested in receiving.  The
* client MAY include options with data values as hints to the server
* about parameter values the client would like to have returned.
*/
/* NOINLINE: limit stack usage in caller */
static NOINLINE int send_d6_renew(uint32_t xid, struct in6_addr *server_ipv6, struct in6_addr *our_cur_ipv6)
{
                struct d6_packet packet;
                uint8_t *opt_ptr;

                /* Fill in: msg type, client id */
                opt_ptr = init_d6_packet(&packet, DHCPREQUEST, xid);

                /* server id */
                opt_ptr = mempcpy(opt_ptr, client6_data.server_id, client6_data.server_id->len + 2+2);
                /* IA NA (contains requested IP) */
                if (client6_data.ia_na)
                               opt_ptr = mempcpy(opt_ptr, client6_data.ia_na, client6_data.ia_na->len + 2+2);
                /* IA PD */
                if (client6_data.ia_pd)
                               opt_ptr = mempcpy(opt_ptr, client6_data.ia_pd, client6_data.ia_pd->len + 2+2);

                /* Add options:
                * "param req" option according to -O, options specified with -x
                */
                opt_ptr = add_d6_client_options(opt_ptr);

                bb_info_msg("sending %s", "renew");
                if (server_ipv6)
                               return d6_send_kernel_packet(
                                               &packet, (opt_ptr - (uint8_t*) &packet),
                                               our_cur_ipv6, CLIENT_PORT6,
                                               server_ipv6, SERVER_PORT6,
                                               client_data.ifindex
                               );
                return d6_mcast_from_client_data_ifindex(&packet, opt_ptr);
}


Best regards

Uwe Glaeser
dormakaba EAD GmbH
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20200731/8fb54c6a/attachment.html>


More information about the busybox mailing list