aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/d6_common.h
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-11-07 15:55:39 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2011-11-07 15:55:39 +0100
commit9ba75048c0099ed90b9a64cb7bb57bf12be93528 (patch)
tree172ef8f52da2e4fc4ee0f52aef3234b3bd170f96 /networking/udhcp/d6_common.h
parent50089fc61c1dbb3d09c4bee21ab6d2aa44361ff9 (diff)
downloadbusybox-9ba75048c0099ed90b9a64cb7bb57bf12be93528.tar.gz
udhcpc6: new applet. Not yet functional.
It builds. It sends Solicit packets. Not sure these packets are well-formed. I have no server to test it against. function old new delta udhcpc6_main - 2426 +2426 d6_send_raw_packet - 428 +428 d6_send_kernel_packet - 274 +274 d6_recv_raw_packet - 248 +248 send_d6_discover - 177 +177 packed_usage 28795 28966 +171 d6_run_script - 156 +156 send_d6_renew - 140 +140 send_d6_release - 126 +126 d6_recv_kernel_packet - 116 +116 send_d6_select - 95 +95 perform_d6_release - 78 +78 d6_find_option - 74 +74 init_d6_packet - 54 +54 d6_copy_option - 48 +48 d6_mcast_from_client_config_ifindex - 42 +42 d6_dump_packet - 24 +24 static.FF02__1_2 - 16 +16 d6_store_blob - 13 +13 applet_names 2432 2440 +8 applet_main 1412 1416 +4 applet_nameofs 706 708 +2 add_d6_client_options - 1 +1 ------------------------------------------------------------------------------ (add/remove: 21/0 grow/shrink: 4/0 up/down: 4721/0) Total: 4721 bytes text data bss dec hex filename 879080 493 7584 887157 d8975 busybox_old 884585 497 7584 892666 d9efa busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/udhcp/d6_common.h')
-rw-r--r--networking/udhcp/d6_common.h118
1 files changed, 118 insertions, 0 deletions
diff --git a/networking/udhcp/d6_common.h b/networking/udhcp/d6_common.h
new file mode 100644
index 000000000..88afaf8af
--- /dev/null
+++ b/networking/udhcp/d6_common.h
@@ -0,0 +1,118 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Copyright (C) 2011 Denys Vlasenko.
+ *
+ * Licensed under GPLv2, see file LICENSE in this source tree.
+ */
+#ifndef UDHCP_D6_COMMON_H
+#define UDHCP_D6_COMMON_H 1
+
+#include <netinet/ip6.h>
+
+PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
+
+
+/*** DHCPv6 packet ***/
+
+/* DHCPv6 protocol. See RFC 3315 */
+#define D6_MSG_SOLICIT 1
+#define D6_MSG_ADVERTISE 2
+#define D6_MSG_REQUEST 3
+#define D6_MSG_CONFIRM 4
+#define D6_MSG_RENEW 5
+#define D6_MSG_REBIND 6
+#define D6_MSG_REPLY 7
+#define D6_MSG_RELEASE 8
+#define D6_MSG_DECLINE 9
+#define D6_MSG_RECONFIGURE 10
+#define D6_MSG_INFORMATION_REQUEST 11
+#define D6_MSG_RELAY_FORW 12
+#define D6_MSG_RELAY_REPL 13
+
+struct d6_packet {
+ union {
+ uint8_t d6_msg_type;
+ uint32_t d6_xid32;
+ } d6_u;
+ uint8_t d6_options[576 - sizeof(struct iphdr) - sizeof(struct udphdr) - 4
+ + CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS];
+} PACKED;
+#define d6_msg_type d6_u.d6_msg_type
+#define d6_xid32 d6_u.d6_xid32
+
+struct ip6_udp_d6_packet {
+ struct ip6_hdr ip6;
+ struct udphdr udp;
+ struct d6_packet data;
+} PACKED;
+
+struct udp_d6_packet {
+ struct udphdr udp;
+ struct d6_packet data;
+} PACKED;
+
+/*** Options ***/
+
+struct d6_option {
+ uint8_t code;
+ uint8_t code_hi;
+ uint8_t len;
+ uint8_t len_hi;
+ uint8_t data[1];
+} PACKED;
+
+#define D6_OPT_CLIENTID 1
+#define D6_OPT_SERVERID 2
+#define D6_OPT_IA_NA 3
+#define D6_OPT_IA_TA 4
+#define D6_OPT_IAADDR 5
+#define D6_OPT_ORO 6
+#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_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
+
+/*** Other shared functions ***/
+
+struct client6_data_t {
+ struct d6_option *server_id;
+ struct d6_option *ia_na;
+};
+
+#define client6_data (*(struct client6_data_t*)(&bb_common_bufsiz1[COMMON_BUFSIZE - sizeof(struct client6_data_t)]))
+
+int FAST_FUNC d6_listen_socket(int port, const char *inf);
+
+int FAST_FUNC d6_recv_kernel_packet(
+ struct in6_addr *peer_ipv6,
+ struct d6_packet *packet, int fd
+);
+
+int FAST_FUNC d6_send_raw_packet(
+ struct d6_packet *d6_pkt, unsigned d6_pkt_size,
+ struct in6_addr *src_ipv6, int source_port,
+ struct in6_addr *dst_ipv6, int dest_port, const uint8_t *dest_arp,
+ int ifindex
+);
+
+int FAST_FUNC d6_send_kernel_packet(
+ struct d6_packet *d6_pkt, unsigned d6_pkt_size,
+ struct in6_addr *src_ipv6, int source_port,
+ struct in6_addr *dst_ipv6, int dest_port
+);
+
+void FAST_FUNC d6_dump_packet(struct d6_packet *packet);
+
+
+POP_SAVED_FUNCTION_VISIBILITY
+
+#endif