summaryrefslogtreecommitdiffstats
path: root/src/shared/conf-parser.c
diff options
context:
space:
mode:
authorRubens Figueiredo <rubens.figueiredo@bisdn.de>2020-03-20 16:09:36 +0100
committerLennart Poettering <lennart@poettering.net>2020-05-14 17:59:57 +0200
commit4df4df5b56917f4f66f708a83f4e1aa8b38ea922 (patch)
treefe7f397a35e9fa58902229727269e99606e53b59 /src/shared/conf-parser.c
parentnetworkctl: Add support to display macvlan/macvtap mode (diff)
downloadsystemd-4df4df5b56917f4f66f708a83f4e1aa8b38ea922.tar.xz
systemd-4df4df5b56917f4f66f708a83f4e1aa8b38ea922.zip
network: allow setting VLAN protocol on bridges
Signed-off-by: Rubens Figueiredo <rubens.figueiredo@bisdn.de>
Diffstat (limited to 'src/shared/conf-parser.c')
-rw-r--r--src/shared/conf-parser.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index 3ba33606fb..23cb3b65b6 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -1187,3 +1187,35 @@ int config_parse_permille(const char* unit,
return 0;
}
+
+int config_parse_vlanprotocol(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) {
+ int *vlan_protocol = data;
+ assert(filename);
+ assert(lvalue);
+
+ if (isempty(rvalue)) {
+ *vlan_protocol = -1;
+ return 0;
+ }
+
+ if (STR_IN_SET(rvalue, "802.1ad", "802.1AD"))
+ *vlan_protocol = ETH_P_8021AD;
+ else if (STR_IN_SET(rvalue, "802.1q", "802.1Q"))
+ *vlan_protocol = ETH_P_8021Q;
+ else {
+ log_syntax(unit, LOG_ERR, filename, line, 0,
+ "Failed to parse VLAN protocol value, ignoring: %s", rvalue);
+ return 0;
+ }
+
+ return 0;
+}