diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2022-12-14 00:36:59 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2022-12-14 00:36:59 +0100 |
commit | e977853e70d4a8c346a1ad765fc8353ce0e2ced8 (patch) | |
tree | 4c016173463cb53434559f3df3dbc7a872a90e02 | |
parent | 9898db4c948b9610608a4adda0f1389052c656be (diff) | |
download | busybox-w32-e977853e70d4a8c346a1ad765fc8353ce0e2ced8.tar.gz busybox-w32-e977853e70d4a8c346a1ad765fc8353ce0e2ced8.tar.bz2 busybox-w32-e977853e70d4a8c346a1ad765fc8353ce0e2ced8.zip |
udhcpc6: add some comments
RFCs for DHCPv6 are written rather badly...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | networking/udhcp/d6_common.h | 41 | ||||
-rw-r--r-- | networking/udhcp/d6_dhcpc.c | 10 |
2 files changed, 39 insertions, 12 deletions
diff --git a/networking/udhcp/d6_common.h b/networking/udhcp/d6_common.h index 9dfde7709..3cbfbb89e 100644 --- a/networking/udhcp/d6_common.h +++ b/networking/udhcp/d6_common.h | |||
@@ -63,28 +63,45 @@ struct d6_option { | |||
63 | 63 | ||
64 | #define D6_OPT_CLIENTID 1 | 64 | #define D6_OPT_CLIENTID 1 |
65 | #define D6_OPT_SERVERID 2 | 65 | #define D6_OPT_SERVERID 2 |
66 | /* "Identity Association for Non-temporary Addresses", | ||
67 | * also known as a "network interface" in plain English */ | ||
66 | #define D6_OPT_IA_NA 3 | 68 | #define D6_OPT_IA_NA 3 |
67 | #define D6_OPT_IA_TA 4 | 69 | /* "Identity Association for the Temporary Addresses". |
70 | * Presumably this is a "network interface with only link-local addresses". | ||
71 | * Why would DHCPv6 server assign such addresses, I have no idea. */ | ||
72 | //#define D6_OPT_IA_TA 4 | ||
73 | /* "IA Address", an IPv6 address */ | ||
68 | #define D6_OPT_IAADDR 5 | 74 | #define D6_OPT_IAADDR 5 |
75 | /* Option "Option Request Option". From the owners of a doggy dog named Dog? */ | ||
69 | #define D6_OPT_ORO 6 | 76 | #define D6_OPT_ORO 6 |
70 | #define D6_OPT_PREFERENCE 7 | 77 | //#define D6_OPT_PREFERENCE 7 |
71 | #define D6_OPT_ELAPSED_TIME 8 | 78 | #define D6_OPT_ELAPSED_TIME 8 |
72 | #define D6_OPT_RELAY_MSG 9 | 79 | //#define D6_OPT_RELAY_MSG 9 |
73 | #define D6_OPT_AUTH 11 | 80 | //#define D6_OPT_AUTH 11 |
74 | #define D6_OPT_UNICAST 12 | 81 | /* "The server sends this option to a client to indicate to the client |
82 | * that it is allowed to unicast messages to the server." | ||
83 | * Contains IPv6 address to send packets to. */ | ||
84 | //#define D6_OPT_UNICAST 12 | ||
85 | /* "A Status Code option may appear in the options field of a DHCP | ||
86 | * message and/or in the options field of another option." */ | ||
75 | #define D6_OPT_STATUS_CODE 13 | 87 | #define D6_OPT_STATUS_CODE 13 |
76 | #define D6_OPT_RAPID_COMMIT 14 | 88 | /* "A client MAY include this option in a Solicit message if the client |
77 | #define D6_OPT_USER_CLASS 15 | 89 | * is prepared to perform the Solicit-Reply message exchange..." */ |
78 | #define D6_OPT_VENDOR_CLASS 16 | 90 | //#define D6_OPT_RAPID_COMMIT 14 /* zero-length option */ |
79 | #define D6_OPT_VENDOR_OPTS 17 | 91 | //#define D6_OPT_USER_CLASS 15 |
80 | #define D6_OPT_INTERFACE_ID 18 | 92 | //#define D6_OPT_VENDOR_CLASS 16 |
81 | #define D6_OPT_RECONF_MSG 19 | 93 | //#define D6_OPT_VENDOR_OPTS 17 |
82 | #define D6_OPT_RECONF_ACCEPT 20 | 94 | //#define D6_OPT_INTERFACE_ID 18 |
95 | //#define D6_OPT_RECONF_MSG 19 | ||
96 | //#define D6_OPT_RECONF_ACCEPT 20 | ||
83 | 97 | ||
84 | #define D6_OPT_DNS_SERVERS 23 | 98 | #define D6_OPT_DNS_SERVERS 23 |
85 | #define D6_OPT_DOMAIN_LIST 24 | 99 | #define D6_OPT_DOMAIN_LIST 24 |
86 | 100 | ||
101 | /* RFC 3633 "Identity Association for Prefix Delegation". | ||
102 | * This option says that client wants to get an IPv6 prefix */ | ||
87 | #define D6_OPT_IA_PD 25 | 103 | #define D6_OPT_IA_PD 25 |
104 | /* Response from the server comes in this one */ | ||
88 | #define D6_OPT_IAPREFIX 26 | 105 | #define D6_OPT_IAPREFIX 26 |
89 | 106 | ||
90 | /* RFC 4704 "The DHCPv6 Client FQDN Option" | 107 | /* RFC 4704 "The DHCPv6 Client FQDN Option" |
diff --git a/networking/udhcp/d6_dhcpc.c b/networking/udhcp/d6_dhcpc.c index fd196eb67..9384e4b9c 100644 --- a/networking/udhcp/d6_dhcpc.c +++ b/networking/udhcp/d6_dhcpc.c | |||
@@ -1617,6 +1617,16 @@ int udhcpc6_main(int argc UNUSED_PARAM, char **argv) | |||
1617 | prefix_timeout = 0; | 1617 | prefix_timeout = 0; |
1618 | option = d6_find_option(packet.d6_options, packet_end, D6_OPT_STATUS_CODE); | 1618 | option = d6_find_option(packet.d6_options, packet_end, D6_OPT_STATUS_CODE); |
1619 | if (option && (option->data[0] | option->data[1]) != 0) { | 1619 | if (option && (option->data[0] | option->data[1]) != 0) { |
1620 | ///FIXME: | ||
1621 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
1622 | // | OPTION_STATUS_CODE | option-len | | ||
1623 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
1624 | // | status-code | | | ||
1625 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | ||
1626 | // . status-message . | ||
1627 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
1628 | // so why do we think it's NAK if data[0] is zero but data[1] is not? That's wrong... | ||
1629 | // we should also check that option->len is ok (i.e. not 0), right? | ||
1620 | /* return to init state */ | 1630 | /* return to init state */ |
1621 | bb_info_msg("received DHCP NAK (%u)", option->data[4]); | 1631 | bb_info_msg("received DHCP NAK (%u)", option->data[4]); |
1622 | d6_run_script(packet.d6_options, | 1632 | d6_run_script(packet.d6_options, |