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