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

int nl_send_auto_complete ( struct nl_handle *  handle,
struct nl_msg *  msg 
)

Send netlink message and check & extend header values as needed.

  • handle Netlink handle.
  • msg Netlink message to be sent.
Checks the netlink message nlh for completness and extends it as required before sending it out. Checked fields include pid, sequence nr, and flags.

See also:
nl_send()
Returns:
Number of characters sent or a negative error code.

Definition at line 523 of file nl.c.

References nl_send(), NLM_F_REQUEST, nlmsghdr::nlmsg_flags, nlmsg_hdr(), nlmsghdr::nlmsg_pid, and nlmsghdr::nlmsg_seq.

Referenced by flnl_lookup(), nl_send_simple(), rtnl_addr_add(), rtnl_addr_delete(), rtnl_class_add(), rtnl_cls_add(), rtnl_cls_change(), rtnl_cls_delete(), rtnl_link_change(), rtnl_neigh_add(), rtnl_neigh_change(), rtnl_neigh_delete(), rtnl_neightbl_change(), rtnl_qdisc_add(), rtnl_qdisc_change(), rtnl_qdisc_delete(), rtnl_rule_add(), and rtnl_rule_delete().

{
      struct nlmsghdr *nlh;

      nlh = nlmsg_hdr(msg);
      if (nlh->nlmsg_pid == 0)
            nlh->nlmsg_pid = handle->h_local.nl_pid;

      if (nlh->nlmsg_seq == 0)
            nlh->nlmsg_seq = handle->h_seq_next++;
      
      nlh->nlmsg_flags |= (NLM_F_REQUEST | NLM_F_ACK);

      if (handle->h_cb->cb_send_ow)
            return handle->h_cb->cb_send_ow(handle, msg);
      else
            return nl_send(handle, msg);
}


Generated by  Doxygen 1.6.0   Back to index