icmp.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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, <[email protected]>
  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 ip_options *opt);
  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)->opt);
  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 ip_options opts = { 0 };
  45. __icmp_send(skb_in, type, code, info, &opts);
  46. }
  47. #endif
  48. int icmp_rcv(struct sk_buff *skb);
  49. int icmp_err(struct sk_buff *skb, u32 info);
  50. int icmp_init(void);
  51. void icmp_out_count(struct net *net, unsigned char type);
  52. bool icmp_build_probe(struct sk_buff *skb, struct icmphdr *icmphdr);
  53. #endif /* _ICMP_H */