summaryrefslogtreecommitdiff
path: root/include/net6.h
diff options
context:
space:
mode:
authorViacheslav Mitrofanov <v.v.mitrofanov@yadro.com>2022-12-02 12:18:08 +0300
committerTom Rini <trini@konsulko.com>2022-12-05 12:47:16 -0500
commiteeb0a2c6938226ee3c46fa66971da9231d64667d (patch)
tree6eb7a6f8caca4976f1f78afa9f229b41e704f67b /include/net6.h
parent7fbf230d79ad531e680475529191e2ec08099c7d (diff)
net: ping6: Add ping6 command
Implement ping6 command to ping hosts using IPv6. It works the same way as an ordinary ping command. There is no ICMP request so it is not possible to ping our host. This patch adds options in Kconfig and Makefile to build ping6 command. Series-changes: 3 - Added structures and functions descriptions - Added to ping6_receive() return value instead of void Series-changes: 4 - Fixed structures and functions 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 'include/net6.h')
-rw-r--r--include/net6.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/net6.h b/include/net6.h
index 622885e7df8..9b3de028e6d 100644
--- a/include/net6.h
+++ b/include/net6.h
@@ -172,6 +172,7 @@ extern struct in6_addr net_ip6; /* Our IPv6 addr (0 = unknown) */
extern struct in6_addr net_link_local_ip6; /* Our link local IPv6 addr */
extern u32 net_prefix_length; /* Our prefixlength (0 = unknown) */
extern struct in6_addr net_server_ip6; /* Server IPv6 addr (0 = unknown) */
+extern struct in6_addr net_ping_ip6; /* the ipv6 address to ping */
extern bool use_ip6;
#if IS_ENABLED(CONFIG_IPV6)
@@ -403,4 +404,29 @@ static inline void net_copy_ip6(void *to, const void *from)
}
#endif
+#if IS_ENABLED(CONFIG_CMD_PING6)
+/* Send ping requset */
+void ping6_start(void);
+
+/**
+ * ping6_receive() - Handle reception of ICMPv6 echo request/reply
+ *
+ * @et: pointer to incoming patcket
+ * @ip6: pointer to IPv6 protocol
+ * @len: packet length
+ * Return: 0 if success, -EINVAL in case of failure during reception
+ */
+int ping6_receive(struct ethernet_hdr *et, struct ip6_hdr *ip6, int len);
+#else
+static inline void ping6_start(void)
+{
+}
+
+static inline
+int ping6_receive(struct ethernet_hdr *et, struct ip6_hdr *ip6, int len)
+{
+ return -EINVAL;
+}
+#endif /* CONFIG_CMD_PING6 */
+
#endif /* __NET6_H__ */