aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/neighbour.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/neighbour.h')
-rw-r--r--include/net/neighbour.h25
1 files changed, 11 insertions, 14 deletions
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index a4f26187fc1a..ebbfb509822e 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -26,6 +26,10 @@
26#include <linux/sysctl.h> 26#include <linux/sysctl.h>
27#include <net/rtnetlink.h> 27#include <net/rtnetlink.h>
28 28
29/*
30 * NUD stands for "neighbor unreachability detection"
31 */
32
29#define NUD_IN_TIMER (NUD_INCOMPLETE|NUD_REACHABLE|NUD_DELAY|NUD_PROBE) 33#define NUD_IN_TIMER (NUD_INCOMPLETE|NUD_REACHABLE|NUD_DELAY|NUD_PROBE)
30#define NUD_VALID (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY) 34#define NUD_VALID (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY)
31#define NUD_CONNECTED (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE) 35#define NUD_CONNECTED (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE)
@@ -34,6 +38,7 @@ struct neighbour;
34 38
35struct neigh_parms 39struct neigh_parms
36{ 40{
41 struct net *net;
37 struct net_device *dev; 42 struct net_device *dev;
38 struct neigh_parms *next; 43 struct neigh_parms *next;
39 int (*neigh_setup)(struct neighbour *); 44 int (*neigh_setup)(struct neighbour *);
@@ -126,7 +131,8 @@ struct neigh_ops
126struct pneigh_entry 131struct pneigh_entry
127{ 132{
128 struct pneigh_entry *next; 133 struct pneigh_entry *next;
129 struct net_device *dev; 134 struct net *net;
135 struct net_device *dev;
130 u8 flags; 136 u8 flags;
131 u8 key[0]; 137 u8 key[0];
132}; 138};
@@ -187,6 +193,7 @@ extern struct neighbour * neigh_lookup(struct neigh_table *tbl,
187 const void *pkey, 193 const void *pkey,
188 struct net_device *dev); 194 struct net_device *dev);
189extern struct neighbour * neigh_lookup_nodev(struct neigh_table *tbl, 195extern struct neighbour * neigh_lookup_nodev(struct neigh_table *tbl,
196 struct net *net,
190 const void *pkey); 197 const void *pkey);
191extern struct neighbour * neigh_create(struct neigh_table *tbl, 198extern struct neighbour * neigh_create(struct neigh_table *tbl,
192 const void *pkey, 199 const void *pkey,
@@ -206,13 +213,12 @@ extern struct neighbour *neigh_event_ns(struct neigh_table *tbl,
206 213
207extern struct neigh_parms *neigh_parms_alloc(struct net_device *dev, struct neigh_table *tbl); 214extern struct neigh_parms *neigh_parms_alloc(struct net_device *dev, struct neigh_table *tbl);
208extern void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms); 215extern void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms);
209extern void neigh_parms_destroy(struct neigh_parms *parms);
210extern unsigned long neigh_rand_reach_time(unsigned long base); 216extern unsigned long neigh_rand_reach_time(unsigned long base);
211 217
212extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p, 218extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p,
213 struct sk_buff *skb); 219 struct sk_buff *skb);
214extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, const void *key, struct net_device *dev, int creat); 220extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, struct net *net, const void *key, struct net_device *dev, int creat);
215extern int pneigh_delete(struct neigh_table *tbl, const void *key, struct net_device *dev); 221extern int pneigh_delete(struct neigh_table *tbl, struct net *net, const void *key, struct net_device *dev);
216 222
217extern void neigh_app_ns(struct neighbour *n); 223extern void neigh_app_ns(struct neighbour *n);
218extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie); 224extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie);
@@ -220,6 +226,7 @@ extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct n
220extern void pneigh_for_each(struct neigh_table *tbl, void (*cb)(struct pneigh_entry *)); 226extern void pneigh_for_each(struct neigh_table *tbl, void (*cb)(struct pneigh_entry *));
221 227
222struct neigh_seq_state { 228struct neigh_seq_state {
229 struct seq_net_private p;
223 struct neigh_table *tbl; 230 struct neigh_table *tbl;
224 void *(*neigh_sub_iter)(struct neigh_seq_state *state, 231 void *(*neigh_sub_iter)(struct neigh_seq_state *state,
225 struct neighbour *n, loff_t *pos); 232 struct neighbour *n, loff_t *pos);
@@ -246,12 +253,6 @@ static inline void __neigh_parms_put(struct neigh_parms *parms)
246 atomic_dec(&parms->refcnt); 253 atomic_dec(&parms->refcnt);
247} 254}
248 255
249static inline void neigh_parms_put(struct neigh_parms *parms)
250{
251 if (atomic_dec_and_test(&parms->refcnt))
252 neigh_parms_destroy(parms);
253}
254
255static inline struct neigh_parms *neigh_parms_clone(struct neigh_parms *parms) 256static inline struct neigh_parms *neigh_parms_clone(struct neigh_parms *parms)
256{ 257{
257 atomic_inc(&parms->refcnt); 258 atomic_inc(&parms->refcnt);
@@ -288,10 +289,6 @@ static inline int neigh_is_connected(struct neighbour *neigh)
288 return neigh->nud_state&NUD_CONNECTED; 289 return neigh->nud_state&NUD_CONNECTED;
289} 290}
290 291
291static inline int neigh_is_valid(struct neighbour *neigh)
292{
293 return neigh->nud_state&NUD_VALID;
294}
295 292
296static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) 293static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
297{ 294{