diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/ip6_fib.c | 29 |
1 files changed, 24 insertions, 5 deletions
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 | ||