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

int nl_send_auto_complete ( struct nl_sock *  sk,
struct nl_msg *  msg 

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

  • sk Netlink socket.
  • 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:
Number of characters sent or a negative error code.

Definition at line 288 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_class_delete(), rtnl_cls_add(), rtnl_cls_change(), rtnl_cls_delete(), rtnl_link_change(), rtnl_neigh_add(), 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;
      struct nl_cb *cb = sk->s_cb;

      nlh = nlmsg_hdr(msg);
      if (nlh->nlmsg_pid == 0)
            nlh->nlmsg_pid = sk->s_local.nl_pid;

      if (nlh->nlmsg_seq == 0)
            nlh->nlmsg_seq = sk->s_seq_next++;

      if (msg->nm_protocol == -1)
            msg->nm_protocol = sk->s_proto;
      nlh->nlmsg_flags |= NLM_F_REQUEST;

      if (!(sk->s_flags & NL_NO_AUTO_ACK))
            nlh->nlmsg_flags |= NLM_F_ACK;

      if (cb->cb_send_ow)
            return cb->cb_send_ow(sk, msg);
            return nl_send(sk, msg);

Generated by  Doxygen 1.6.0   Back to index