diff options
Diffstat (limited to 'include/net/ip6_fib.h')
-rw-r--r-- | include/net/ip6_fib.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index b26bb8101981..0ae759a6c76e 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -123,6 +123,54 @@ static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) | |||
123 | return ((struct rt6_info *)dst)->rt6i_idev; | 123 | return ((struct rt6_info *)dst)->rt6i_idev; |
124 | } | 124 | } |
125 | 125 | ||
126 | static inline void rt6_clean_expires(struct rt6_info *rt) | ||
127 | { | ||
128 | if (!(rt->rt6i_flags & RTF_EXPIRES) && rt->dst.from) | ||
129 | dst_release(rt->dst.from); | ||
130 | |||
131 | rt->rt6i_flags &= ~RTF_EXPIRES; | ||
132 | rt->dst.from = NULL; | ||
133 | } | ||
134 | |||
135 | static inline void rt6_set_expires(struct rt6_info *rt, unsigned long expires) | ||
136 | { | ||
137 | if (!(rt->rt6i_flags & RTF_EXPIRES) && rt->dst.from) | ||
138 | dst_release(rt->dst.from); | ||
139 | |||
140 | rt->rt6i_flags |= RTF_EXPIRES; | ||
141 | rt->dst.expires = expires; | ||
142 | } | ||
143 | |||
144 | static inline void rt6_update_expires(struct rt6_info *rt, int timeout) | ||
145 | { | ||
146 | if (!(rt->rt6i_flags & RTF_EXPIRES)) { | ||
147 | if (rt->dst.from) | ||
148 | dst_release(rt->dst.from); | ||
149 | /* dst_set_expires relies on expires == 0 | ||
150 | * if it has not been set previously. | ||
151 | */ | ||
152 | rt->dst.expires = 0; | ||
153 | } | ||
154 | |||
155 | dst_set_expires(&rt->dst, timeout); | ||
156 | rt->rt6i_flags |= RTF_EXPIRES; | ||
157 | } | ||
158 | |||
159 | static inline void rt6_set_from(struct rt6_info *rt, struct rt6_info *from) | ||
160 | { | ||
161 | struct dst_entry *new = (struct dst_entry *) from; | ||
162 | |||
163 | if (!(rt->rt6i_flags & RTF_EXPIRES) && rt->dst.from) { | ||
164 | if (new == rt->dst.from) | ||
165 | return; | ||
166 | dst_release(rt->dst.from); | ||
167 | } | ||
168 | |||
169 | rt->rt6i_flags &= ~RTF_EXPIRES; | ||
170 | rt->dst.from = new; | ||
171 | dst_hold(new); | ||
172 | } | ||
173 | |||
126 | struct fib6_walker_t { | 174 | struct fib6_walker_t { |
127 | struct list_head lh; | 175 | struct list_head lh; |
128 | struct fib6_node *root, *node; | 176 | struct fib6_node *root, *node; |