summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2013-02-14 11:34:57 (GMT)
committerThomas Graf <tgraf@suug.ch>2013-02-14 11:34:57 (GMT)
commit5a5aa73158027ae74eef3433388350c214b908f1 (patch)
tree704b5cc6d41c70e7926e47b470a572a1fb1677e0 /lib
parentfd19dae352d761760bc161a81a98bc14cbe99733 (diff)
downloadlibnl-5a5aa73158027ae74eef3433388350c214b908f1.zip
libnl-5a5aa73158027ae74eef3433388350c214b908f1.tar.gz
libnl-5a5aa73158027ae74eef3433388350c214b908f1.tar.bz2
bridge: Provide rtnl_link_bridge_alloc()
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Diffstat (limited to 'lib')
-rw-r--r--lib/route/link/bridge.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/route/link/bridge.c b/lib/route/link/bridge.c
index a306c9c..eb02b22 100644
--- a/lib/route/link/bridge.c
+++ b/lib/route/link/bridge.c
@@ -184,6 +184,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
*