Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
[linux-2.6] / include / net / ndisc.h
1 #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
18 enum {
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 */
25         __ND_OPT_ARRAY_MAX,
26         ND_OPT_ROUTE_INFO = 24,         /* RFC4191 */
27         __ND_OPT_MAX
28 };
29
30 #define MAX_RTR_SOLICITATION_DELAY      HZ
31
32 #define ND_REACHABLE_TIME               (30*HZ)
33 #define ND_RETRANS_TIMER                HZ
34
35 #define ND_MIN_RANDOM_FACTOR            (1/2)
36 #define ND_MAX_RANDOM_FACTOR            (3/2)
37
38 #ifdef __KERNEL__
39
40 #include <linux/compiler.h>
41 #include <linux/icmpv6.h>
42 #include <linux/in6.h>
43 #include <linux/types.h>
44
45 #include <net/neighbour.h>
46
47 struct ctl_table;
48 struct file;
49 struct inet6_dev;
50 struct net_device;
51 struct net_proto_family;
52 struct sk_buff;
53
54 extern struct neigh_table nd_tbl;
55
56 struct nd_msg {
57         struct icmp6hdr icmph;
58         struct in6_addr target;
59         __u8            opt[0];
60 };
61
62 struct rs_msg {
63         struct icmp6hdr icmph;
64         __u8            opt[0];
65 };
66
67 struct ra_msg {
68         struct icmp6hdr         icmph;
69         __be32                  reachable_time;
70         __be32                  retrans_timer;
71 };
72
73 struct nd_opt_hdr {
74         __u8            nd_opt_type;
75         __u8            nd_opt_len;
76 } __attribute__((__packed__));
77
78
79 extern int                      ndisc_init(struct net_proto_family *ops);
80
81 extern void                     ndisc_cleanup(void);
82
83 extern int                      ndisc_rcv(struct sk_buff *skb);
84
85 extern void                     ndisc_send_ns(struct net_device *dev,
86                                               struct neighbour *neigh,
87                                               struct in6_addr *solicit,
88                                               struct in6_addr *daddr,
89                                               struct in6_addr *saddr);
90
91 extern void                     ndisc_send_rs(struct net_device *dev,
92                                               struct in6_addr *saddr,
93                                               struct in6_addr *daddr);
94
95 extern void                     ndisc_forwarding_on(void);
96 extern void                     ndisc_forwarding_off(void);
97
98 extern void                     ndisc_send_redirect(struct sk_buff *skb,
99                                                     struct neighbour *neigh,
100                                                     struct in6_addr *target);
101
102 extern int                      ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int dir);
103
104
105 struct rt6_info *               dflt_rt_lookup(void);
106
107 /*
108  *      IGMP
109  */
110 extern int                      igmp6_init(struct net_proto_family *ops);
111
112 extern void                     igmp6_cleanup(void);
113
114 extern int                      igmp6_event_query(struct sk_buff *skb);
115
116 extern int                      igmp6_event_report(struct sk_buff *skb);
117
118 extern void                     igmp6_cleanup(void);
119
120 #ifdef CONFIG_SYSCTL
121 extern int                      ndisc_ifinfo_sysctl_change(struct ctl_table *ctl,
122                                                            int write,
123                                                            struct file * filp,
124                                                            void __user *buffer,
125                                                            size_t *lenp,
126                                                            loff_t *ppos);
127 #endif
128
129 extern void                     inet6_ifinfo_notify(int event,
130                                                     struct inet6_dev *idev);
131
132 static 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