18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * INET An implementation of the TCP/IP protocol suite for the LINUX 48c2ecf20Sopenharmony_ci * operating system. INET is implemented using the BSD Socket 58c2ecf20Sopenharmony_ci * interface as the means of communication with the user level. 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Definitions for the ICMP module. 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * Version: @(#)icmp.h 1.0.4 05/13/93 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * Authors: Ross Biro 128c2ecf20Sopenharmony_ci * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> 138c2ecf20Sopenharmony_ci */ 148c2ecf20Sopenharmony_ci#ifndef _ICMP_H 158c2ecf20Sopenharmony_ci#define _ICMP_H 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#include <linux/icmp.h> 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci#include <net/inet_sock.h> 208c2ecf20Sopenharmony_ci#include <net/snmp.h> 218c2ecf20Sopenharmony_ci#include <net/ip.h> 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_cistruct icmp_err { 248c2ecf20Sopenharmony_ci int errno; 258c2ecf20Sopenharmony_ci unsigned int fatal:1; 268c2ecf20Sopenharmony_ci}; 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ciextern const struct icmp_err icmp_err_convert[]; 298c2ecf20Sopenharmony_ci#define ICMP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmp_statistics, field) 308c2ecf20Sopenharmony_ci#define __ICMP_INC_STATS(net, field) __SNMP_INC_STATS((net)->mib.icmp_statistics, field) 318c2ecf20Sopenharmony_ci#define ICMPMSGOUT_INC_STATS(net, field) SNMP_INC_STATS_ATOMIC_LONG((net)->mib.icmpmsg_statistics, field+256) 328c2ecf20Sopenharmony_ci#define ICMPMSGIN_INC_STATS(net, field) SNMP_INC_STATS_ATOMIC_LONG((net)->mib.icmpmsg_statistics, field) 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_cistruct dst_entry; 358c2ecf20Sopenharmony_cistruct net_proto_family; 368c2ecf20Sopenharmony_cistruct sk_buff; 378c2ecf20Sopenharmony_cistruct net; 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_civoid __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info, 408c2ecf20Sopenharmony_ci const struct ip_options *opt); 418c2ecf20Sopenharmony_cistatic inline void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) 428c2ecf20Sopenharmony_ci{ 438c2ecf20Sopenharmony_ci __icmp_send(skb_in, type, code, info, &IPCB(skb_in)->opt); 448c2ecf20Sopenharmony_ci} 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci#if IS_ENABLED(CONFIG_NF_NAT) 478c2ecf20Sopenharmony_civoid icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info); 488c2ecf20Sopenharmony_ci#else 498c2ecf20Sopenharmony_cistatic inline void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info) 508c2ecf20Sopenharmony_ci{ 518c2ecf20Sopenharmony_ci struct ip_options opts = { 0 }; 528c2ecf20Sopenharmony_ci __icmp_send(skb_in, type, code, info, &opts); 538c2ecf20Sopenharmony_ci} 548c2ecf20Sopenharmony_ci#endif 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ciint icmp_rcv(struct sk_buff *skb); 578c2ecf20Sopenharmony_ciint icmp_err(struct sk_buff *skb, u32 info); 588c2ecf20Sopenharmony_ciint icmp_init(void); 598c2ecf20Sopenharmony_civoid icmp_out_count(struct net *net, unsigned char type); 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci#endif /* _ICMP_H */ 62