diff options
-rw-r--r-- | include/net/ip6_fib.h | 25 | ||||
-rw-r--r-- | net/ipv6/ip6_fib.c | 29 |
2 files changed, 24 insertions, 30 deletions
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index c0660cea9a2f..69c444209781 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -92,28 +92,6 @@ struct fib6_walker_t | |||
92 | void *args; | 92 | void *args; |
93 | }; | 93 | }; |
94 | 94 | ||
95 | extern struct fib6_walker_t fib6_walker_list; | ||
96 | extern rwlock_t fib6_walker_lock; | ||
97 | |||
98 | static inline void fib6_walker_link(struct fib6_walker_t *w) | ||
99 | { | ||
100 | write_lock_bh(&fib6_walker_lock); | ||
101 | w->next = fib6_walker_list.next; | ||
102 | w->prev = &fib6_walker_list; | ||
103 | w->next->prev = w; | ||
104 | w->prev->next = w; | ||
105 | write_unlock_bh(&fib6_walker_lock); | ||
106 | } | ||
107 | |||
108 | static inline void fib6_walker_unlink(struct fib6_walker_t *w) | ||
109 | { | ||
110 | write_lock_bh(&fib6_walker_lock); | ||
111 | w->next->prev = w->prev; | ||
112 | w->prev->next = w->next; | ||
113 | w->prev = w->next = w; | ||
114 | write_unlock_bh(&fib6_walker_lock); | ||
115 | } | ||
116 | |||
117 | struct rt6_statistics { | 95 | struct rt6_statistics { |
118 | __u32 fib_nodes; | 96 | __u32 fib_nodes; |
119 | __u32 fib_route_nodes; | 97 | __u32 fib_route_nodes; |
@@ -195,9 +173,6 @@ struct fib6_node *fib6_locate(struct fib6_node *root, | |||
195 | extern void fib6_clean_all(int (*func)(struct rt6_info *, void *arg), | 173 | extern void fib6_clean_all(int (*func)(struct rt6_info *, void *arg), |
196 | int prune, void *arg); | 174 | int prune, void *arg); |
197 | 175 | ||
198 | extern int fib6_walk(struct fib6_walker_t *w); | ||
199 | extern int fib6_walk_continue(struct fib6_walker_t *w); | ||
200 | |||
201 | extern int fib6_add(struct fib6_node *root, | 176 | extern int fib6_add(struct fib6_node *root, |
202 | struct rt6_info *rt, | 177 | struct rt6_info *rt, |
203 | struct nlmsghdr *nlh, | 178 | struct nlmsghdr *nlh, |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index bececbe9dd2c..be36f4acda94 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -69,8 +69,7 @@ struct fib6_cleaner_t | |||
69 | void *arg; | 69 | void *arg; |
70 | }; | 70 | }; |
71 | 71 | ||
72 | DEFINE_RWLOCK(fib6_walker_lock); | 72 | static DEFINE_RWLOCK(fib6_walker_lock); |
73 | |||
74 | 73 | ||
75 | #ifdef CONFIG_IPV6_SUBTREES | 74 | #ifdef CONFIG_IPV6_SUBTREES |
76 | #define FWS_INIT FWS_S | 75 | #define FWS_INIT FWS_S |
@@ -82,6 +81,8 @@ DEFINE_RWLOCK(fib6_walker_lock); | |||
82 | 81 | ||
83 | static void fib6_prune_clones(struct fib6_node *fn, struct rt6_info *rt); | 82 | static void fib6_prune_clones(struct fib6_node *fn, struct rt6_info *rt); |
84 | static struct fib6_node * fib6_repair_tree(struct fib6_node *fn); | 83 | static struct fib6_node * fib6_repair_tree(struct fib6_node *fn); |
84 | static int fib6_walk(struct fib6_walker_t *w); | ||
85 | static int fib6_walk_continue(struct fib6_walker_t *w); | ||
85 | 86 | ||
86 | /* | 87 | /* |
87 | * A routing update causes an increase of the serial number on the | 88 | * A routing update causes an increase of the serial number on the |
@@ -94,13 +95,31 @@ static __u32 rt_sernum; | |||
94 | 95 | ||
95 | static DEFINE_TIMER(ip6_fib_timer, fib6_run_gc, 0, 0); | 96 | static DEFINE_TIMER(ip6_fib_timer, fib6_run_gc, 0, 0); |
96 | 97 | ||
97 | struct fib6_walker_t fib6_walker_list = { | 98 | static struct fib6_walker_t fib6_walker_list = { |
98 | .prev = &fib6_walker_list, | 99 | .prev = &fib6_walker_list, |
99 | .next = &fib6_walker_list, | 100 | .next = &fib6_walker_list, |
100 | }; | 101 | }; |
101 | 102 | ||
102 | #define FOR_WALKERS(w) for ((w)=fib6_walker_list.next; (w) != &fib6_walker_list; (w)=(w)->next) | 103 | #define FOR_WALKERS(w) for ((w)=fib6_walker_list.next; (w) != &fib6_walker_list; (w)=(w)->next) |
103 | 104 | ||
105 | static inline void fib6_walker_link(struct fib6_walker_t *w) | ||
106 | { | ||
107 | write_lock_bh(&fib6_walker_lock); | ||
108 | w->next = fib6_walker_list.next; | ||
109 | w->prev = &fib6_walker_list; | ||
110 | w->next->prev = w; | ||
111 | w->prev->next = w; | ||
112 | write_unlock_bh(&fib6_walker_lock); | ||
113 | } | ||
114 | |||
115 | static inline void fib6_walker_unlink(struct fib6_walker_t *w) | ||
116 | { | ||
117 | write_lock_bh(&fib6_walker_lock); | ||
118 | w->next->prev = w->prev; | ||
119 | w->prev->next = w->next; | ||
120 | w->prev = w->next = w; | ||
121 | write_unlock_bh(&fib6_walker_lock); | ||
122 | } | ||
104 | static __inline__ u32 fib6_new_sernum(void) | 123 | static __inline__ u32 fib6_new_sernum(void) |
105 | { | 124 | { |
106 | u32 n = ++rt_sernum; | 125 | u32 n = ++rt_sernum; |
@@ -1173,7 +1192,7 @@ int fib6_del(struct rt6_info *rt, struct nlmsghdr *nlh, void *_rtattr, struct ne | |||
1173 | * <0 -> walk is terminated by an error. | 1192 | * <0 -> walk is terminated by an error. |
1174 | */ | 1193 | */ |
1175 | 1194 | ||
1176 | int fib6_walk_continue(struct fib6_walker_t *w) | 1195 | static int fib6_walk_continue(struct fib6_walker_t *w) |
1177 | { | 1196 | { |
1178 | struct fib6_node *fn, *pn; | 1197 | struct fib6_node *fn, *pn; |
1179 | 1198 | ||
@@ -1247,7 +1266,7 @@ int fib6_walk_continue(struct fib6_walker_t *w) | |||
1247 | } | 1266 | } |
1248 | } | 1267 | } |
1249 | 1268 | ||
1250 | int fib6_walk(struct fib6_walker_t *w) | 1269 | static int fib6_walk(struct fib6_walker_t *w) |
1251 | { | 1270 | { |
1252 | int res; | 1271 | int res; |
1253 | 1272 | ||