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 protocol. 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * Version: @(#)icmp.h 1.0.3 04/28/93 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> 128c2ecf20Sopenharmony_ci */ 138c2ecf20Sopenharmony_ci#ifndef _LINUX_ICMP_H 148c2ecf20Sopenharmony_ci#define _LINUX_ICMP_H 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#include <linux/skbuff.h> 178c2ecf20Sopenharmony_ci#include <uapi/linux/icmp.h> 188c2ecf20Sopenharmony_ci#include <uapi/linux/errqueue.h> 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_cistatic inline struct icmphdr *icmp_hdr(const struct sk_buff *skb) 218c2ecf20Sopenharmony_ci{ 228c2ecf20Sopenharmony_ci return (struct icmphdr *)skb_transport_header(skb); 238c2ecf20Sopenharmony_ci} 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_cistatic inline bool icmp_is_err(int type) 268c2ecf20Sopenharmony_ci{ 278c2ecf20Sopenharmony_ci switch (type) { 288c2ecf20Sopenharmony_ci case ICMP_DEST_UNREACH: 298c2ecf20Sopenharmony_ci case ICMP_SOURCE_QUENCH: 308c2ecf20Sopenharmony_ci case ICMP_REDIRECT: 318c2ecf20Sopenharmony_ci case ICMP_TIME_EXCEEDED: 328c2ecf20Sopenharmony_ci case ICMP_PARAMETERPROB: 338c2ecf20Sopenharmony_ci return true; 348c2ecf20Sopenharmony_ci } 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci return false; 378c2ecf20Sopenharmony_ci} 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_civoid ip_icmp_error_rfc4884(const struct sk_buff *skb, 408c2ecf20Sopenharmony_ci struct sock_ee_data_rfc4884 *out, 418c2ecf20Sopenharmony_ci int thlen, int off); 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci#endif /* _LINUX_ICMP_H */ 44