summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko2022-12-14 00:36:59 +0100
committerDenys Vlasenko2022-12-14 00:36:59 +0100
commite977853e70d4a8c346a1ad765fc8353ce0e2ced8 (patch)
tree4c016173463cb53434559f3df3dbc7a872a90e02
parent9898db4c948b9610608a4adda0f1389052c656be (diff)
downloadbusybox-e977853e70d4a8c346a1ad765fc8353ce0e2ced8.zip
busybox-e977853e70d4a8c346a1ad765fc8353ce0e2ced8.tar.gz
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.h41
-rw-r--r--networking/udhcp/d6_dhcpc.c10
2 files changed, 39 insertions, 12 deletions
diff --git a/networking/udhcp/d6_common.h b/networking/udhcp/d6_common.h
index 9dfde77..3cbfbb8 100644
--- a/networking/udhcp/d6_common.h
+++ b/networking/udhcp/d6_common.h
@@ -63,28 +63,45 @@ struct d6_option {
#define D6_OPT_CLIENTID 1
#define D6_OPT_SERVERID 2
+/* "Identity Association for Non-temporary Addresses",
+ * also known as a "network interface" in plain English */
#define D6_OPT_IA_NA 3
-#define D6_OPT_IA_TA 4
+/* "Identity Association for the Temporary Addresses".
+ * Presumably this is a "network interface with only link-local addresses".
+ * Why would DHCPv6 server assign such addresses, I have no idea. */
+//#define D6_OPT_IA_TA 4
+/* "IA Address", an IPv6 address */
#define D6_OPT_IAADDR 5
+/* Option "Option Request Option". From the owners of a doggy dog named Dog? */
#define D6_OPT_ORO 6
-#define D6_OPT_PREFERENCE 7
+//#define D6_OPT_PREFERENCE 7
#define D6_OPT_ELAPSED_TIME 8
-#define D6_OPT_RELAY_MSG 9
-#define D6_OPT_AUTH 11
-#define D6_OPT_UNICAST 12
+//#define D6_OPT_RELAY_MSG 9
+//#define D6_OPT_AUTH 11
+/* "The server sends this option to a client to indicate to the client
+ * that it is allowed to unicast messages to the server."
+ * Contains IPv6 address to send packets to. */
+//#define D6_OPT_UNICAST 12
+/* "A Status Code option may appear in the options field of a DHCP
+ * message and/or in the options field of another option." */
#define D6_OPT_STATUS_CODE 13
-#define D6_OPT_RAPID_COMMIT 14
-#define D6_OPT_USER_CLASS 15
-#define D6_OPT_VENDOR_CLASS 16
-#define D6_OPT_VENDOR_OPTS 17
-#define D6_OPT_INTERFACE_ID 18
-#define D6_OPT_RECONF_MSG 19
-#define D6_OPT_RECONF_ACCEPT 20
+/* "A client MAY include this option in a Solicit message if the client
+ * is prepared to perform the Solicit-Reply message exchange..." */
+//#define D6_OPT_RAPID_COMMIT 14 /* zero-length option */
+//#define D6_OPT_USER_CLASS 15
+//#define D6_OPT_VENDOR_CLASS 16
+//#define D6_OPT_VENDOR_OPTS 17
+//#define D6_OPT_INTERFACE_ID 18
+//#define D6_OPT_RECONF_MSG 19
+//#define D6_OPT_RECONF_ACCEPT 20
#define D6_OPT_DNS_SERVERS 23
#define D6_OPT_DOMAIN_LIST 24
+/* RFC 3633 "Identity Association for Prefix Delegation".
+ * This option says that client wants to get an IPv6 prefix */
#define D6_OPT_IA_PD 25
+/* Response from the server comes in this one */
#define D6_OPT_IAPREFIX 26
/* RFC 4704 "The DHCPv6 Client FQDN Option"
diff --git a/networking/udhcp/d6_dhcpc.c b/networking/udhcp/d6_dhcpc.c
index fd196eb..9384e4b 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)
prefix_timeout = 0;
option = d6_find_option(packet.d6_options, packet_end, D6_OPT_STATUS_CODE);
if (option && (option->data[0] | option->data[1]) != 0) {
+///FIXME:
+// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+// | OPTION_STATUS_CODE | option-len |
+// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+// | status-code | |
+// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
+// . status-message .
+// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+// so why do we think it's NAK if data[0] is zero but data[1] is not? That's wrong...
+// we should also check that option->len is ok (i.e. not 0), right?
/* return to init state */
bb_info_msg("received DHCP NAK (%u)", option->data[4]);
d6_run_script(packet.d6_options,