dect
/
libnl
Archived
13
0
Fork 0

bridge: Provide rtnl_link_bridge_alloc()

Signed-off-by: Thomas Graf <tgraf@suug.ch>
This commit is contained in:
Thomas Graf 2013-02-14 12:34:57 +01:00
parent fd19dae352
commit 5a5aa73158
2 changed files with 23 additions and 0 deletions

View File

@ -30,6 +30,8 @@ enum rtnl_link_bridge_flags {
RTNL_BRIDGE_FAST_LEAVE = 0x0008,
};
extern struct rtnl_link *rtnl_link_bridge_alloc(void);
extern int rtnl_link_is_bridge(struct rtnl_link *);
extern int rtnl_link_bridge_has_ext_info(struct rtnl_link *);

View File

@ -183,6 +183,27 @@ static int bridge_compare(struct rtnl_link *_a, struct rtnl_link *_b,
}
/** @endcond */
/**
* Allocate link object of type bridge
*
* @return Allocated link object or NULL.
*/
struct rtnl_link *rtnl_link_bridge_alloc(void)
{
struct rtnl_link *link;
int err;
if (!(link = rtnl_link_alloc()))
return NULL;
if ((err = rtnl_link_set_type(link, "bridge")) < 0) {
rtnl_link_put(link);
return NULL;
}
return link;
}
/**
* Check if a link is a bridge
* @arg link Link object