blob: 59b70624b0563fdc93ecfbc25291a7845502d117 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _NDISC_H
2#define _NDISC_H
3
4/*
5 * ICMP codes for neighbour discovery messages
6 */
7
8#define NDISC_ROUTER_SOLICITATION 133
9#define NDISC_ROUTER_ADVERTISEMENT 134
10#define NDISC_NEIGHBOUR_SOLICITATION 135
11#define NDISC_NEIGHBOUR_ADVERTISEMENT 136
12#define NDISC_REDIRECT 137
13
14/*
15 * ndisc options
16 */
17
18enum {
19 __ND_OPT_PREFIX_INFO_END = 0,
20 ND_OPT_SOURCE_LL_ADDR = 1, /* RFC2461 */
21 ND_OPT_TARGET_LL_ADDR = 2, /* RFC2461 */
22 ND_OPT_PREFIX_INFO = 3, /* RFC2461 */
23 ND_OPT_REDIRECT_HDR = 4, /* RFC2461 */
24 ND_OPT_MTU = 5, /* RFC2461 */
YOSHIFUJI Hideaki70ceb4f2006-03-20 17:06:24 -080025 __ND_OPT_ARRAY_MAX,
26 ND_OPT_ROUTE_INFO = 24, /* RFC4191 */
Pierre Ynard31910572007-10-10 21:22:05 -070027 ND_OPT_RDNSS = 25, /* RFC5006 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070028 __ND_OPT_MAX
29};
30
31#define MAX_RTR_SOLICITATION_DELAY HZ
32
33#define ND_REACHABLE_TIME (30*HZ)
34#define ND_RETRANS_TIMER HZ
35
36#define ND_MIN_RANDOM_FACTOR (1/2)
37#define ND_MAX_RANDOM_FACTOR (3/2)
38
39#ifdef __KERNEL__
40
Arnaldo Carvalho de Melo14c85022005-12-27 02:43:12 -020041#include <linux/compiler.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070042#include <linux/icmpv6.h>
Arnaldo Carvalho de Melo14c85022005-12-27 02:43:12 -020043#include <linux/in6.h>
44#include <linux/types.h>
45
Linus Torvalds1da177e2005-04-16 15:20:36 -070046#include <net/neighbour.h>
Arnaldo Carvalho de Melo14c85022005-12-27 02:43:12 -020047
48struct ctl_table;
49struct file;
50struct inet6_dev;
51struct net_device;
52struct net_proto_family;
53struct sk_buff;
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
55extern struct neigh_table nd_tbl;
56
57struct nd_msg {
58 struct icmp6hdr icmph;
59 struct in6_addr target;
60 __u8 opt[0];
61};
62
63struct rs_msg {
64 struct icmp6hdr icmph;
65 __u8 opt[0];
66};
67
68struct ra_msg {
69 struct icmp6hdr icmph;
Al Viroe69a4adc2006-11-14 20:56:00 -080070 __be32 reachable_time;
71 __be32 retrans_timer;
Linus Torvalds1da177e2005-04-16 15:20:36 -070072};
73
74struct nd_opt_hdr {
75 __u8 nd_opt_type;
76 __u8 nd_opt_len;
77} __attribute__((__packed__));
78
79
80extern int ndisc_init(struct net_proto_family *ops);
81
82extern void ndisc_cleanup(void);
83
84extern int ndisc_rcv(struct sk_buff *skb);
85
86extern void ndisc_send_ns(struct net_device *dev,
87 struct neighbour *neigh,
88 struct in6_addr *solicit,
89 struct in6_addr *daddr,
90 struct in6_addr *saddr);
91
92extern void ndisc_send_rs(struct net_device *dev,
93 struct in6_addr *saddr,
94 struct in6_addr *daddr);
95
96extern void ndisc_forwarding_on(void);
97extern void ndisc_forwarding_off(void);
98
99extern void ndisc_send_redirect(struct sk_buff *skb,
100 struct neighbour *neigh,
101 struct in6_addr *target);
102
103extern int ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int dir);
104
105
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106
107/*
108 * IGMP
109 */
110extern int igmp6_init(struct net_proto_family *ops);
111
112extern void igmp6_cleanup(void);
113
114extern int igmp6_event_query(struct sk_buff *skb);
115
116extern int igmp6_event_report(struct sk_buff *skb);
117
118extern void igmp6_cleanup(void);
119
120#ifdef CONFIG_SYSCTL
Arnaldo Carvalho de Melo14c85022005-12-27 02:43:12 -0200121extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122 int write,
123 struct file * filp,
124 void __user *buffer,
125 size_t *lenp,
126 loff_t *ppos);
127#endif
128
129extern void inet6_ifinfo_notify(int event,
130 struct inet6_dev *idev);
131
132static inline struct neighbour * ndisc_get_neigh(struct net_device *dev, struct in6_addr *addr)
133{
134
135 if (dev)
136 return __neigh_lookup(&nd_tbl, addr, dev, 1);
137
138 return NULL;
139}
140
141
142#endif /* __KERNEL__ */
143
144
145#endif