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

int rtnl_route_set_dst ( struct rtnl_route *  route,
struct nl_addr *  addr 

Set the destination address of a route to the specified address

  • route route to be changed
  • addr new destination address
Assigns the new destination address to the specified route, overwrites the destination address length (rtnl_route::rt_dst_len), and sets the route's address family to the new address's family if it is not set already.

If a address family has been specified already via either calling rtnl_route_set_family() or by setting one of the other addresses, the specified addr is automatically validated against this family and the assignment fails in case of a mismatch.

0 on success or a negative error code.

Definition at line 982 of file route.c.

References nl_addr_get(), and nl_addr_put().

      if (route->rt_mask & ROUTE_ATTR_FAMILY) {
            if (addr->a_family != route->rt_family)
                  return nl_error(EINVAL, "Address family mismatch");
      } else
            route->rt_family = addr->a_family;

      if (route->rt_dst)

      route->rt_dst = addr;

      return 0;

Generated by  Doxygen 1.6.0   Back to index