hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/include/linux/icmp.h
....@@ -1,3 +1,4 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * INET An implementation of the TCP/IP protocol suite for the LINUX
34 * operating system. INET is implemented using the BSD Socket
....@@ -8,20 +9,35 @@
89 * Version: @(#)icmp.h 1.0.3 04/28/93
910 *
1011 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
11
- *
12
- * This program is free software; you can redistribute it and/or
13
- * modify it under the terms of the GNU General Public License
14
- * as published by the Free Software Foundation; either version
15
- * 2 of the License, or (at your option) any later version.
1612 */
1713 #ifndef _LINUX_ICMP_H
1814 #define _LINUX_ICMP_H
1915
2016 #include <linux/skbuff.h>
2117 #include <uapi/linux/icmp.h>
18
+#include <uapi/linux/errqueue.h>
2219
2320 static inline struct icmphdr *icmp_hdr(const struct sk_buff *skb)
2421 {
2522 return (struct icmphdr *)skb_transport_header(skb);
2623 }
24
+
25
+static inline bool icmp_is_err(int type)
26
+{
27
+ switch (type) {
28
+ case ICMP_DEST_UNREACH:
29
+ case ICMP_SOURCE_QUENCH:
30
+ case ICMP_REDIRECT:
31
+ case ICMP_TIME_EXCEEDED:
32
+ case ICMP_PARAMETERPROB:
33
+ return true;
34
+ }
35
+
36
+ return false;
37
+}
38
+
39
+void ip_icmp_error_rfc4884(const struct sk_buff *skb,
40
+ struct sock_ee_data_rfc4884 *out,
41
+ int thlen, int off);
42
+
2743 #endif /* _LINUX_ICMP_H */