busybox/networking/udhcp
Denys Vlasenko e67b80f473 udhcpc6: fix udhcp_find_option to actually find DHCP6 options
udhcp_insert_new_option treats code for IPv6 as follows:

new->data[D6_OPT_CODE] = code >> 8;
new->data[D6_OPT_CODE + 1] = code & 0xff;

udhcp_find_option tests the code as follows:

while (opt_list && opt_list->data[OPT_CODE] < code)
...
if (opt_list && opt_list->data[OPT_CODE] == code)

So yes, OPT_CODE and D6_OPT_CODE are both 0, but the D6_OPT_CLIENTID =
1 value means that the 1 is in the seconds byte, and udhcp_find_option
is only looking at the first byte,  So the send_d6_release can never
find it the created option.

function                                             old     new   delta
udhcp_find_option                                     28      53     +25
attach_option                                        276     284      +8
udhcpc6_main                                        2602    2607      +5
perform_d6_release                                   262     267      +5
udhcpd_main                                         1518    1520      +2
udhcpc_main                                         2542    2544      +2
add_serverid_and_clientid_options                     46      48      +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 7/0 up/down: 49/0)               Total: 49 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-12-12 17:13:54 +01:00
..
arpping.c udhcp: shrink arpping() 2021-06-03 11:32:40 +02:00
common.c udhcpc6: fix udhcp_find_option to actually find DHCP6 options 2021-12-12 17:13:54 +01:00
common.h udhcpc6: fix udhcp_find_option to actually find DHCP6 options 2021-12-12 17:13:54 +01:00
Config.src udhcpc: Add support to change default interface name 2021-01-01 19:08:28 +01:00
d6_common.h udhcpc6: code shrink - sending functions do not need ifindex parameter 2020-12-15 21:55:15 +01:00
d6_dhcpc.c udhcpc6: fix udhcp_find_option to actually find DHCP6 options 2021-12-12 17:13:54 +01:00
d6_packet.c udhcpc: improve logs - show offer as it is received 2021-06-02 19:51:52 +02:00
d6_socket.c libbb: reduce the overhead of single parameter bb_error_msg() calls 2019-07-02 11:35:03 +02:00
dhcpc.c udhcpc6: fix udhcp_find_option to actually find DHCP6 options 2021-12-12 17:13:54 +01:00
dhcpc.h udhcpc[6]: do not pass xid around, keep it in client_data.xid 2021-06-15 01:06:42 +02:00
dhcpd.c udhcpc6: fix udhcp_find_option to actually find DHCP6 options 2021-12-12 17:13:54 +01:00
dhcpd.h udhcp: rename server_config to server_data 2019-05-30 16:23:34 +02:00
dhcprelay.c dhcprelay: change two more variables to unsigned 2021-09-02 17:09:12 +02:00
domain_codec.c domain_codec: optimize dname_dec and convert_dname 2020-07-12 21:19:13 +02:00
dumpleases.c libbb: introduce and use fputs_stdout 2021-02-03 20:52:40 +01:00
Kbuild.src
packet.c udhcpc: improve logs - show offer as it is received 2021-06-02 19:51:52 +02:00
signalpipe.c fix gcc-11.0 warnings 2021-04-14 17:52:18 +02:00
socket.c udhcpc[6]: remove superfluous "created raw socket" log message 2021-06-02 20:23:43 +02:00