summaryrefslogtreecommitdiffstats
path: root/lib/route/link/vlan.c
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2013-02-14 11:42:07 (GMT)
committerThomas Graf <tgraf@suug.ch>2013-02-14 11:42:22 (GMT)
commitee4122a12edcf7f10f03fbb7e35fe1388a8c3399 (patch)
tree537ffdd8ae52dc1e3d7f04f201d92737c7298275 /lib/route/link/vlan.c
parentbb9911b5a337aeba34b6be53a2ef654828a92897 (diff)
downloadlibnl-ee4122a12edcf7f10f03fbb7e35fe1388a8c3399.zip
libnl-ee4122a12edcf7f10f03fbb7e35fe1388a8c3399.tar.gz
libnl-ee4122a12edcf7f10f03fbb7e35fe1388a8c3399.tar.bz2
vlan: Provide rtnl_link_vlan_alloc()
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Diffstat (limited to 'lib/route/link/vlan.c')
-rw-r--r--lib/route/link/vlan.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/route/link/vlan.c b/lib/route/link/vlan.c
index 4f44aa5..9bbe7d5 100644
--- a/lib/route/link/vlan.c
+++ b/lib/route/link/vlan.c
@@ -6,7 +6,7 @@
* License as published by the Free Software Foundation version 2.1
* of the License.
*
- * Copyright (c) 2003-2010 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch>
*/
/**
@@ -341,6 +341,27 @@ static struct rtnl_link_info_ops vlan_info_ops = {
*/
/**
+ * Allocate link object of type VLAN
+ *
+ * @return Allocated link object or NULL.
+ */
+struct rtnl_link *rtnl_link_vlan_alloc(void)
+{
+ struct rtnl_link *link;
+ int err;
+
+ if (!(link = rtnl_link_alloc()))
+ return NULL;
+
+ if ((err = rtnl_link_set_type(link, "vlan")) < 0) {
+ rtnl_link_put(link);
+ return NULL;
+ }
+
+ return link;
+}
+
+/**
* Check if link is a VLAN link
* @arg link Link object
*