diff options
Diffstat (limited to 'include/net/neighbour.h')
| -rw-r--r-- | include/net/neighbour.h | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 64a5f0120b52..dc420fecafb9 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
| @@ -38,7 +38,9 @@ struct neighbour; | |||
| 38 | 38 | ||
| 39 | struct neigh_parms | 39 | struct neigh_parms |
| 40 | { | 40 | { |
| 41 | #ifdef CONFIG_NET_NS | ||
| 41 | struct net *net; | 42 | struct net *net; |
| 43 | #endif | ||
| 42 | struct net_device *dev; | 44 | struct net_device *dev; |
| 43 | struct neigh_parms *next; | 45 | struct neigh_parms *next; |
| 44 | int (*neigh_setup)(struct neighbour *); | 46 | int (*neigh_setup)(struct neighbour *); |
| @@ -131,7 +133,9 @@ struct neigh_ops | |||
| 131 | struct pneigh_entry | 133 | struct pneigh_entry |
| 132 | { | 134 | { |
| 133 | struct pneigh_entry *next; | 135 | struct pneigh_entry *next; |
| 136 | #ifdef CONFIG_NET_NS | ||
| 134 | struct net *net; | 137 | struct net *net; |
| 138 | #endif | ||
| 135 | struct net_device *dev; | 139 | struct net_device *dev; |
| 136 | u8 flags; | 140 | u8 flags; |
| 137 | u8 key[0]; | 141 | u8 key[0]; |
| @@ -213,6 +217,17 @@ extern struct neighbour *neigh_event_ns(struct neigh_table *tbl, | |||
| 213 | 217 | ||
| 214 | extern struct neigh_parms *neigh_parms_alloc(struct net_device *dev, struct neigh_table *tbl); | 218 | extern struct neigh_parms *neigh_parms_alloc(struct net_device *dev, struct neigh_table *tbl); |
| 215 | extern void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms); | 219 | extern void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms); |
| 220 | |||
| 221 | static inline | ||
| 222 | struct net *neigh_parms_net(const struct neigh_parms *parms) | ||
| 223 | { | ||
| 224 | #ifdef CONFIG_NET_NS | ||
| 225 | return parms->net; | ||
| 226 | #else | ||
| 227 | return &init_net; | ||
| 228 | #endif | ||
| 229 | } | ||
| 230 | |||
| 216 | extern unsigned long neigh_rand_reach_time(unsigned long base); | 231 | extern unsigned long neigh_rand_reach_time(unsigned long base); |
| 217 | 232 | ||
| 218 | extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p, | 233 | extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p, |
| @@ -224,6 +239,16 @@ extern struct pneigh_entry *__pneigh_lookup(struct neigh_table *tbl, | |||
| 224 | struct net_device *dev); | 239 | struct net_device *dev); |
| 225 | extern int pneigh_delete(struct neigh_table *tbl, struct net *net, const void *key, struct net_device *dev); | 240 | extern int pneigh_delete(struct neigh_table *tbl, struct net *net, const void *key, struct net_device *dev); |
| 226 | 241 | ||
| 242 | static inline | ||
| 243 | struct net *pneigh_net(const struct pneigh_entry *pneigh) | ||
| 244 | { | ||
| 245 | #ifdef CONFIG_NET_NS | ||
| 246 | return pneigh->net; | ||
| 247 | #else | ||
| 248 | return &init_net; | ||
| 249 | #endif | ||
| 250 | } | ||
| 251 | |||
| 227 | extern void neigh_app_ns(struct neighbour *n); | 252 | extern void neigh_app_ns(struct neighbour *n); |
| 228 | extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie); | 253 | extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie); |
| 229 | extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *)); | 254 | extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *)); |
| @@ -288,12 +313,6 @@ static inline void neigh_confirm(struct neighbour *neigh) | |||
| 288 | neigh->confirmed = jiffies; | 313 | neigh->confirmed = jiffies; |
| 289 | } | 314 | } |
| 290 | 315 | ||
| 291 | static inline int neigh_is_connected(struct neighbour *neigh) | ||
| 292 | { | ||
| 293 | return neigh->nud_state&NUD_CONNECTED; | ||
| 294 | } | ||
| 295 | |||
| 296 | |||
| 297 | static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) | 316 | static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) |
| 298 | { | 317 | { |
| 299 | neigh->used = jiffies; | 318 | neigh->used = jiffies; |
