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