netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Neighbour Tables
Collaboration diagram for Neighbour Tables:

Data Structures

struct  rtnl_neightbl
 Neighbour table. More...
 

Allocation/Freeing

struct rtnl_neightblrtnl_neightbl_alloc (void)
 
void rtnl_neightbl_put (struct rtnl_neightbl *neightbl)
 

Neighbour Table Cache Management

int rtnl_neightbl_alloc_cache (struct nl_sock *sk, struct nl_cache **result)
 Build a neighbour table cache including all neighbour tables currently configured in the kernel. More...
 
struct rtnl_neightblrtnl_neightbl_get (struct nl_cache *cache, const char *name, int ifindex)
 Lookup neighbour table by name and optional interface index. More...
 

Neighbour Table Modifications

int rtnl_neightbl_build_change_request (struct rtnl_neightbl *old, struct rtnl_neightbl *tmpl, struct nl_msg **result)
 Builds a netlink change request message to change neighbour table attributes. More...
 
int rtnl_neightbl_change (struct nl_sock *sk, struct rtnl_neightbl *old, struct rtnl_neightbl *tmpl)
 Change neighbour table attributes. More...
 

Attribute Modification

void rtnl_neightbl_set_family (struct rtnl_neightbl *ntbl, int family)
 
void rtnl_neightbl_set_gc_interval (struct rtnl_neightbl *ntbl, uint64_t ms)
 
void rtnl_neightbl_set_gc_tresh1 (struct rtnl_neightbl *ntbl, int thresh)
 
void rtnl_neightbl_set_gc_tresh2 (struct rtnl_neightbl *ntbl, int thresh)
 
void rtnl_neightbl_set_gc_tresh3 (struct rtnl_neightbl *ntbl, int thresh)
 
void rtnl_neightbl_set_name (struct rtnl_neightbl *ntbl, const char *name)
 
void rtnl_neightbl_set_dev (struct rtnl_neightbl *ntbl, int ifindex)
 
void rtnl_neightbl_set_queue_len (struct rtnl_neightbl *ntbl, int len)
 Set the queue length for pending requests of a neighbour table to the specified value. More...
 
void rtnl_neightbl_set_proxy_queue_len (struct rtnl_neightbl *ntbl, int len)
 Set the queue length for delay proxy arp requests of a neighbour table to the specified value. More...
 
void rtnl_neightbl_set_app_probes (struct rtnl_neightbl *ntbl, int probes)
 Set the number of application probes of a neighbour table to the specified value. More...
 
void rtnl_neightbl_set_ucast_probes (struct rtnl_neightbl *ntbl, int probes)
 Set the number of unicast probes of a neighbour table to the specified value. More...
 
void rtnl_neightbl_set_mcast_probes (struct rtnl_neightbl *ntbl, int probes)
 Set the number of multicast probes of a neighbour table to the specified value. More...
 
void rtnl_neightbl_set_base_reachable_time (struct rtnl_neightbl *ntbl, uint64_t ms)
 Set the base reachable time of a neighbour table to the specified value. More...
 
void rtnl_neightbl_set_retrans_time (struct rtnl_neightbl *ntbl, uint64_t ms)
 Set the retransmit time of a neighbour table to the specified value. More...
 
void rtnl_neightbl_set_gc_stale_time (struct rtnl_neightbl *ntbl, uint64_t ms)
 Set the gc stale time of a neighbour table to the specified value. More...
 
void rtnl_neightbl_set_delay_probe_time (struct rtnl_neightbl *ntbl, uint64_t ms)
 Set the first probe delay time of a neighbour table to the specified value. More...
 
void rtnl_neightbl_set_anycast_delay (struct rtnl_neightbl *ntbl, uint64_t ms)
 Set the anycast delay of a neighbour table to the specified value. More...
 
void rtnl_neightbl_set_proxy_delay (struct rtnl_neightbl *ntbl, uint64_t ms)
 Set the proxy delay of a neighbour table to the specified value. More...
 
void rtnl_neightbl_set_locktime (struct rtnl_neightbl *ntbl, uint64_t ms)
 Set the locktime of a neighbour table to the specified value. More...
 

Detailed Description

Function Documentation

struct rtnl_neightbl* rtnl_neightbl_alloc ( void  )

References nl_object_alloc().

Here is the call graph for this function:

int rtnl_neightbl_alloc_cache ( struct nl_sock sk,
struct nl_cache **  result 
)

Build a neighbour table cache including all neighbour tables currently configured in the kernel.

  • sk Netlink socket.
  • result Pointer to store resulting cache.

Allocates a new neighbour table cache, initializes it properly and updates it to include all neighbour tables currently configured in the kernel.

Returns
0 on success or a negative error code.

References nl_cache_alloc_and_fill().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

int rtnl_neightbl_build_change_request ( struct rtnl_neightbl old,
struct rtnl_neightbl tmpl,
struct nl_msg **  result 
)

Builds a netlink change request message to change neighbour table attributes.

  • old neighbour table to change
  • tmpl template with requested changes
  • result Pointer to store resulting message.

Builds a new netlink message requesting a change of neighbour table attributes. The netlink message header isn't fully equipped with all relevant fields and must be sent out via nl_send_auto_complete() or supplemented as needed. old must point to a neighbour table currently configured in the kernel and tmpl must contain the attributes to be changed set via rtnl_neightbl_set_* functions.

Returns
0 on success or a negative error code.

References NDTA_NAME, ndtmsg::ndtm_family, NDTPA_ANYCAST_DELAY, NDTPA_APP_PROBES, NDTPA_BASE_REACHABLE_TIME, NDTPA_DELAY_PROBE_TIME, NDTPA_GC_STALETIME, NDTPA_IFINDEX, NDTPA_LOCKTIME, NDTPA_MCAST_PROBES, NDTPA_PROXY_DELAY, NDTPA_PROXY_QLEN, NDTPA_QUEUE_LEN, NDTPA_RETRANS_TIME, NDTPA_UCAST_PROBES, nla_put_nested(), NLA_PUT_STRING, NLA_PUT_U32, NLA_PUT_U64, NLE_MSGSIZE, NLE_NOMEM, NLMSG_ALIGNTO, nlmsg_alloc(), nlmsg_alloc_simple(), nlmsg_append(), nlmsg_free(), rtnl_neightbl::nt_family, rtnl_neightbl::nt_gc_interval, rtnl_neightbl::nt_gc_thresh1, rtnl_neightbl::nt_gc_thresh2, rtnl_neightbl::nt_name, rtnl_neightbl::nt_parms, rtnl_neightbl_parms::ntp_anycast_delay, rtnl_neightbl_parms::ntp_app_probes, rtnl_neightbl_parms::ntp_base_reachable_time, rtnl_neightbl_parms::ntp_gc_stale_time, rtnl_neightbl_parms::ntp_ifindex, rtnl_neightbl_parms::ntp_locktime, rtnl_neightbl_parms::ntp_mask, rtnl_neightbl_parms::ntp_mcast_probes, rtnl_neightbl_parms::ntp_proxy_delay, rtnl_neightbl_parms::ntp_proxy_qlen, rtnl_neightbl_parms::ntp_queue_len, rtnl_neightbl_parms::ntp_retrans_time, rtnl_neightbl_parms::ntp_ucast_probes, NULL, and RTM_SETNEIGHTBL.

Referenced by rtnl_neightbl_change().

Here is the call graph for this function:

Here is the caller graph for this function:

int rtnl_neightbl_change ( struct nl_sock sk,
struct rtnl_neightbl old,
struct rtnl_neightbl tmpl 
)

Change neighbour table attributes.

  • sk Netlink socket.
  • old neighbour table to be changed
  • tmpl template with requested changes

Builds a new netlink message by calling rtnl_neightbl_build_change_request(), sends the request to the kernel and waits for the next ACK to be received, i.e. blocks until the request has been processed.

Returns
0 on success or a negative error code

References nl_send_auto_complete(), nlmsg_free(), and rtnl_neightbl_build_change_request().

Here is the call graph for this function:

struct rtnl_neightbl* rtnl_neightbl_get ( struct nl_cache cache,
const char *  name,
int  ifindex 
)

Lookup neighbour table by name and optional interface index.

  • cache neighbour table cache
  • name name of table
  • ifindex optional interface index

Looks up the neighbour table matching the specified name and optionally the specified ifindex to retrieve device specific parameter sets.

Returns
ptr to neighbour table inside the cache or NULL if no match was found.

References nl_cache::c_items, nl_cache::c_ops, nl_list_for_each_entry, nl_object_get(), rtnl_neightbl::nt_name, rtnl_neightbl::nt_parms, rtnl_neightbl_parms::ntp_ifindex, and NULL.

Here is the call graph for this function:

void rtnl_neightbl_put ( struct rtnl_neightbl neightbl)

References nl_object_put().

Here is the call graph for this function:

void rtnl_neightbl_set_anycast_delay ( struct rtnl_neightbl ntbl,
uint64_t  ms 
)

Set the anycast delay of a neighbour table to the specified value.

  • ntbl neighbour table to change
  • ms new anycast delay in milliseconds

References rtnl_neightbl::nt_parms, rtnl_neightbl_parms::ntp_anycast_delay, and rtnl_neightbl_parms::ntp_mask.

void rtnl_neightbl_set_app_probes ( struct rtnl_neightbl ntbl,
int  probes 
)

Set the number of application probes of a neighbour table to the specified value.

  • ntbl neighbour table to change
  • probes new probes value

References rtnl_neightbl::nt_parms, rtnl_neightbl_parms::ntp_app_probes, and rtnl_neightbl_parms::ntp_mask.

void rtnl_neightbl_set_base_reachable_time ( struct rtnl_neightbl ntbl,
uint64_t  ms 
)

Set the base reachable time of a neighbour table to the specified value.

  • ntbl neighbour table to change
  • ms new base reachable time in milliseconds

References rtnl_neightbl::nt_parms, rtnl_neightbl_parms::ntp_base_reachable_time, and rtnl_neightbl_parms::ntp_mask.

void rtnl_neightbl_set_delay_probe_time ( struct rtnl_neightbl ntbl,
uint64_t  ms 
)

Set the first probe delay time of a neighbour table to the specified value.

  • ntbl neighbour table to change
  • ms new first probe delay time in milliseconds

References rtnl_neightbl::nt_parms, rtnl_neightbl_parms::ntp_mask, and rtnl_neightbl_parms::ntp_probe_delay.

void rtnl_neightbl_set_dev ( struct rtnl_neightbl ntbl,
int  ifindex 
)
void rtnl_neightbl_set_family ( struct rtnl_neightbl ntbl,
int  family 
)
void rtnl_neightbl_set_gc_interval ( struct rtnl_neightbl ntbl,
uint64_t  ms 
)
void rtnl_neightbl_set_gc_stale_time ( struct rtnl_neightbl ntbl,
uint64_t  ms 
)

Set the gc stale time of a neighbour table to the specified value.

  • ntbl neighbour table to change
  • ms new gc stale time in milliseconds

References rtnl_neightbl::nt_parms, rtnl_neightbl_parms::ntp_gc_stale_time, and rtnl_neightbl_parms::ntp_mask.

void rtnl_neightbl_set_gc_tresh1 ( struct rtnl_neightbl ntbl,
int  thresh 
)
void rtnl_neightbl_set_gc_tresh2 ( struct rtnl_neightbl ntbl,
int  thresh 
)
void rtnl_neightbl_set_gc_tresh3 ( struct rtnl_neightbl ntbl,
int  thresh 
)
void rtnl_neightbl_set_locktime ( struct rtnl_neightbl ntbl,
uint64_t  ms 
)

Set the locktime of a neighbour table to the specified value.

  • ntbl neighbour table to change
  • ms new locktime in milliseconds

References rtnl_neightbl::nt_parms, rtnl_neightbl_parms::ntp_locktime, and rtnl_neightbl_parms::ntp_mask.

void rtnl_neightbl_set_mcast_probes ( struct rtnl_neightbl ntbl,
int  probes 
)

Set the number of multicast probes of a neighbour table to the specified value.

  • ntbl neighbour table to change
  • probes new probes value

References rtnl_neightbl::nt_parms, rtnl_neightbl_parms::ntp_mask, and rtnl_neightbl_parms::ntp_mcast_probes.

void rtnl_neightbl_set_name ( struct rtnl_neightbl ntbl,
const char *  name 
)
void rtnl_neightbl_set_proxy_delay ( struct rtnl_neightbl ntbl,
uint64_t  ms 
)

Set the proxy delay of a neighbour table to the specified value.

  • ntbl neighbour table to change
  • ms new proxy delay in milliseconds

References rtnl_neightbl::nt_parms, rtnl_neightbl_parms::ntp_mask, and rtnl_neightbl_parms::ntp_proxy_delay.

void rtnl_neightbl_set_proxy_queue_len ( struct rtnl_neightbl ntbl,
int  len 
)

Set the queue length for delay proxy arp requests of a neighbour table to the specified value.

  • ntbl neighbour table to change
  • len new queue len

References len, rtnl_neightbl::nt_parms, rtnl_neightbl_parms::ntp_mask, and rtnl_neightbl_parms::ntp_proxy_qlen.

void rtnl_neightbl_set_queue_len ( struct rtnl_neightbl ntbl,
int  len 
)

Set the queue length for pending requests of a neighbour table to the specified value.

  • ntbl neighbour table to change
  • len new queue len

References len, rtnl_neightbl::nt_parms, rtnl_neightbl_parms::ntp_mask, and rtnl_neightbl_parms::ntp_queue_len.

void rtnl_neightbl_set_retrans_time ( struct rtnl_neightbl ntbl,
uint64_t  ms 
)

Set the retransmit time of a neighbour table to the specified value.

  • ntbl neighbour table to change
  • ms new retransmit time

References rtnl_neightbl::nt_parms, rtnl_neightbl_parms::ntp_mask, and rtnl_neightbl_parms::ntp_retrans_time.

void rtnl_neightbl_set_ucast_probes ( struct rtnl_neightbl ntbl,
int  probes 
)

Set the number of unicast probes of a neighbour table to the specified value.

  • ntbl neighbour table to change
  • probes new probes value

References rtnl_neightbl::nt_parms, rtnl_neightbl_parms::ntp_mask, and rtnl_neightbl_parms::ntp_ucast_probes.