1 #ifndef _NET_IP6_ROUTE_H
2 #define _NET_IP6_ROUTE_H
3 
4 #define IP6_RT_PRIO_FW		16
5 #define IP6_RT_PRIO_USER	1024
6 #define IP6_RT_PRIO_ADDRCONF	256
7 #define IP6_RT_PRIO_KERN	512
8 #define IP6_RT_FLOW_MASK	0x00ff
9 
10 #ifdef __KERNEL__
11 
12 #include <net/flow.h>
13 #include <net/ip6_fib.h>
14 
15 struct pol_chain {
16 	int			type;
17 	int			priority;
18 	struct fib6_node	*rules;
19 	struct pol_chain	*next;
20 };
21 
22 extern struct rt6_info	ip6_null_entry;
23 
24 extern int ip6_rt_max_size;
25 extern int ip6_rt_gc_min;
26 extern int ip6_rt_gc_timeout;
27 extern int ip6_rt_gc_interval;
28 
29 extern void			ip6_route_input(struct sk_buff *skb);
30 
31 extern struct dst_entry *	ip6_route_output(struct sock *sk,
32 						 struct flowi *fl);
33 
34 extern int			ip6_route_me_harder(struct sk_buff *skb);
35 
36 extern void			ip6_route_init(void);
37 extern void			ip6_route_cleanup(void);
38 
39 extern int			ipv6_route_ioctl(unsigned int cmd, void *arg);
40 
41 extern int			ip6_route_add(struct in6_rtmsg *rtmsg,
42 					      struct nlmsghdr *,
43 					      struct netlink_skb_parms *req);
44 extern int			ip6_del_rt(struct rt6_info *,
45 					   struct nlmsghdr *,
46 					   struct netlink_skb_parms *req);
47 
48 extern int			ip6_rt_addr_add(struct in6_addr *addr,
49 						struct net_device *dev);
50 
51 extern int			ip6_rt_addr_del(struct in6_addr *addr,
52 						struct net_device *dev);
53 
54 extern void			rt6_sndmsg(int type, struct in6_addr *dst,
55 					   struct in6_addr *src,
56 					   struct in6_addr *gw,
57 					   struct net_device *dev,
58 					   int dstlen, int srclen,
59 					   int metric, __u32 flags);
60 
61 extern struct rt6_info		*rt6_lookup(struct in6_addr *daddr,
62 					    struct in6_addr *saddr,
63 					    int oif, int flags);
64 
65 /*
66  *	support functions for ND
67  *
68  */
69 extern struct rt6_info *	rt6_get_dflt_router(struct in6_addr *addr,
70 						    struct net_device *dev);
71 extern struct rt6_info *	rt6_add_dflt_router(struct in6_addr *gwaddr,
72 						    struct net_device *dev);
73 
74 extern void			rt6_purge_dflt_routers(int lst_resort);
75 
76 extern void			rt6_redirect(struct in6_addr *dest,
77 					     struct in6_addr *saddr,
78 					     struct neighbour *neigh,
79 					     int on_link);
80 
81 extern void			rt6_pmtu_discovery(struct in6_addr *daddr,
82 						   struct in6_addr *saddr,
83 						   struct net_device *dev,
84 						   u32 pmtu);
85 
86 struct nlmsghdr;
87 struct netlink_callback;
88 extern int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb);
89 extern int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
90 extern int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
91 extern int inet6_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
92 
93 extern void rt6_ifdown(struct net_device *dev);
94 extern void rt6_mtu_change(struct net_device *dev, unsigned mtu);
95 
96 extern rwlock_t rt6_lock;
97 
98 /*
99  *	Store a destination cache entry in a socket
100  *	For UDP/RAW sockets this is done on udp_connect.
101  */
102 
ip6_dst_store(struct sock * sk,struct dst_entry * dst,struct in6_addr * daddr)103 static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst,
104 				     struct in6_addr *daddr)
105 {
106 	struct ipv6_pinfo *np = &sk->net_pinfo.af_inet6;
107 	struct rt6_info *rt = (struct rt6_info *) dst;
108 
109 	write_lock(&sk->dst_lock);
110 	__sk_dst_set(sk, dst);
111 	np->daddr_cache = daddr;
112 	np->dst_cookie = rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0;
113 	write_unlock(&sk->dst_lock);
114 }
115 
116 #endif
117 #endif
118