The neighbour table establishes bindings between protocol addresses and link layer addresses for hosts sharing the same physical link. More...
Neighbour Object Allocation/Freeage | |
struct rtnl_neigh * | rtnl_neigh_alloc (void) |
void | rtnl_neigh_put (struct rtnl_neigh *neigh) |
Neighbour Cache Managament | |
int | rtnl_neigh_alloc_cache (struct nl_sock *sock, struct nl_cache **result) |
Build a neighbour cache including all neighbours currently configured in the kernel. More... | |
struct rtnl_neigh * | rtnl_neigh_get (struct nl_cache *cache, int ifindex, struct nl_addr *dst) |
Look up a neighbour by interface index and destination address. More... | |
Neighbour Addition | |
int | rtnl_neigh_build_add_request (struct rtnl_neigh *tmpl, int flags, struct nl_msg **result) |
Build netlink request message to add a new neighbour. More... | |
int | rtnl_neigh_add (struct nl_sock *sk, struct rtnl_neigh *tmpl, int flags) |
Add a new neighbour. More... | |
Neighbour Deletion | |
int | rtnl_neigh_build_delete_request (struct rtnl_neigh *neigh, int flags, struct nl_msg **result) |
Build a netlink request message to delete a neighbour. More... | |
int | rtnl_neigh_delete (struct nl_sock *sk, struct rtnl_neigh *neigh, int flags) |
Delete a neighbour. More... | |
Neighbour States Translations | |
char * | rtnl_neigh_state2str (int state, char *buf, size_t len) |
int | rtnl_neigh_str2state (const char *name) |
Neighbour Flags Translations | |
char * | rtnl_neigh_flags2str (int flags, char *buf, size_t len) |
int | rtnl_neigh_str2flag (const char *name) |
The neighbour table establishes bindings between protocol addresses and link layer addresses for hosts sharing the same physical link.
This module allows you to access and manipulate the content of these tables.
int rtnl_neigh_add | ( | struct nl_sock * | sk, |
struct rtnl_neigh * | tmpl, | ||
int | flags | ||
) |
Add a new neighbour.
Builds a netlink message by calling rtnl_neigh_build_add_request(), sends the request to the kernel and waits for the next ACK to be received and thus blocks until the request has been fullfilled.
The following attributes must be set in the template:
References nl_send_auto_complete(), nlmsg_free(), and rtnl_neigh_build_add_request().
Referenced by main().
struct rtnl_neigh* rtnl_neigh_alloc | ( | void | ) |
References nl_object_alloc().
Referenced by nl_cli_neigh_alloc().
Build a neighbour cache including all neighbours currently configured in the kernel.
Allocates a new neighbour cache, initializes it properly and updates it to include all neighbours currently configured in the kernel.
References nl_cache_alloc_and_fill().
int rtnl_neigh_build_add_request | ( | struct rtnl_neigh * | tmpl, |
int | flags, | ||
struct nl_msg ** | result | ||
) |
Build netlink request message to add a new neighbour.
Builds a new netlink message requesting a addition of a new neighbour. The netlink message header isn't fully equipped with all relevant fields and must thus be sent out via nl_send_auto_complete() or supplemented as needed. tmpl must contain the attributes of the new neighbour set via rtnl_neigh_set_*
functions.
The following attributes must be set in the template:
References RTM_NEWNEIGH.
Referenced by rtnl_neigh_add().
int rtnl_neigh_build_delete_request | ( | struct rtnl_neigh * | neigh, |
int | flags, | ||
struct nl_msg ** | result | ||
) |
Build a netlink request message to delete a neighbour.
Builds a new netlink message requesting a deletion of a neighbour. The netlink message header isn't fully equipped with all relevant fields and must thus be sent out via nl_send_auto_complete() or supplemented as needed. neigh must point to an existing neighbour.
References RTM_DELNEIGH.
Referenced by rtnl_neigh_delete().
int rtnl_neigh_delete | ( | struct nl_sock * | sk, |
struct rtnl_neigh * | neigh, | ||
int | flags | ||
) |
Delete a neighbour.
Builds a netlink message by calling rtnl_neigh_build_delete_request(), sends the request to the kernel and waits for the next ACK to be received and thus blocks until the request has been fullfilled.
References nl_send_auto_complete(), nlmsg_free(), and rtnl_neigh_build_delete_request().
char* rtnl_neigh_flags2str | ( | int | flags, |
char * | buf, | ||
size_t | len | ||
) |
Look up a neighbour by interface index and destination address.
References nl_cache::c_items, rtnl_neigh::n_dst, rtnl_neigh::n_ifindex, nl_addr_cmp(), nl_list_for_each_entry, nl_object_get(), and NULL.
struct nl_addr* rtnl_neigh_get_dst | ( | struct rtnl_neigh * | neigh | ) |
References rtnl_neigh::n_dst, and NULL.
int rtnl_neigh_get_family | ( | struct rtnl_neigh * | neigh | ) |
References rtnl_neigh::n_family.
Referenced by nl_cli_neigh_parse_dst().
unsigned int rtnl_neigh_get_flags | ( | struct rtnl_neigh * | neigh | ) |
References rtnl_neigh::n_flags.
int rtnl_neigh_get_ifindex | ( | struct rtnl_neigh * | neigh | ) |
References rtnl_neigh::n_ifindex.
struct nl_addr* rtnl_neigh_get_lladdr | ( | struct rtnl_neigh * | neigh | ) |
References rtnl_neigh::n_lladdr, and NULL.
int rtnl_neigh_get_state | ( | struct rtnl_neigh * | neigh | ) |
References rtnl_neigh::n_state.
int rtnl_neigh_get_type | ( | struct rtnl_neigh * | neigh | ) |
References rtnl_neigh::n_type.
void rtnl_neigh_put | ( | struct rtnl_neigh * | neigh | ) |
int rtnl_neigh_set_dst | ( | struct rtnl_neigh * | neigh, |
struct nl_addr * | addr | ||
) |
References rtnl_neigh::n_dst.
Referenced by nl_cli_neigh_parse_dst().
void rtnl_neigh_set_family | ( | struct rtnl_neigh * | neigh, |
int | family | ||
) |
References rtnl_neigh::n_family.
Referenced by nl_cli_neigh_parse_family().
void rtnl_neigh_set_flags | ( | struct rtnl_neigh * | neigh, |
unsigned int | flags | ||
) |
References flags, rtnl_neigh::n_flag_mask, and rtnl_neigh::n_flags.
void rtnl_neigh_set_ifindex | ( | struct rtnl_neigh * | neigh, |
int | ifindex | ||
) |
References rtnl_neigh::n_ifindex.
Referenced by nl_cli_neigh_parse_dev().
void rtnl_neigh_set_lladdr | ( | struct rtnl_neigh * | neigh, |
struct nl_addr * | addr | ||
) |
References rtnl_neigh::n_lladdr.
Referenced by nl_cli_neigh_parse_lladdr().
void rtnl_neigh_set_state | ( | struct rtnl_neigh * | neigh, |
int | state | ||
) |
References rtnl_neigh::n_state, rtnl_neigh::n_state_mask, and state.
Referenced by nl_cli_neigh_parse_state().
void rtnl_neigh_set_type | ( | struct rtnl_neigh * | neigh, |
int | type | ||
) |
References rtnl_neigh::n_type, and type.
char* rtnl_neigh_state2str | ( | int | state, |
char * | buf, | ||
size_t | len | ||
) |
int rtnl_neigh_str2flag | ( | const char * | name | ) |
int rtnl_neigh_str2state | ( | const char * | name | ) |
References __str2type(), and ARRAY_SIZE.
Referenced by nl_cli_neigh_parse_state().
void rtnl_neigh_unset_flags | ( | struct rtnl_neigh * | neigh, |
unsigned int | flags | ||
) |
References flags, rtnl_neigh::n_flag_mask, and rtnl_neigh::n_flags.
void rtnl_neigh_unset_state | ( | struct rtnl_neigh * | neigh, |
int | state | ||
) |
References rtnl_neigh::n_state, rtnl_neigh::n_state_mask, and state.