summaryrefslogtreecommitdiff
path: root/src/network/networkd-network.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-01-22 14:49:24 +0100
committerTom Gundersen <teg@jklm.no>2014-01-25 11:25:17 +0100
commit54abf461d6b10dc270c4bb2aeac65f240ff1c5cd (patch)
tree5589a8c4ac8b3245c7e2e816bbac6c8bf42bca9e /src/network/networkd-network.c
parent168a3f602fa2250dc0d0aab140ab91945d5f6efa (diff)
networkd: add basic VLAN support
Diffstat (limited to 'src/network/networkd-network.c')
-rw-r--r--src/network/networkd-network.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index e703294731..2a720349a0 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -285,3 +285,40 @@ int config_parse_bond(const char *unit,
return 0;
}
+
+int config_parse_vlan(const char *unit,
+ const char *filename,
+ unsigned line,
+ const char *section,
+ unsigned section_line,
+ const char *lvalue,
+ int ltype,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+ Network *network = userdata;
+ Netdev *netdev;
+ int r;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+ assert(data);
+
+ r = netdev_get(network->manager, rvalue, &netdev);
+ if (r < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, EINVAL,
+ "VLAN is invalid, ignoring assignment: %s", rvalue);
+ return 0;
+ }
+
+ if (netdev->kind != NETDEV_KIND_VLAN) {
+ log_syntax(unit, LOG_ERR, filename, line, EINVAL,
+ "Netdev is not a VLAN, ignoring assignment: %s", rvalue);
+ return 0;
+ }
+
+ network->vlan = netdev;
+
+ return 0;
+}