aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/ip6_fib.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/net/ip6_fib.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/net/ip6_fib.h')
-rw-r--r--include/net/ip6_fib.h185
1 files changed, 185 insertions, 0 deletions
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
new file mode 100644
index 000000000000..319904518194
--- /dev/null
+++ b/include/net/ip6_fib.h
@@ -0,0 +1,185 @@
1/*
2 * Linux INET6 implementation
3 *
4 * Authors:
5 * Pedro Roque <roque@di.fc.ul.pt>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#ifndef _IP6_FIB_H
14#define _IP6_FIB_H
15
16#ifdef __KERNEL__
17
18#include <linux/ipv6_route.h>
19
20#include <net/dst.h>
21#include <net/flow.h>
22#include <linux/rtnetlink.h>
23#include <linux/spinlock.h>
24
25struct rt6_info;
26
27struct fib6_node
28{
29 struct fib6_node *parent;
30 struct fib6_node *left;
31 struct fib6_node *right;
32
33 struct fib6_node *subtree;
34
35 struct rt6_info *leaf;
36
37 __u16 fn_bit; /* bit key */
38 __u16 fn_flags;
39 __u32 fn_sernum;
40};
41
42
43/*
44 * routing information
45 *
46 */
47
48struct rt6key
49{
50 struct in6_addr addr;
51 int plen;
52};
53
54struct rt6_info
55{
56 union {
57 struct dst_entry dst;
58 struct rt6_info *next;
59 } u;
60
61 struct inet6_dev *rt6i_idev;
62
63#define rt6i_dev u.dst.dev
64#define rt6i_nexthop u.dst.neighbour
65#define rt6i_expires u.dst.expires
66
67 struct fib6_node *rt6i_node;
68
69 struct in6_addr rt6i_gateway;
70
71 u32 rt6i_flags;
72 u32 rt6i_metric;
73 atomic_t rt6i_ref;
74
75 struct rt6key rt6i_dst;
76 struct rt6key rt6i_src;
77
78 u8 rt6i_protocol;
79};
80
81struct fib6_walker_t
82{
83 struct fib6_walker_t *prev, *next;
84 struct fib6_node *root, *node;
85 struct rt6_info *leaf;
86 unsigned char state;
87 unsigned char prune;
88 int (*func)(struct fib6_walker_t *);
89 void *args;
90};
91
92extern struct fib6_walker_t fib6_walker_list;
93extern rwlock_t fib6_walker_lock;
94
95static inline void fib6_walker_link(struct fib6_walker_t *w)
96{
97 write_lock_bh(&fib6_walker_lock);
98 w->next = fib6_walker_list.next;
99 w->prev = &fib6_walker_list;
100 w->next->prev = w;
101 w->prev->next = w;
102 write_unlock_bh(&fib6_walker_lock);
103}
104
105static inline void fib6_walker_unlink(struct fib6_walker_t *w)
106{
107 write_lock_bh(&fib6_walker_lock);
108 w->next->prev = w->prev;
109 w->prev->next = w->next;
110 w->prev = w->next = w;
111 write_unlock_bh(&fib6_walker_lock);
112}
113
114struct rt6_statistics {
115 __u32 fib_nodes;
116 __u32 fib_route_nodes;
117 __u32 fib_rt_alloc; /* permanent routes */
118 __u32 fib_rt_entries; /* rt entries in table */
119 __u32 fib_rt_cache; /* cache routes */
120 __u32 fib_discarded_routes;
121};
122
123#define RTN_TL_ROOT 0x0001
124#define RTN_ROOT 0x0002 /* tree root node */
125#define RTN_RTINFO 0x0004 /* node with valid routing info */
126
127/*
128 * priority levels (or metrics)
129 *
130 */
131
132#define RTPRI_FIREWALL 8 /* Firewall control information */
133#define RTPRI_FLOW 16 /* Flow based forwarding rules */
134#define RTPRI_KERN_CTL 32 /* Kernel control routes */
135
136#define RTPRI_USER_MIN 256 /* Mimimum user priority */
137#define RTPRI_USER_MAX 1024 /* Maximum user priority */
138
139#define RTPRI_KERN_DFLT 4096 /* Kernel default routes */
140
141#define MAX_FLOW_BACKTRACE 32
142
143
144typedef void (*f_pnode)(struct fib6_node *fn, void *);
145
146extern struct fib6_node ip6_routing_table;
147
148/*
149 * exported functions
150 */
151
152extern struct fib6_node *fib6_lookup(struct fib6_node *root,
153 struct in6_addr *daddr,
154 struct in6_addr *saddr);
155
156struct fib6_node *fib6_locate(struct fib6_node *root,
157 struct in6_addr *daddr, int dst_len,
158 struct in6_addr *saddr, int src_len);
159
160extern void fib6_clean_tree(struct fib6_node *root,
161 int (*func)(struct rt6_info *, void *arg),
162 int prune, void *arg);
163
164extern int fib6_walk(struct fib6_walker_t *w);
165extern int fib6_walk_continue(struct fib6_walker_t *w);
166
167extern int fib6_add(struct fib6_node *root,
168 struct rt6_info *rt,
169 struct nlmsghdr *nlh,
170 void *rtattr);
171
172extern int fib6_del(struct rt6_info *rt,
173 struct nlmsghdr *nlh,
174 void *rtattr);
175
176extern void inet6_rt_notify(int event, struct rt6_info *rt,
177 struct nlmsghdr *nlh);
178
179extern void fib6_run_gc(unsigned long dummy);
180
181extern void fib6_gc_cleanup(void);
182
183extern void fib6_init(void);
184#endif
185#endif