Logo Search packages:      
Sourcecode: libnl version File versions  Download package

struct nl_msg* rtnl_neightbl_build_change_request ( struct rtnl_neightbl old,
struct rtnl_neightbl tmpl 
) [read]

Builds a netlink change request message to change neighbour table attributes

  • 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(), nlmsg_free(), 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, and rtnl_neightbl_parms::ntp_ucast_probes.

Referenced by rtnl_neightbl_change().

{
      struct nl_msg *m;
      struct ndtmsg ndt = {
            .ndtm_family = old->nt_family,
      };

      m = nlmsg_alloc_simple(RTM_SETNEIGHTBL, 0);
      nlmsg_append(m, &ndt, sizeof(ndt), NLMSG_ALIGNTO);

      nla_put_string(m, NDTA_NAME, old->nt_name);

      if (tmpl->ce_mask & NEIGHTBL_ATTR_THRESH1)
            nla_put_u32(m, NDTA_THRESH1, tmpl->nt_gc_thresh1);

      if (tmpl->ce_mask & NEIGHTBL_ATTR_THRESH2)
            nla_put_u32(m, NDTA_THRESH2, tmpl->nt_gc_thresh2);

      if (tmpl->ce_mask & NEIGHTBL_ATTR_THRESH2)
            nla_put_u32(m, NDTA_THRESH2, tmpl->nt_gc_thresh2);

      if (tmpl->ce_mask & NEIGHTBL_ATTR_GC_INTERVAL)
            nla_put_u64(m, NDTA_GC_INTERVAL,
                              tmpl->nt_gc_interval);

      if (tmpl->ce_mask & NEIGHTBL_ATTR_PARMS) {
            struct rtnl_neightbl_parms *p = &tmpl->nt_parms;
            struct nl_msg *parms = nlmsg_alloc();

            if (old->nt_parms.ntp_mask & NEIGHTBLPARM_ATTR_IFINDEX)
                  nla_put_u32(parms, NDTPA_IFINDEX,
                                    old->nt_parms.ntp_ifindex);


            if (p->ntp_mask & NEIGHTBLPARM_ATTR_QUEUE_LEN)
                  nla_put_u32(parms, NDTPA_QUEUE_LEN, p->ntp_queue_len);

            if (p->ntp_mask & NEIGHTBLPARM_ATTR_APP_PROBES)
                  nla_put_u32(parms, NDTPA_APP_PROBES, p->ntp_app_probes);

            if (p->ntp_mask & NEIGHTBLPARM_ATTR_UCAST_PROBES)
                  nla_put_u32(parms, NDTPA_UCAST_PROBES,
                            p->ntp_ucast_probes);

            if (p->ntp_mask & NEIGHTBLPARM_ATTR_MCAST_PROBES)
                  nla_put_u32(parms, NDTPA_MCAST_PROBES,
                            p->ntp_mcast_probes);

            if (p->ntp_mask & NEIGHTBLPARM_ATTR_PROXY_QLEN)
                  nla_put_u32(parms, NDTPA_PROXY_QLEN,
                            p->ntp_proxy_qlen);

            if (p->ntp_mask & NEIGHTBLPARM_ATTR_BASE_REACHABLE_TIME)
                  nla_put_u64(parms, NDTPA_BASE_REACHABLE_TIME,
                            p->ntp_base_reachable_time);

            if (p->ntp_mask & NEIGHTBLPARM_ATTR_RETRANS_TIME)
                  nla_put_u64(parms, NDTPA_RETRANS_TIME,
                            p->ntp_retrans_time);

            if (p->ntp_mask & NEIGHTBLPARM_ATTR_GC_STALETIME)
                  nla_put_u64(parms, NDTPA_GC_STALETIME,
                            p->ntp_gc_stale_time);

            if (p->ntp_mask & NEIGHTBLPARM_ATTR_DELAY_PROBE_TIME)
                  nla_put_u64(parms, NDTPA_DELAY_PROBE_TIME,
                            p->ntp_proxy_delay);

            if (p->ntp_mask & NEIGHTBLPARM_ATTR_ANYCAST_DELAY)
                  nla_put_u64(parms, NDTPA_ANYCAST_DELAY,
                            p->ntp_anycast_delay);

            if (p->ntp_mask & NEIGHTBLPARM_ATTR_PROXY_DELAY)
                  nla_put_u64(parms, NDTPA_PROXY_DELAY,
                                    p->ntp_proxy_delay);

            if (p->ntp_mask & NEIGHTBLPARM_ATTR_LOCKTIME)
                  nla_put_u64(parms, NDTPA_LOCKTIME, p->ntp_locktime);

            nla_put_nested(m, NDTA_PARMS, parms);
            nlmsg_free(parms);
      }
      
      return m;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index