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

struct nl_msg* rtnl_addr_build_add_request ( struct rtnl_addr *  addr,
int  flags 
) [read]

Build netlink request message to request addition of new address

  • addr Address object representing the new address.
  • flags Additional netlink message flags.
Builds a new netlink message requesting the addition of a new address. The netlink message header isn't fully equipped with all relevant fields and must thus be sent out via nl_send_auto_complete() or supplemented as needed.

Minimal required attributes:

The scope will default to universe except for loopback addresses in which case a host scope is used if not specified otherwise.

Free the memory after usage using nlmsg_free().
Newly allocated netlink message or NULL if an error occured.

Definition at line 631 of file addr.c.

Referenced by rtnl_addr_add().

      int required = ADDR_ATTR_IFINDEX | ADDR_ATTR_FAMILY |

      if ((addr->a_mask & required) != required) {
            nl_error(EINVAL, "Missing mandatory attributes, required are: "
                         "ifindex, family, prefixlen, local address.");
            return NULL;
      return build_addr_msg(addr, RTM_NEWADDR, NLM_F_CREATE | flags);

Generated by  Doxygen 1.6.0   Back to index