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

int rtnl_rule_add ( struct nl_sock *  sk,
struct rtnl_rule *  tmpl,
int  flags 

Add a new rule

  • sk Netlink socket.
  • tmpl template with requested changes
  • flags additional netlink message flags
Builds a netlink message by calling rtnl_rule_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.

0 on sucess or a negative error if an error occured.

Definition at line 480 of file rule.c.

References nl_send_auto_complete(), nlmsg_free(), and rtnl_rule_build_add_request().

      struct nl_msg *msg;
      int err;
      if ((err = rtnl_rule_build_add_request(tmpl, flags, &msg)) < 0)
            return err;

      err = nl_send_auto_complete(sk, msg);
      if (err < 0)
            return err;

      return wait_for_ack(sk);

Generated by  Doxygen 1.6.0   Back to index