Thomas Gleixner | 2874c5f | 2019-05-27 08:55:01 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /* |
| 3 | * INET An implementation of the TCP/IP protocol suite for the LINUX |
| 4 | * operating system. INET is implemented using the BSD Socket |
| 5 | * interface as the means of communication with the user level. |
| 6 | * |
| 7 | * Definitions for the ICMP module. |
| 8 | * |
| 9 | * Version: @(#)icmp.h 1.0.4 05/13/93 |
| 10 | * |
Jesper Juhl | 02c30a8 | 2005-05-05 16:16:16 -0700 | [diff] [blame] | 11 | * Authors: Ross Biro |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | */ |
| 14 | #ifndef _ICMP_H |
| 15 | #define _ICMP_H |
| 16 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | #include <linux/icmp.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | |
Arnaldo Carvalho de Melo | 14c8502 | 2005-12-27 02:43:12 -0200 | [diff] [blame] | 19 | #include <net/inet_sock.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | #include <net/snmp.h> |
Nazarov Sergey | 9ef6b42 | 2019-02-25 19:24:15 +0300 | [diff] [blame] | 21 | #include <net/ip.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | |
| 23 | struct icmp_err { |
| 24 | int errno; |
Eric Dumazet | 95c9617 | 2012-04-15 05:58:06 +0000 | [diff] [blame] | 25 | unsigned int fatal:1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | }; |
| 27 | |
Alexey Dobriyan | e754834 | 2010-01-22 10:18:25 +0000 | [diff] [blame] | 28 | extern const struct icmp_err icmp_err_convert[]; |
Pavel Emelyanov | b60538a | 2008-07-18 04:04:02 -0700 | [diff] [blame] | 29 | #define ICMP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmp_statistics, field) |
Eric Dumazet | 13415e4 | 2016-04-27 16:44:43 -0700 | [diff] [blame] | 30 | #define __ICMP_INC_STATS(net, field) __SNMP_INC_STATS((net)->mib.icmp_statistics, field) |
Eric Dumazet | acb32ba | 2011-11-08 13:04:43 +0000 | [diff] [blame] | 31 | #define ICMPMSGOUT_INC_STATS(net, field) SNMP_INC_STATS_ATOMIC_LONG((net)->mib.icmpmsg_statistics, field+256) |
Eric Dumazet | 214d3f1 | 2016-04-27 16:44:33 -0700 | [diff] [blame] | 32 | #define ICMPMSGIN_INC_STATS(net, field) SNMP_INC_STATS_ATOMIC_LONG((net)->mib.icmpmsg_statistics, field) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | |
Arnaldo Carvalho de Melo | 14c8502 | 2005-12-27 02:43:12 -0200 | [diff] [blame] | 34 | struct dst_entry; |
| 35 | struct net_proto_family; |
| 36 | struct sk_buff; |
Pavel Emelyanov | 0388b00 | 2008-07-14 23:00:43 -0700 | [diff] [blame] | 37 | struct net; |
Arnaldo Carvalho de Melo | 14c8502 | 2005-12-27 02:43:12 -0200 | [diff] [blame] | 38 | |
Nazarov Sergey | 9ef6b42 | 2019-02-25 19:24:15 +0300 | [diff] [blame] | 39 | void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info, |
| 40 | const struct ip_options *opt); |
| 41 | static inline void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) |
| 42 | { |
| 43 | __icmp_send(skb_in, type, code, info, &IPCB(skb_in)->opt); |
| 44 | } |
| 45 | |
Jason A. Donenfeld | 0b41713 | 2020-02-11 20:47:05 +0100 | [diff] [blame] | 46 | #if IS_ENABLED(CONFIG_NF_NAT) |
| 47 | void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info); |
| 48 | #else |
Jason A. Donenfeld | ee576c4 | 2021-02-23 14:18:58 +0100 | [diff] [blame] | 49 | static inline void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info) |
| 50 | { |
| 51 | struct ip_options opts = { 0 }; |
| 52 | __icmp_send(skb_in, type, code, info, &opts); |
| 53 | } |
Jason A. Donenfeld | 0b41713 | 2020-02-11 20:47:05 +0100 | [diff] [blame] | 54 | #endif |
| 55 | |
Joe Perches | e60ab84 | 2013-09-20 11:23:28 -0700 | [diff] [blame] | 56 | int icmp_rcv(struct sk_buff *skb); |
Stefano Brivio | 32bbd87 | 2018-11-08 12:19:21 +0100 | [diff] [blame] | 57 | int icmp_err(struct sk_buff *skb, u32 info); |
Joe Perches | e60ab84 | 2013-09-20 11:23:28 -0700 | [diff] [blame] | 58 | int icmp_init(void); |
| 59 | void icmp_out_count(struct net *net, unsigned char type); |
Andreas Roeseler | 1fd07f3 | 2021-06-26 09:07:46 -0500 | [diff] [blame] | 60 | bool icmp_build_probe(struct sk_buff *skb, struct icmphdr *icmphdr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | #endif /* _ICMP_H */ |