blob: 9205a76d967a03e4162bad03f2f4e53d6e976506 [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 _NDISC_H
3#define _NDISC_H
4
David Ahern71df5772019-04-05 16:30:25 -07005#include <net/ipv6_stubs.h>
6
Linus Torvalds1da177e2005-04-16 15:20:36 -07007/*
8 * ICMP codes for neighbour discovery messages
9 */
10
11#define NDISC_ROUTER_SOLICITATION 133
12#define NDISC_ROUTER_ADVERTISEMENT 134
13#define NDISC_NEIGHBOUR_SOLICITATION 135
14#define NDISC_NEIGHBOUR_ADVERTISEMENT 136
15#define NDISC_REDIRECT 137
16
17/*
Templin, Fred Lfadf6bf2008-03-11 18:35:59 -040018 * Router type: cross-layer information from link-layer to
19 * IPv6 layer reported by certain link types (e.g., RFC4214).
20 */
21#define NDISC_NODETYPE_UNSPEC 0 /* unspecified (default) */
22#define NDISC_NODETYPE_HOST 1 /* host or unauthorized router */
23#define NDISC_NODETYPE_NODEFAULT 2 /* non-default router */
24#define NDISC_NODETYPE_DEFAULT 3 /* default router */
25
26/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 * ndisc options
28 */
29
30enum {
31 __ND_OPT_PREFIX_INFO_END = 0,
32 ND_OPT_SOURCE_LL_ADDR = 1, /* RFC2461 */
33 ND_OPT_TARGET_LL_ADDR = 2, /* RFC2461 */
34 ND_OPT_PREFIX_INFO = 3, /* RFC2461 */
35 ND_OPT_REDIRECT_HDR = 4, /* RFC2461 */
36 ND_OPT_MTU = 5, /* RFC2461 */
Erik Nordmarkadc176c2016-12-02 14:00:08 -080037 ND_OPT_NONCE = 14, /* RFC7527 */
YOSHIFUJI Hideaki70ceb4f2006-03-20 17:06:24 -080038 __ND_OPT_ARRAY_MAX,
39 ND_OPT_ROUTE_INFO = 24, /* RFC4191 */
Pierre Ynard31910572007-10-10 21:22:05 -070040 ND_OPT_RDNSS = 25, /* RFC5006 */
Alexey I. Froloffe35f30c2012-04-06 05:50:58 +000041 ND_OPT_DNSSL = 31, /* RFC6106 */
Alexander Aringbbe5f5c2016-06-15 21:20:25 +020042 ND_OPT_6CO = 34, /* RFC6775 */
Maciej Żenczykowski66b5f1c2019-07-18 23:30:03 -070043 ND_OPT_CAPTIVE_PORTAL = 37, /* RFC7710 */
Maciej Żenczykowski9175d3f2020-04-20 11:25:07 -070044 ND_OPT_PREF64 = 38, /* RFC8781 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 __ND_OPT_MAX
46};
47
48#define MAX_RTR_SOLICITATION_DELAY HZ
49
50#define ND_REACHABLE_TIME (30*HZ)
51#define ND_RETRANS_TIMER HZ
52
Arnaldo Carvalho de Melo14c85022005-12-27 02:43:12 -020053#include <linux/compiler.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070054#include <linux/icmpv6.h>
Arnaldo Carvalho de Melo14c85022005-12-27 02:43:12 -020055#include <linux/in6.h>
56#include <linux/types.h>
David S. Miller30f2a5f2012-07-11 23:26:46 -070057#include <linux/if_arp.h>
58#include <linux/netdevice.h>
Pavel Emelyanovb14f2432012-08-08 21:52:28 +000059#include <linux/hash.h>
Arnaldo Carvalho de Melo14c85022005-12-27 02:43:12 -020060
Linus Torvalds1da177e2005-04-16 15:20:36 -070061#include <net/neighbour.h>
Arnaldo Carvalho de Melo14c85022005-12-27 02:43:12 -020062
Alexander Aringcc84b3c2016-06-15 21:20:24 +020063/* Set to 3 to get tracing... */
64#define ND_DEBUG 1
65
66#define ND_PRINTK(val, level, fmt, ...) \
67do { \
68 if (val <= ND_DEBUG) \
69 net_##level##_ratelimited(fmt, ##__VA_ARGS__); \
70} while (0)
71
Arnaldo Carvalho de Melo14c85022005-12-27 02:43:12 -020072struct ctl_table;
Arnaldo Carvalho de Melo14c85022005-12-27 02:43:12 -020073struct inet6_dev;
74struct net_device;
75struct net_proto_family;
76struct sk_buff;
Alexander Aringf997c552016-06-15 21:20:23 +020077struct prefix_info;
Linus Torvalds1da177e2005-04-16 15:20:36 -070078
79extern struct neigh_table nd_tbl;
80
81struct nd_msg {
82 struct icmp6hdr icmph;
83 struct in6_addr target;
Gustavo A. R. Silva53e76f42020-02-28 18:53:11 -060084 __u8 opt[];
Linus Torvalds1da177e2005-04-16 15:20:36 -070085};
86
87struct rs_msg {
88 struct icmp6hdr icmph;
Gustavo A. R. Silva53e76f42020-02-28 18:53:11 -060089 __u8 opt[];
Linus Torvalds1da177e2005-04-16 15:20:36 -070090};
91
92struct ra_msg {
93 struct icmp6hdr icmph;
Al Viroe69a4ad2006-11-14 20:56:00 -080094 __be32 reachable_time;
95 __be32 retrans_timer;
Linus Torvalds1da177e2005-04-16 15:20:36 -070096};
97
Duan Jiong093d04d2012-12-14 02:59:59 +000098struct rd_msg {
99 struct icmp6hdr icmph;
100 struct in6_addr target;
101 struct in6_addr dest;
Gustavo A. R. Silva53e76f42020-02-28 18:53:11 -0600102 __u8 opt[];
Duan Jiong093d04d2012-12-14 02:59:59 +0000103};
104
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105struct nd_opt_hdr {
106 __u8 nd_opt_type;
107 __u8 nd_opt_len;
Eric Dumazetbc105022010-06-03 03:21:52 -0700108} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109
David S. Miller30f2a5f2012-07-11 23:26:46 -0700110/* ND options */
111struct ndisc_options {
112 struct nd_opt_hdr *nd_opt_array[__ND_OPT_ARRAY_MAX];
113#ifdef CONFIG_IPV6_ROUTE_INFO
114 struct nd_opt_hdr *nd_opts_ri;
115 struct nd_opt_hdr *nd_opts_ri_end;
116#endif
117 struct nd_opt_hdr *nd_useropts;
118 struct nd_opt_hdr *nd_useropts_end;
Alexander Aringbbe5f5c2016-06-15 21:20:25 +0200119#if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN)
120 struct nd_opt_hdr *nd_802154_opt_array[ND_OPT_TARGET_LL_ADDR + 1];
121#endif
David S. Miller30f2a5f2012-07-11 23:26:46 -0700122};
123
Alexander Aringbbe5f5c2016-06-15 21:20:25 +0200124#define nd_opts_src_lladdr nd_opt_array[ND_OPT_SOURCE_LL_ADDR]
125#define nd_opts_tgt_lladdr nd_opt_array[ND_OPT_TARGET_LL_ADDR]
126#define nd_opts_pi nd_opt_array[ND_OPT_PREFIX_INFO]
127#define nd_opts_pi_end nd_opt_array[__ND_OPT_PREFIX_INFO_END]
128#define nd_opts_rh nd_opt_array[ND_OPT_REDIRECT_HDR]
129#define nd_opts_mtu nd_opt_array[ND_OPT_MTU]
Erik Nordmarkadc176c2016-12-02 14:00:08 -0800130#define nd_opts_nonce nd_opt_array[ND_OPT_NONCE]
Alexander Aringbbe5f5c2016-06-15 21:20:25 +0200131#define nd_802154_opts_src_lladdr nd_802154_opt_array[ND_OPT_SOURCE_LL_ADDR]
132#define nd_802154_opts_tgt_lladdr nd_802154_opt_array[ND_OPT_TARGET_LL_ADDR]
David S. Miller30f2a5f2012-07-11 23:26:46 -0700133
134#define NDISC_OPT_SPACE(len) (((len)+2+7)&~7)
135
Alexander Aringf997c552016-06-15 21:20:23 +0200136struct ndisc_options *ndisc_parse_options(const struct net_device *dev,
137 u8 *opt, int opt_len,
Joe Perches3cc818a2013-09-21 10:22:47 -0700138 struct ndisc_options *ndopts);
David S. Miller30f2a5f2012-07-11 23:26:46 -0700139
Alexander Aringcc84b3c2016-06-15 21:20:24 +0200140void __ndisc_fill_addr_option(struct sk_buff *skb, int type, void *data,
141 int data_len, int pad);
142
Alexander Aringf997c552016-06-15 21:20:23 +0200143#define NDISC_OPS_REDIRECT_DATA_SPACE 2
144
145/*
146 * This structure defines the hooks for IPv6 neighbour discovery.
147 * The following hooks can be defined; unless noted otherwise, they are
148 * optional and can be filled with a null pointer.
149 *
150 * int (*is_useropt)(u8 nd_opt_type):
151 * This function is called when IPv6 decide RA userspace options. if
152 * this function returns 1 then the option given by nd_opt_type will
153 * be handled as userspace option additional to the IPv6 options.
154 *
155 * int (*parse_options)(const struct net_device *dev,
156 * struct nd_opt_hdr *nd_opt,
157 * struct ndisc_options *ndopts):
158 * This function is called while parsing ndisc ops and put each position
159 * as pointer into ndopts. If this function return unequal 0, then this
160 * function took care about the ndisc option, if 0 then the IPv6 ndisc
161 * option parser will take care about that option.
162 *
163 * void (*update)(const struct net_device *dev, struct neighbour *n,
164 * u32 flags, u8 icmp6_type,
165 * const struct ndisc_options *ndopts):
166 * This function is called when IPv6 ndisc updates the neighbour cache
167 * entry. Additional options which can be updated may be previously
168 * parsed by parse_opts callback and accessible over ndopts parameter.
169 *
170 * int (*opt_addr_space)(const struct net_device *dev, u8 icmp6_type,
171 * struct neighbour *neigh, u8 *ha_buf,
172 * u8 **ha):
173 * This function is called when the necessary option space will be
174 * calculated before allocating a skb. The parameters neigh, ha_buf
175 * abd ha are available on NDISC_REDIRECT messages only.
176 *
177 * void (*fill_addr_option)(const struct net_device *dev,
178 * struct sk_buff *skb, u8 icmp6_type,
179 * const u8 *ha):
180 * This function is called when the skb will finally fill the option
181 * fields inside skb. NOTE: this callback should fill the option
182 * fields to the skb which are previously indicated by opt_space
183 * parameter. That means the decision to add such option should
184 * not lost between these two callbacks, e.g. protected by interface
185 * up state.
186 *
187 * void (*prefix_rcv_add_addr)(struct net *net, struct net_device *dev,
188 * const struct prefix_info *pinfo,
189 * struct inet6_dev *in6_dev,
190 * struct in6_addr *addr,
191 * int addr_type, u32 addr_flags,
192 * bool sllao, bool tokenized,
193 * __u32 valid_lft, u32 prefered_lft,
194 * bool dev_addr_generated):
195 * This function is called when a RA messages is received with valid
196 * PIO option fields and an IPv6 address will be added to the interface
197 * for autoconfiguration. The parameter dev_addr_generated reports about
198 * if the address was based on dev->dev_addr or not. This can be used
199 * to add a second address if link-layer operates with two link layer
200 * addresses. E.g. 802.15.4 6LoWPAN.
201 */
202struct ndisc_ops {
203 int (*is_useropt)(u8 nd_opt_type);
204 int (*parse_options)(const struct net_device *dev,
205 struct nd_opt_hdr *nd_opt,
206 struct ndisc_options *ndopts);
207 void (*update)(const struct net_device *dev, struct neighbour *n,
208 u32 flags, u8 icmp6_type,
209 const struct ndisc_options *ndopts);
210 int (*opt_addr_space)(const struct net_device *dev, u8 icmp6_type,
211 struct neighbour *neigh, u8 *ha_buf,
212 u8 **ha);
213 void (*fill_addr_option)(const struct net_device *dev,
214 struct sk_buff *skb, u8 icmp6_type,
215 const u8 *ha);
216 void (*prefix_rcv_add_addr)(struct net *net, struct net_device *dev,
217 const struct prefix_info *pinfo,
218 struct inet6_dev *in6_dev,
219 struct in6_addr *addr,
220 int addr_type, u32 addr_flags,
221 bool sllao, bool tokenized,
222 __u32 valid_lft, u32 prefered_lft,
223 bool dev_addr_generated);
224};
225
226#if IS_ENABLED(CONFIG_IPV6)
227static inline int ndisc_ops_is_useropt(const struct net_device *dev,
228 u8 nd_opt_type)
229{
230 if (dev->ndisc_ops && dev->ndisc_ops->is_useropt)
231 return dev->ndisc_ops->is_useropt(nd_opt_type);
232 else
233 return 0;
234}
235
236static inline int ndisc_ops_parse_options(const struct net_device *dev,
237 struct nd_opt_hdr *nd_opt,
238 struct ndisc_options *ndopts)
239{
240 if (dev->ndisc_ops && dev->ndisc_ops->parse_options)
241 return dev->ndisc_ops->parse_options(dev, nd_opt, ndopts);
242 else
243 return 0;
244}
245
246static inline void ndisc_ops_update(const struct net_device *dev,
247 struct neighbour *n, u32 flags,
248 u8 icmp6_type,
249 const struct ndisc_options *ndopts)
250{
251 if (dev->ndisc_ops && dev->ndisc_ops->update)
252 dev->ndisc_ops->update(dev, n, flags, icmp6_type, ndopts);
253}
254
255static inline int ndisc_ops_opt_addr_space(const struct net_device *dev,
256 u8 icmp6_type)
257{
258 if (dev->ndisc_ops && dev->ndisc_ops->opt_addr_space &&
259 icmp6_type != NDISC_REDIRECT)
260 return dev->ndisc_ops->opt_addr_space(dev, icmp6_type, NULL,
261 NULL, NULL);
262 else
263 return 0;
264}
265
266static inline int ndisc_ops_redirect_opt_addr_space(const struct net_device *dev,
267 struct neighbour *neigh,
268 u8 *ha_buf, u8 **ha)
269{
270 if (dev->ndisc_ops && dev->ndisc_ops->opt_addr_space)
271 return dev->ndisc_ops->opt_addr_space(dev, NDISC_REDIRECT,
272 neigh, ha_buf, ha);
273 else
274 return 0;
275}
276
277static inline void ndisc_ops_fill_addr_option(const struct net_device *dev,
278 struct sk_buff *skb,
279 u8 icmp6_type)
280{
281 if (dev->ndisc_ops && dev->ndisc_ops->fill_addr_option &&
282 icmp6_type != NDISC_REDIRECT)
283 dev->ndisc_ops->fill_addr_option(dev, skb, icmp6_type, NULL);
284}
285
286static inline void ndisc_ops_fill_redirect_addr_option(const struct net_device *dev,
287 struct sk_buff *skb,
288 const u8 *ha)
289{
290 if (dev->ndisc_ops && dev->ndisc_ops->fill_addr_option)
291 dev->ndisc_ops->fill_addr_option(dev, skb, NDISC_REDIRECT, ha);
292}
293
294static inline void ndisc_ops_prefix_rcv_add_addr(struct net *net,
295 struct net_device *dev,
296 const struct prefix_info *pinfo,
297 struct inet6_dev *in6_dev,
298 struct in6_addr *addr,
299 int addr_type, u32 addr_flags,
300 bool sllao, bool tokenized,
301 __u32 valid_lft,
302 u32 prefered_lft,
303 bool dev_addr_generated)
304{
305 if (dev->ndisc_ops && dev->ndisc_ops->prefix_rcv_add_addr)
306 dev->ndisc_ops->prefix_rcv_add_addr(net, dev, pinfo, in6_dev,
307 addr, addr_type,
308 addr_flags, sllao,
309 tokenized, valid_lft,
310 prefered_lft,
311 dev_addr_generated);
312}
313#endif
314
David S. Miller30f2a5f2012-07-11 23:26:46 -0700315/*
316 * Return the padding between the option length and the start of the
317 * link addr. Currently only IP-over-InfiniBand needs this, although
318 * if RFC 3831 IPv6-over-Fibre Channel is ever implemented it may
319 * also need a pad of 2.
320 */
Joe Perchesd9d10a32013-07-30 10:31:00 -0700321static inline int ndisc_addr_option_pad(unsigned short type)
David S. Miller30f2a5f2012-07-11 23:26:46 -0700322{
323 switch (type) {
324 case ARPHRD_INFINIBAND: return 2;
325 default: return 0;
326 }
327}
328
Alexander Aring1e82f962016-06-15 21:20:19 +0200329static inline int __ndisc_opt_addr_space(unsigned char addr_len, int pad)
330{
331 return NDISC_OPT_SPACE(addr_len + pad);
332}
333
Alexander Aringf997c552016-06-15 21:20:23 +0200334#if IS_ENABLED(CONFIG_IPV6)
335static inline int ndisc_opt_addr_space(struct net_device *dev, u8 icmp6_type)
YOSHIFUJI Hideaki / 吉藤英明c558e9f2013-01-21 06:47:56 +0000336{
Alexander Aring1e82f962016-06-15 21:20:19 +0200337 return __ndisc_opt_addr_space(dev->addr_len,
Alexander Aringf997c552016-06-15 21:20:23 +0200338 ndisc_addr_option_pad(dev->type)) +
339 ndisc_ops_opt_addr_space(dev, icmp6_type);
YOSHIFUJI Hideaki / 吉藤英明c558e9f2013-01-21 06:47:56 +0000340}
341
Alexander Aringf997c552016-06-15 21:20:23 +0200342static inline int ndisc_redirect_opt_addr_space(struct net_device *dev,
343 struct neighbour *neigh,
344 u8 *ops_data_buf,
345 u8 **ops_data)
346{
347 return __ndisc_opt_addr_space(dev->addr_len,
348 ndisc_addr_option_pad(dev->type)) +
349 ndisc_ops_redirect_opt_addr_space(dev, neigh, ops_data_buf,
350 ops_data);
351}
352#endif
353
Alexander Aring4f36ce82016-06-15 21:20:20 +0200354static inline u8 *__ndisc_opt_addr_data(struct nd_opt_hdr *p,
355 unsigned char addr_len, int prepad)
David S. Miller30f2a5f2012-07-11 23:26:46 -0700356{
357 u8 *lladdr = (u8 *)(p + 1);
358 int lladdrlen = p->nd_opt_len << 3;
Alexander Aring4f36ce82016-06-15 21:20:20 +0200359 if (lladdrlen != __ndisc_opt_addr_space(addr_len, prepad))
David S. Miller30f2a5f2012-07-11 23:26:46 -0700360 return NULL;
361 return lladdr + prepad;
362}
363
Alexander Aring4f36ce82016-06-15 21:20:20 +0200364static inline u8 *ndisc_opt_addr_data(struct nd_opt_hdr *p,
365 struct net_device *dev)
366{
367 return __ndisc_opt_addr_data(p, dev->addr_len,
368 ndisc_addr_option_pad(dev->type));
369}
370
David S. Miller2c2aba62011-12-28 15:06:58 -0500371static inline u32 ndisc_hashfn(const void *pkey, const struct net_device *dev, __u32 *hash_rnd)
372{
373 const u32 *p32 = pkey;
374
Pavel Emelyanovb14f2432012-08-08 21:52:28 +0000375 return (((p32[0] ^ hash32_ptr(dev)) * hash_rnd[0]) +
David S. Miller2c2aba62011-12-28 15:06:58 -0500376 (p32[1] * hash_rnd[1]) +
377 (p32[2] * hash_rnd[2]) +
378 (p32[3] * hash_rnd[3]));
379}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700380
YOSHIFUJI Hideaki / 吉藤英明ac3175f2013-01-17 12:53:22 +0000381static inline struct neighbour *__ipv6_neigh_lookup_noref(struct net_device *dev, const void *pkey)
David S. Millerf83c7792011-12-28 15:41:23 -0500382{
Eric W. Biederman60395a22015-03-03 17:10:44 -0600383 return ___neigh_lookup_noref(&nd_tbl, neigh_key_eq128, ndisc_hashfn, pkey, dev);
YOSHIFUJI Hideaki / 吉藤英明ac3175f2013-01-17 12:53:22 +0000384}
385
David Ahern71df5772019-04-05 16:30:25 -0700386static inline
387struct neighbour *__ipv6_neigh_lookup_noref_stub(struct net_device *dev,
388 const void *pkey)
389{
390 return ___neigh_lookup_noref(ipv6_stub->nd_tbl, neigh_key_eq128,
391 ndisc_hashfn, pkey, dev);
392}
393
YOSHIFUJI Hideaki / 吉藤英明ac3175f2013-01-17 12:53:22 +0000394static inline struct neighbour *__ipv6_neigh_lookup(struct net_device *dev, const void *pkey)
395{
396 struct neighbour *n;
397
398 rcu_read_lock_bh();
399 n = __ipv6_neigh_lookup_noref(dev, pkey);
Reshetova, Elena9f237432017-06-30 13:07:55 +0300400 if (n && !refcount_inc_not_zero(&n->refcnt))
YOSHIFUJI Hideaki / 吉藤英明ac3175f2013-01-17 12:53:22 +0000401 n = NULL;
David S. Millerf83c7792011-12-28 15:41:23 -0500402 rcu_read_unlock_bh();
403
404 return n;
405}
406
Julian Anastasov63fca652017-02-06 23:14:15 +0200407static inline void __ipv6_confirm_neigh(struct net_device *dev,
408 const void *pkey)
409{
410 struct neighbour *n;
411
412 rcu_read_lock_bh();
413 n = __ipv6_neigh_lookup_noref(dev, pkey);
414 if (n) {
415 unsigned long now = jiffies;
416
417 /* avoid dirtying neighbour */
Eric Dumazet25c7a6d2019-11-05 14:11:51 -0800418 if (READ_ONCE(n->confirmed) != now)
419 WRITE_ONCE(n->confirmed, now);
Julian Anastasov63fca652017-02-06 23:14:15 +0200420 }
421 rcu_read_unlock_bh();
422}
423
David Ahern71df5772019-04-05 16:30:25 -0700424static inline void __ipv6_confirm_neigh_stub(struct net_device *dev,
425 const void *pkey)
426{
427 struct neighbour *n;
428
429 rcu_read_lock_bh();
430 n = __ipv6_neigh_lookup_noref_stub(dev, pkey);
431 if (n) {
432 unsigned long now = jiffies;
433
434 /* avoid dirtying neighbour */
Eric Dumazet25c7a6d2019-11-05 14:11:51 -0800435 if (READ_ONCE(n->confirmed) != now)
436 WRITE_ONCE(n->confirmed, now);
David Ahern71df5772019-04-05 16:30:25 -0700437 }
438 rcu_read_unlock_bh();
439}
440
441/* uses ipv6_stub and is meant for use outside of IPv6 core */
442static inline struct neighbour *ip_neigh_gw6(struct net_device *dev,
443 const void *addr)
444{
445 struct neighbour *neigh;
446
447 neigh = __ipv6_neigh_lookup_noref_stub(dev, addr);
448 if (unlikely(!neigh))
449 neigh = __neigh_create(ipv6_stub->nd_tbl, addr, dev, false);
450
451 return neigh;
452}
453
Joe Perches3cc818a2013-09-21 10:22:47 -0700454int ndisc_init(void);
455int ndisc_late_init(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700456
Joe Perches3cc818a2013-09-21 10:22:47 -0700457void ndisc_late_cleanup(void);
458void ndisc_cleanup(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700459
Joe Perches3cc818a2013-09-21 10:22:47 -0700460int ndisc_rcv(struct sk_buff *skb);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700461
Jiri Benc38cf5952015-09-22 18:57:13 +0200462void ndisc_send_ns(struct net_device *dev, const struct in6_addr *solicit,
Erik Nordmarkadc176c2016-12-02 14:00:08 -0800463 const struct in6_addr *daddr, const struct in6_addr *saddr,
464 u64 nonce);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700465
Joe Perches3cc818a2013-09-21 10:22:47 -0700466void ndisc_send_rs(struct net_device *dev,
467 const struct in6_addr *saddr, const struct in6_addr *daddr);
Jiri Benc38cf5952015-09-22 18:57:13 +0200468void ndisc_send_na(struct net_device *dev, const struct in6_addr *daddr,
Joe Perches3cc818a2013-09-21 10:22:47 -0700469 const struct in6_addr *solicited_addr,
470 bool router, bool solicited, bool override, bool inc_opt);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700471
Joe Perches3cc818a2013-09-21 10:22:47 -0700472void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700473
Joe Perches3cc818a2013-09-21 10:22:47 -0700474int ndisc_mc_map(const struct in6_addr *addr, char *buf, struct net_device *dev,
475 int dir);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700476
Alexander Aringf997c552016-06-15 21:20:23 +0200477void ndisc_update(const struct net_device *dev, struct neighbour *neigh,
478 const u8 *lladdr, u8 new, u32 flags, u8 icmp6_type,
479 struct ndisc_options *ndopts);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700480
481/*
482 * IGMP
483 */
Joe Perches3cc818a2013-09-21 10:22:47 -0700484int igmp6_init(void);
Vlad Yasevich382ed722017-03-28 14:49:16 -0400485int igmp6_late_init(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700486
Joe Perches3cc818a2013-09-21 10:22:47 -0700487void igmp6_cleanup(void);
Vlad Yasevich382ed722017-03-28 14:49:16 -0400488void igmp6_late_cleanup(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700489
Joe Perches3cc818a2013-09-21 10:22:47 -0700490int igmp6_event_query(struct sk_buff *skb);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700491
Joe Perches3cc818a2013-09-21 10:22:47 -0700492int igmp6_event_report(struct sk_buff *skb);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700493
Linus Torvalds1da177e2005-04-16 15:20:36 -0700494
495#ifdef CONFIG_SYSCTL
Joe Perches3cc818a2013-09-21 10:22:47 -0700496int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write,
497 void __user *buffer, size_t *lenp, loff_t *ppos);
Joe Perchesfedaf4f2013-06-13 19:37:54 -0700498int ndisc_ifinfo_sysctl_strategy(struct ctl_table *ctl,
Alexey Dobriyanf221e722008-10-15 22:04:23 -0700499 void __user *oldval, size_t __user *oldlenp,
YOSHIFUJI Hideaki0686caa2008-05-19 16:25:42 -0700500 void __user *newval, size_t newlen);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700501#endif
502
Joe Perches3cc818a2013-09-21 10:22:47 -0700503void inet6_ifinfo_notify(int event, struct inet6_dev *idev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700504
Linus Torvalds1da177e2005-04-16 15:20:36 -0700505#endif