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

int rtnl_addr_set_local ( struct rtnl_addr *  addr,
struct nl_addr *  local 
)

Set local address of address object.

  • addr Address object to be modified.
  • local New local address.
Assigns the new local address to the specified address object. The address is validated against the address family if set already via either rtnl_addr_set_family() or by setting one of the other addresses. The assignment fails if the address families mismatch. In case the address family has not been specified yet, the address family of the new address is elected to be the new requirement.

Note:
The address may not contain a prefix length if the peer address has been specified already.
Returns:
0 on success or a negative error code.

Definition at line 956 of file addr.c.

References nl_addr_get_prefixlen().

{
      int err;

      err = __assign_addr(addr, &addr->a_local, local, ADDR_ATTR_LOCAL);
      if (err < 0)
            return err;

      if (!(addr->a_mask & ADDR_ATTR_PEER)) {
            addr->a_prefixlen = nl_addr_get_prefixlen(addr->a_local);
            addr->a_mask |= ADDR_ATTR_PREFIXLEN;
      }

      return 0;
}


Generated by  Doxygen 1.6.0   Back to index