blob: a8f888976137820e9b6a94a5d6bf37619073d19a [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002#ifndef _LINUX_ICMPV6_H
3#define _LINUX_ICMPV6_H
4
Arnaldo Carvalho de Melocc70ab22007-03-13 14:03:22 -03005#include <linux/skbuff.h>
David Howells607ca462012-10-13 10:46:48 +01006#include <uapi/linux/icmpv6.h>
Arnaldo Carvalho de Melocc70ab22007-03-13 14:03:22 -03007
8static inline struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb)
9{
Arnaldo Carvalho de Melo9c702202007-04-25 18:04:18 -070010 return (struct icmp6hdr *)skb_transport_header(skb);
Arnaldo Carvalho de Melocc70ab22007-03-13 14:03:22 -030011}
Linus Torvalds1da177e2005-04-16 15:20:36 -070012
13#include <linux/netdevice.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
Pravin B Shelar5f5624c2013-04-25 11:08:30 +000015#if IS_ENABLED(CONFIG_IPV6)
16extern void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info);
17
Eric Dumazetb1cadc12016-06-18 21:52:02 -070018typedef void ip6_icmp_send_t(struct sk_buff *skb, u8 type, u8 code, __u32 info,
19 const struct in6_addr *force_saddr);
Pravin B Shelar5f5624c2013-04-25 11:08:30 +000020extern int inet6_register_icmp_sender(ip6_icmp_send_t *fn);
21extern int inet6_unregister_icmp_sender(ip6_icmp_send_t *fn);
Eric Dumazet20e19542016-06-18 21:52:06 -070022int ip6_err_gen_icmpv6_unreach(struct sk_buff *skb, int nhs, int type,
23 unsigned int data_len);
Pravin B Shelar5f5624c2013-04-25 11:08:30 +000024
25#else
26
27static inline void icmpv6_send(struct sk_buff *skb,
28 u8 type, u8 code, __u32 info)
29{
30
31}
32#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070033
Denis V. Lunev9b0f9762008-02-29 11:13:15 -080034extern int icmpv6_init(void);
Brian Haleyd5fdd6b2009-06-23 04:31:07 -070035extern int icmpv6_err_convert(u8 type, u8 code,
Linus Torvalds1da177e2005-04-16 15:20:36 -070036 int *err);
37extern void icmpv6_cleanup(void);
38extern void icmpv6_param_prob(struct sk_buff *skb,
Brian Haleyd5fdd6b2009-06-23 04:31:07 -070039 u8 code, int pos);
YOSHIFUJI Hideaki95e41e92007-12-06 15:43:30 -080040
David S. Miller4c9483b2011-03-12 16:22:43 -050041struct flowi6;
David S. Millerf59d4382008-03-05 20:58:10 -080042struct in6_addr;
YOSHIFUJI Hideaki95e41e92007-12-06 15:43:30 -080043extern void icmpv6_flow_init(struct sock *sk,
David S. Miller4c9483b2011-03-12 16:22:43 -050044 struct flowi6 *fl6,
YOSHIFUJI Hideaki95e41e92007-12-06 15:43:30 -080045 u8 type,
46 const struct in6_addr *saddr,
47 const struct in6_addr *daddr,
48 int oif);
Linus Torvalds1da177e2005-04-16 15:20:36 -070049#endif