summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorViacheslav Mitrofanov <v.v.mitrofanov@yadro.com>2022-12-02 12:17:58 +0300
committerTom Rini <trini@konsulko.com>2022-12-05 12:47:15 -0500
commit33b5066a595661315ec236269b3154297d4cf779 (patch)
tree57c9f44cbca272fab27d35b6aff50c989555abfa /net
parenta50622d78c5c6babd1853ae913f339df54fe532c (diff)
net: ipv6: Add IPv6 basic primitives
This patch is a collection of basic primitives that are prerequisite for further IPv6 implementation. There are structures definition such as IPv6 header, UDP header (for TFTP), ICMPv6 header. There are auxiliary defines such as protocol codes, padding, struct size and etc. Also here are functions prototypes and its empty implementation that will be used as API for further patches. Here are variables declaration such as IPv6 address of our host, gateway, ipv6 server. Series-changes: 3 - Added functions and structures descriptions - Removed enums ND_OPT_*. It will be moved into further patches - Substituted -1 for error codes Series-changes: 4 - Changed functions and structures description style Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'net')
-rw-r--r--net/net6.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/net/net6.c b/net/net6.c
new file mode 100644
index 0000000000..7cd442e6e2
--- /dev/null
+++ b/net/net6.c
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2013 Allied Telesis Labs NZ
+ * Chris Packham, <judge.packham@gmail.com>
+ *
+ * Copyright (C) 2022 YADRO
+ * Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
+ */
+
+/* Simple IPv6 network layer implementation */
+
+#include <common.h>
+#include <env_internal.h>
+#include <malloc.h>
+#include <net.h>
+#include <net6.h>
+
+/* NULL IPv6 address */
+struct in6_addr const net_null_addr_ip6 = ZERO_IPV6_ADDR;
+/* Our gateway's IPv6 address */
+struct in6_addr net_gateway6 = ZERO_IPV6_ADDR;
+/* Our IPv6 addr (0 = unknown) */
+struct in6_addr net_ip6 = ZERO_IPV6_ADDR;
+/* Our link local IPv6 addr (0 = unknown) */
+struct in6_addr net_link_local_ip6 = ZERO_IPV6_ADDR;
+/* set server IPv6 addr (0 = unknown) */
+struct in6_addr net_server_ip6 = ZERO_IPV6_ADDR;
+/* The prefix length of our network */
+u32 net_prefix_length;
+
+bool use_ip6;