Skip to content

Commit

Permalink
ipvlan: fix signature of rtnl_link_ipvlan_get_mode() to signal error
Browse files Browse the repository at this point in the history
http://lists.infradead.org/pipermail/libnl/2015-June/001902.html

Fixes: 7de5be8

Signed-off-by: Thomas Haller <thaller@redhat.com>
  • Loading branch information
thom311 committed Jun 26, 2015
1 parent 089a282 commit b4afcad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion include/netlink/route/link/ipvlan.h
Expand Up @@ -28,7 +28,7 @@ extern int rtnl_link_ipvlan_str2mode(const char *);

extern int rtnl_link_ipvlan_set_mode(struct rtnl_link *,
uint16_t);
extern uint16_t rtnl_link_ipvlan_get_mode(struct rtnl_link *);
extern int rtnl_link_ipvlan_get_mode(struct rtnl_link *, uint16_t *out_mode);

#ifdef __cplusplus
}
Expand Down
13 changes: 7 additions & 6 deletions lib/route/link/ipvlan.c
Expand Up @@ -227,19 +227,20 @@ int rtnl_link_ipvlan_set_mode(struct rtnl_link *link, uint16_t mode)
/**
* Get IPVLAN Mode
* @arg link Link object
* @arg out_mode on success, return the mode
*
* @return IPVLAN mode, 0 if not set or a negative error code.
* @return 0 on success or a negative error code.
*/
uint16_t rtnl_link_ipvlan_get_mode(struct rtnl_link *link)
int rtnl_link_ipvlan_get_mode(struct rtnl_link *link, uint16_t *out_mode)
{
struct ipvlan_info *ipi = link->l_info;

IS_IPVLAN_LINK_ASSERT(link);

if (ipi->ipi_mask & IPVLAN_HAS_MODE)
return ipi->ipi_mode;
else
return 0;
if (!(ipi->ipi_mask & IPVLAN_HAS_MODE))
return -NLE_OPNOTSUPP;
*out_mode = ipi->ipi_mode;
return 0;
}

/** @} */
Expand Down

0 comments on commit b4afcad

Please sign in to comment.