Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

neighbour.c File Reference

#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/socket.h>
#include <linux/sched.h>
#include <linux/netdevice.h>
#include <net/neighbour.h>
#include <net/dst.h>
#include <net/sock.h>
#include <linux/rtnetlink.h>

Include dependency graph for neighbour.c:

Go to the source code of this file.

Defines

#define NEIGH_DEBUG   1
#define NEIGH_PRINTK(x...)   printk(x)
#define NEIGH_NOPRINTK(x...)   do { ; } while(0)
#define NEIGH_PRINTK0   NEIGH_PRINTK
#define NEIGH_PRINTK1   NEIGH_NOPRINTK
#define NEIGH_PRINTK2   NEIGH_NOPRINTK
#define NEIGH_PRINTK1   NEIGH_PRINTK

Functions

static void neigh_timer_handler (unsigned long arg)
static int pneigh_ifdown (struct neigh_table *tbl, struct device *dev)
static int neigh_blackhole (struct sk_buff *skb)
unsigned long neigh_rand_reach_time (unsigned long base)
static int neigh_forced_gc (struct neigh_table *tbl)
int neigh_ifdown (struct neigh_table *tbl, struct device *dev)
static struct neighbour * neigh_alloc (struct neigh_table *tbl, int creat)
neighbour * __neigh_lookup (struct neigh_table *tbl, const void *pkey, struct device *dev, int creat)
pneigh_entry * pneigh_lookup (struct neigh_table *tbl, const void *pkey, struct device *dev, int creat)
int pneigh_delete (struct neigh_table *tbl, const void *pkey, struct device *dev)
void neigh_destroy (struct neighbour *neigh)
static void neigh_suspect (struct neighbour *neigh)
static void neigh_connect (struct neighbour *neigh)
static void neigh_sync (struct neighbour *n)
static void neigh_periodic_timer (unsigned long arg)
static __inline__ int neigh_max_probes (struct neighbour *n)
int __neigh_event_send (struct neighbour *neigh, struct sk_buff *skb)
static __inline__ void neigh_update_hhs (struct neighbour *neigh)
int neigh_update (struct neighbour *neigh, u8 *lladdr, u8 new, int override, int arp)
neighbour * neigh_event_ns (struct neigh_table *tbl, u8 *lladdr, void *saddr, struct device *dev)
static void neigh_hh_init (struct neighbour *n, struct dst_entry *dst, u16 protocol)
int neigh_compat_output (struct sk_buff *skb)
int neigh_resolve_output (struct sk_buff *skb)
int neigh_connected_output (struct sk_buff *skb)
static void neigh_proxy_process (unsigned long arg)
void pneigh_enqueue (struct neigh_table *tbl, struct neigh_parms *p, struct sk_buff *skb)
neigh_parms * neigh_parms_alloc (struct device *dev, struct neigh_table *tbl)
void neigh_parms_release (struct neigh_table *tbl, struct neigh_parms *parms)
void neigh_table_init (struct neigh_table *tbl)
int neigh_table_clear (struct neigh_table *tbl)

Variables

static int neigh_glbl_allocs
static struct neigh_table * neigh_tables


Define Documentation

#define NEIGH_DEBUG   1
 

Definition at line 58 of file neighbour.c.

#define NEIGH_NOPRINTK x...   )     do { ; } while(0)
 

Definition at line 61 of file neighbour.c.

#define NEIGH_PRINTK x...   )     printk(x)
 

Definition at line 60 of file neighbour.c.

#define NEIGH_PRINTK0   NEIGH_PRINTK
 

Definition at line 62 of file neighbour.c.

#define NEIGH_PRINTK1   NEIGH_PRINTK
 

Definition at line 68 of file neighbour.c.

#define NEIGH_PRINTK1   NEIGH_NOPRINTK
 

Definition at line 68 of file neighbour.c.

Referenced by neigh_destroy(), neigh_ifdown(), neigh_parms_release(), neigh_resolve_output(), and neigh_timer_handler().

#define NEIGH_PRINTK2   NEIGH_NOPRINTK
 

Definition at line 64 of file neighbour.c.

Referenced by __neigh_event_send(), __neigh_lookup(), neigh_connect(), neigh_destroy(), neigh_ifdown(), neigh_suspect(), and neigh_timer_handler().


Function Documentation

int __neigh_event_send struct neighbour *  neigh,
struct sk_buff skb
 

Definition at line 592 of file neighbour.c.

References add_timer(), end_bh_atomic(), jiffies, NEIGH_PRINTK2, sk_buff::next, NUD_DELAY, NUD_FAILED, NUD_INCOMPLETE, NUD_PROBE, NUD_STALE, NULL, and start_bh_atomic().

Referenced by ndisc_redirect_rcv().

Here is the call graph for this function:

struct neighbour* __neigh_lookup struct neigh_table *  tbl,
const void *  pkey,
struct device *  dev,
int  creat
 

Definition at line 235 of file neighbour.c.

References atomic_inc, atomic_set, jiffies, memcmp, memcpy, n, neigh_alloc(), neigh_destroy(), NEIGH_PRINTK2, NULL, and u32.

Referenced by __teql_resolve(), arp_bind_neighbour(), arp_find(), arp_rcv(), arp_req_delete(), arp_req_get(), arp_req_set(), ndisc_rcv(), ndisc_redirect_rcv(), and neigh_event_ns().

Here is the call graph for this function:

static struct neighbour* neigh_alloc struct neigh_table *  tbl,
int  creat
[static]
 

Definition at line 198 of file neighbour.c.

References HZ, init_timer(), jiffies, kmalloc(), long, memset, n, neigh_blackhole(), neigh_forced_gc(), neigh_glbl_allocs, neigh_timer_handler(), now, NUD_NONE, and NULL.

Referenced by __neigh_lookup().

Here is the call graph for this function:

static int neigh_blackhole struct sk_buff skb  )  [static]
 

Definition at line 84 of file neighbour.c.

References ENETDOWN.

Referenced by neigh_alloc(), neigh_destroy(), and neigh_ifdown().

int neigh_compat_output struct sk_buff skb  ) 
 

Definition at line 810 of file neighbour.c.

References sk_buff::data, sk_buff::dev, dev, dev_queue_xmit(), device, sk_buff::len, sk_buff::nh, ntohs(), NULL, and sk_buff::protocol.

Here is the call graph for this function:

static void neigh_connect struct neighbour *  neigh  )  [static]
 

Definition at line 428 of file neighbour.c.

References NEIGH_PRINTK2.

Referenced by neigh_sync(), neigh_timer_handler(), and neigh_update().

int neigh_connected_output struct sk_buff skb  ) 
 

Definition at line 865 of file neighbour.c.

References sk_buff::data, dev, device, sk_buff::dst, dst, EINVAL, end_bh_atomic(), sk_buff::len, dst_entry::neighbour, sk_buff::nh, ntohs(), NULL, sk_buff::protocol, and start_bh_atomic().

Here is the call graph for this function:

void neigh_destroy struct neighbour *  neigh  ) 
 

Definition at line 378 of file neighbour.c.

References atomic_dec_and_test, atomic_read, del_timer(), kfree(), neigh_blackhole(), neigh_glbl_allocs, NEIGH_PRINTK1, NEIGH_PRINTK2, and NULL.

Referenced by __neigh_lookup(), neigh_forced_gc(), neigh_ifdown(), and neigh_periodic_timer().

Here is the call graph for this function:

struct neighbour* neigh_event_ns struct neigh_table *  tbl,
u8 lladdr,
void *  saddr,
struct device *  dev
 

Definition at line 760 of file neighbour.c.

References __neigh_lookup(), neigh_update(), and NUD_STALE.

Referenced by arp_rcv(), and ndisc_recv_ns().

Here is the call graph for this function:

static int neigh_forced_gc struct neigh_table *  tbl  )  [static]
 

Definition at line 102 of file neighbour.c.

References atomic_read, i, jiffies, n, neigh_destroy(), NUD_INCOMPLETE, NUD_PERMANENT, and NULL.

Referenced by neigh_alloc().

Here is the call graph for this function:

static void neigh_hh_init struct neighbour *  n,
struct dst_entry dst,
u16  protocol
[static]
 

Definition at line 772 of file neighbour.c.

References atomic_inc, atomic_set, dst_entry::dev, dev, device, dst_entry::hh, kfree(), kmalloc(), memset, and NULL.

Referenced by neigh_resolve_output().

Here is the call graph for this function:

int neigh_ifdown struct neigh_table *  tbl,
struct device *  dev
 

Definition at line 144 of file neighbour.c.

References atomic_read, del_timer(), EBUSY, end_bh_atomic(), i, n, neigh_blackhole(), neigh_destroy(), NEIGH_PRINTK1, NEIGH_PRINTK2, NUD_NOARP, NUD_NONE, NULL, pneigh_ifdown(), and start_bh_atomic().

Referenced by addrconf_ifdown(), arp_ifdown(), and neigh_table_clear().

Here is the call graph for this function:

static __inline__ int neigh_max_probes struct neighbour *  n  )  [static]
 

Definition at line 534 of file neighbour.c.

References p.

Referenced by neigh_timer_handler().

struct neigh_parms* neigh_parms_alloc struct device *  dev,
struct neigh_table *  tbl
 

Definition at line 936 of file neighbour.c.

References kfree(), kmalloc(), memcpy, neigh_rand_reach_time(), NULL, and p.

Referenced by inetdev_init(), and ipv6_add_dev().

Here is the call graph for this function:

void neigh_parms_release struct neigh_table *  tbl,
struct neigh_parms *  parms
 

Definition at line 956 of file neighbour.c.

References kfree(), NEIGH_PRINTK1, NULL, p, and synchronize_bh.

Referenced by addrconf_ifdown(), and inetdev_destroy().

Here is the call graph for this function:

static void neigh_periodic_timer unsigned long  arg  )  [static]
 

Definition at line 473 of file neighbour.c.

References add_timer(), atomic_read, HZ, i, jiffies, n, neigh_destroy(), neigh_rand_reach_time(), neigh_suspect(), now, NUD_FAILED, NUD_PERMANENT, NUD_REACHABLE, NUD_STALE, NULL, p, and state.

Referenced by neigh_table_init().

Here is the call graph for this function:

static void neigh_proxy_process unsigned long  arg  )  [static]
 

Definition at line 883 of file neighbour.c.

References add_timer(), back, del_timer(), jiffies, sk_buff::next, now, sk_buff::stamp, and timeval::tv_usec.

Referenced by neigh_table_init().

Here is the call graph for this function:

unsigned long neigh_rand_reach_time unsigned long  base  ) 
 

Definition at line 96 of file neighbour.c.

References net_random().

Referenced by ndisc_router_discovery(), neigh_parms_alloc(), neigh_periodic_timer(), and neigh_table_init().

Here is the call graph for this function:

int neigh_resolve_output struct sk_buff skb  ) 
 

Definition at line 826 of file neighbour.c.

References sk_buff::data, dev, device, sk_buff::dst, dst, EINVAL, end_bh_atomic(), dst_entry::hh, sk_buff::len, neigh_hh_init(), NEIGH_PRINTK1, dst_entry::neighbour, sk_buff::nh, ntohs(), NULL, dst_entry::ops, sk_buff::protocol, dst_ops::protocol, and start_bh_atomic().

Here is the call graph for this function:

static void neigh_suspect struct neighbour *  neigh  )  [static]
 

Definition at line 413 of file neighbour.c.

References NEIGH_PRINTK2.

Referenced by neigh_periodic_timer(), neigh_sync(), and neigh_update().

static void neigh_sync struct neighbour *  n  )  [static]
 

Definition at line 451 of file neighbour.c.

References del_timer(), jiffies, neigh_connect(), neigh_suspect(), now, NUD_NOARP, NUD_PERMANENT, NUD_REACHABLE, NUD_STALE, state, and u8.

Referenced by neigh_update().

Here is the call graph for this function:

int neigh_table_clear struct neigh_table *  tbl  ) 
 

Definition at line 1000 of file neighbour.c.

References del_timer(), end_bh_atomic(), KERN_CRIT, neigh_ifdown(), neigh_tables, NULL, printk, start_bh_atomic(), synchronize_bh, and tp.

Referenced by ndisc_cleanup().

Here is the call graph for this function:

void neigh_table_init struct neigh_table *  tbl  ) 
 

Definition at line 977 of file neighbour.c.

References add_timer(), init_timer(), jiffies, long, neigh_periodic_timer(), neigh_proxy_process(), neigh_rand_reach_time(), neigh_tables, and now.

Referenced by __initfunc().

Here is the call graph for this function:

static void neigh_timer_handler unsigned long  arg  )  [static]
 

Definition at line 543 of file neighbour.c.

References add_timer(), jiffies, neigh_connect(), neigh_max_probes(), NEIGH_PRINTK1, NEIGH_PRINTK2, now, NUD_DELAY, NUD_FAILED, NUD_PROBE, NUD_REACHABLE, NULL, and state.

Referenced by neigh_alloc().

Here is the call graph for this function:

int neigh_update struct neighbour *  neigh,
u8 lladdr,
u8  new,
int  override,
int  arp
 

Definition at line 668 of file neighbour.c.

References del_timer(), dev, device, sk_buff::dst, EINVAL, EPERM, jiffies, memcmp, memcpy, n1, neigh_connect(), neigh_suspect(), neigh_sync(), neigh_update_hhs(), dst_entry::neighbour, NUD_NOARP, NUD_PERMANENT, NUD_STALE, NULL, and u8.

Referenced by arp_rcv(), arp_req_delete(), arp_req_set(), ndisc_recv_na(), ndisc_router_discovery(), ndisc_update(), and neigh_event_ns().

Here is the call graph for this function:

static __inline__ void neigh_update_hhs struct neighbour *  neigh  )  [static]
 

Definition at line 644 of file neighbour.c.

References device, update(), write_lock_irq, and write_unlock_irq.

Referenced by neigh_update().

Here is the call graph for this function:

int pneigh_delete struct neigh_table *  tbl,
const void *  pkey,
struct device *  dev
 

Definition at line 326 of file neighbour.c.

References ENOENT, kfree(), memcmp, n, NULL, synchronize_bh, and u32.

Referenced by arp_req_delete().

Here is the call graph for this function:

void pneigh_enqueue struct neigh_table *  tbl,
struct neigh_parms *  p,
struct sk_buff skb
 

Definition at line 911 of file neighbour.c.

References add_timer(), del_timer(), sk_buff::dst, jiffies, net_random(), now, NULL, sk_buff::stamp, timeval::tv_sec, and timeval::tv_usec.

Referenced by arp_rcv(), and ndisc_rcv().

Here is the call graph for this function:

static int pneigh_ifdown struct neigh_table *  tbl,
struct device *  dev
[static]
 

Definition at line 351 of file neighbour.c.

References ENOENT, h, kfree(), n, NULL, synchronize_bh, and u32.

Referenced by neigh_ifdown().

Here is the call graph for this function:

struct pneigh_entry* pneigh_lookup struct neigh_table *  tbl,
const void *  pkey,
struct device *  dev,
int  creat
 

Definition at line 287 of file neighbour.c.

References kfree(), kmalloc(), memcmp, memcpy, n, NULL, and u32.

Referenced by arp_rcv(), arp_req_set(), and ndisc_rcv().

Here is the call graph for this function:


Variable Documentation

int neigh_glbl_allocs [static]
 

Definition at line 81 of file neighbour.c.

Referenced by neigh_alloc(), and neigh_destroy().

struct neigh_table* neigh_tables [static]
 

Definition at line 82 of file neighbour.c.

Referenced by neigh_table_clear(), and neigh_table_init().