icmp.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  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. *
  11. * Authors: Ross Biro
  12. * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  13. */
  14. #ifndef _ICMP_H
  15. #define _ICMP_H
  16. #include <linux/icmp.h>
  17. #include <net/inet_sock.h>
  18. #include <net/snmp.h>
  19. #include <net/ip.h>
  20. struct icmp_err {
  21. int errno;
  22. unsigned int fatal:1;
  23. };
  24. extern const struct icmp_err icmp_err_convert[];
  25. #define ICMP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmp_statistics, field)
  26. #define __ICMP_INC_STATS(net, field) __SNMP_INC_STATS((net)->mib.icmp_statistics, field)
  27. #define ICMPMSGOUT_INC_STATS(net, field) SNMP_INC_STATS_ATOMIC_LONG((net)->mib.icmpmsg_statistics, field+256)
  28. #define ICMPMSGIN_INC_STATS(net, field) SNMP_INC_STATS_ATOMIC_LONG((net)->mib.icmpmsg_statistics, field)
  29. struct dst_entry;
  30. struct net_proto_family;
  31. struct sk_buff;
  32. struct net;
  33. void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info,
  34. const struct inet_skb_parm *parm);
  35. static inline void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
  36. {
  37. __icmp_send(skb_in, type, code, info, IPCB(skb_in));
  38. }
  39. #if IS_ENABLED(CONFIG_NF_NAT)
  40. void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info);
  41. #else
  42. static inline void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info)
  43. {
  44. struct inet_skb_parm parm;
  45. memset(&parm, 0, sizeof(parm));
  46. __icmp_send(skb_in, type, code, info, &parm);
  47. }
  48. #endif
  49. int icmp_rcv(struct sk_buff *skb);
  50. int icmp_err(struct sk_buff *skb, u32 info);
  51. int icmp_init(void);
  52. void icmp_out_count(struct net *net, unsigned char type);
  53. bool icmp_build_probe(struct sk_buff *skb, struct icmphdr *icmphdr);
  54. #endif /* _ICMP_H */