Allocation/Freeing |
|
struct rtnl_neightbl * | rtnl_neightbl_alloc (void) |
void | rtnl_neightbl_put (struct rtnl_neightbl *neightbl) |
Neighbour Table Cache Management |
|
struct nl_cache * | rtnl_neightbl_alloc_cache (struct nl_handle *handle) |
| Build a neighbour table cache including all neighbour tables currently configured in the kernel.
|
struct rtnl_neightbl * | rtnl_neightbl_get (struct nl_cache *cache, const char *name, int ifindex) |
| Lookup neighbour table by name and optional interface index.
|
Neighbour Table Modifications |
|
struct nl_msg * | rtnl_neightbl_build_change_request (struct rtnl_neightbl *old, struct rtnl_neightbl *tmpl) |
| Builds a netlink change request message to change neighbour table attributes.
|
int | rtnl_neightbl_change (struct nl_handle *handle, struct rtnl_neightbl *old, struct rtnl_neightbl *tmpl) |
| Change neighbour table attributes.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
void | rtnl_neightbl_set_locktime (struct rtnl_neightbl *ntbl, uint64_t ms) |
| Set the locktime of a neighbour table to the specified value.
|
struct nl_msg* rtnl_neightbl_build_change_request |
( |
struct rtnl_neightbl * |
old, |
|
|
struct rtnl_neightbl * |
tmpl | |
|
) |
| | [read] |
- Parameters:
-
| old | neighbour table to change |
| tmpl | template with requested changes |
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:
- New netlink message
Definition at line 478 of file neightbl.c.
References nla_put_nested(), nla_put_string(), nla_put_u32(), nla_put_u64(), nlmsg_alloc(), nlmsg_alloc_simple(), nlmsg_append(), and nlmsg_free().
Referenced by rtnl_neightbl_change().
00480 {
00481 struct nl_msg *m;
00482 struct ndtmsg ndt = {
00483 .ndtm_family = old->nt_family,
00484 };
00485
00486 m = nlmsg_alloc_simple(RTM_SETNEIGHTBL, 0);
00487 nlmsg_append(m, &ndt, sizeof(ndt), NLMSG_ALIGNTO);
00488
00489 nla_put_string(m, NDTA_NAME, old->nt_name);
00490
00491 if (tmpl->ce_mask & NEIGHTBL_ATTR_THRESH1)
00492 nla_put_u32(m, NDTA_THRESH1, tmpl->nt_gc_thresh1);
00493
00494 if (tmpl->ce_mask & NEIGHTBL_ATTR_THRESH2)
00495 nla_put_u32(m, NDTA_THRESH2, tmpl->nt_gc_thresh2);
00496
00497 if (tmpl->ce_mask & NEIGHTBL_ATTR_THRESH2)
00498 nla_put_u32(m, NDTA_THRESH2, tmpl->nt_gc_thresh2);
00499
00500 if (tmpl->ce_mask & NEIGHTBL_ATTR_GC_INTERVAL)
00501 nla_put_u64(m, NDTA_GC_INTERVAL,
00502 tmpl->nt_gc_interval);
00503
00504 if (tmpl->ce_mask & NEIGHTBL_ATTR_PARMS) {
00505 struct rtnl_neightbl_parms *p = &tmpl->nt_parms;
00506 struct nl_msg *parms = nlmsg_alloc();
00507
00508 if (old->nt_parms.ntp_mask & NEIGHTBLPARM_ATTR_IFINDEX)
00509 nla_put_u32(parms, NDTPA_IFINDEX,
00510 old->nt_parms.ntp_ifindex);
00511
00512
00513 if (p->ntp_mask & NEIGHTBLPARM_ATTR_QUEUE_LEN)
00514 nla_put_u32(parms, NDTPA_QUEUE_LEN, p->ntp_queue_len);
00515
00516 if (p->ntp_mask & NEIGHTBLPARM_ATTR_APP_PROBES)
00517 nla_put_u32(parms, NDTPA_APP_PROBES, p->ntp_app_probes);
00518
00519 if (p->ntp_mask & NEIGHTBLPARM_ATTR_UCAST_PROBES)
00520 nla_put_u32(parms, NDTPA_UCAST_PROBES,
00521 p->ntp_ucast_probes);
00522
00523 if (p->ntp_mask & NEIGHTBLPARM_ATTR_MCAST_PROBES)
00524 nla_put_u32(parms, NDTPA_MCAST_PROBES,
00525 p->ntp_mcast_probes);
00526
00527 if (p->ntp_mask & NEIGHTBLPARM_ATTR_PROXY_QLEN)
00528 nla_put_u32(parms, NDTPA_PROXY_QLEN,
00529 p->ntp_proxy_qlen);
00530
00531 if (p->ntp_mask & NEIGHTBLPARM_ATTR_BASE_REACHABLE_TIME)
00532 nla_put_u64(parms, NDTPA_BASE_REACHABLE_TIME,
00533 p->ntp_base_reachable_time);
00534
00535 if (p->ntp_mask & NEIGHTBLPARM_ATTR_RETRANS_TIME)
00536 nla_put_u64(parms, NDTPA_RETRANS_TIME,
00537 p->ntp_retrans_time);
00538
00539 if (p->ntp_mask & NEIGHTBLPARM_ATTR_GC_STALETIME)
00540 nla_put_u64(parms, NDTPA_GC_STALETIME,
00541 p->ntp_gc_stale_time);
00542
00543 if (p->ntp_mask & NEIGHTBLPARM_ATTR_DELAY_PROBE_TIME)
00544 nla_put_u64(parms, NDTPA_DELAY_PROBE_TIME,
00545 p->ntp_proxy_delay);
00546
00547 if (p->ntp_mask & NEIGHTBLPARM_ATTR_ANYCAST_DELAY)
00548 nla_put_u64(parms, NDTPA_ANYCAST_DELAY,
00549 p->ntp_anycast_delay);
00550
00551 if (p->ntp_mask & NEIGHTBLPARM_ATTR_PROXY_DELAY)
00552 nla_put_u64(parms, NDTPA_PROXY_DELAY,
00553 p->ntp_proxy_delay);
00554
00555 if (p->ntp_mask & NEIGHTBLPARM_ATTR_LOCKTIME)
00556 nla_put_u64(parms, NDTPA_LOCKTIME, p->ntp_locktime);
00557
00558 nla_put_nested(m, NDTA_PARMS, parms);
00559 nlmsg_free(parms);
00560 }
00561
00562 return m;
00563 }