^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * INET An implementation of the TCP/IP protocol suite for the LINUX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * operating system. INET is implemented using the BSD Socket
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * interface as the means of communication with the user level.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Definitions for the ICMP module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * Version: @(#)icmp.h 1.0.4 05/13/93
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * Authors: Ross Biro
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #ifndef _ICMP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define _ICMP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/icmp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <net/inet_sock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <net/snmp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <net/ip.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) struct icmp_err {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) int errno;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) unsigned int fatal:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) extern const struct icmp_err icmp_err_convert[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define ICMP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmp_statistics, field)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #define __ICMP_INC_STATS(net, field) __SNMP_INC_STATS((net)->mib.icmp_statistics, field)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #define ICMPMSGOUT_INC_STATS(net, field) SNMP_INC_STATS_ATOMIC_LONG((net)->mib.icmpmsg_statistics, field+256)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #define ICMPMSGIN_INC_STATS(net, field) SNMP_INC_STATS_ATOMIC_LONG((net)->mib.icmpmsg_statistics, field)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) struct dst_entry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) struct net_proto_family;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) struct sk_buff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) struct net;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) const struct ip_options *opt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) static inline void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) __icmp_send(skb_in, type, code, info, &IPCB(skb_in)->opt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #if IS_ENABLED(CONFIG_NF_NAT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) static inline void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) struct ip_options opts = { 0 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) __icmp_send(skb_in, type, code, info, &opts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) int icmp_rcv(struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) int icmp_err(struct sk_buff *skb, u32 info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) int icmp_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) void icmp_out_count(struct net *net, unsigned char type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #endif /* _ICMP_H */