aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/net/dst.h6
-rw-r--r--include/net/ip6_fib.h42
2 files changed, 47 insertions, 1 deletions
diff --git a/include/net/dst.h b/include/net/dst.h
index 59c5d18cc385..ff4da42fcfc6 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -36,7 +36,11 @@ struct dst_entry {
36 struct net_device *dev; 36 struct net_device *dev;
37 struct dst_ops *ops; 37 struct dst_ops *ops;
38 unsigned long _metrics; 38 unsigned long _metrics;
39 unsigned long expires; 39 union {
40 unsigned long expires;
41 /* point to where the dst_entry copied from */
42 struct dst_entry *from;
43 };
40 struct dst_entry *path; 44 struct dst_entry *path;
41 struct neighbour __rcu *_neighbour; 45 struct neighbour __rcu *_neighbour;
42#ifdef CONFIG_XFRM 46#ifdef CONFIG_XFRM
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index b26bb8101981..c64778fd5e13 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -123,6 +123,48 @@ 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
126static 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.expires = 0;
133}
134
135static 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
144static inline void rt6_update_expires(struct rt6_info *rt, int timeout)
145{
146 if (!(rt->rt6i_flags & RTF_EXPIRES) && rt->dst.from)
147 dst_release(rt->dst.from);
148
149 dst_set_expires(&rt->dst, timeout);
150 rt->rt6i_flags |= RTF_EXPIRES;
151}
152
153static inline void rt6_set_from(struct rt6_info *rt, struct rt6_info *from)
154{
155 struct dst_entry *new = (struct dst_entry *) from;
156
157 if (!(rt->rt6i_flags & RTF_EXPIRES) && rt->dst.from) {
158 if (new == rt->dst.from)
159 return;
160 dst_release(rt->dst.from);
161 }
162
163 rt->rt6i_flags &= ~RTF_EXPIRES;
164 rt->dst.from = new;
165 dst_hold(new);
166}
167
126struct fib6_walker_t { 168struct fib6_walker_t {
127 struct list_head lh; 169 struct list_head lh;
128 struct fib6_node *root, *node; 170 struct fib6_node *root, *node;