network: allow setting VLAN protocol on bridges

Signed-off-by: Rubens Figueiredo <rubens.figueiredo@bisdn.de>
This commit is contained in:
Rubens Figueiredo
2020-05-14 17:59:57 +02:00
committed by Lennart Poettering
parent cf217a0922
commit 4df4df5b56
7 changed files with 52 additions and 0 deletions
+32
View File
@@ -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;
}
+1
View File
@@ -142,6 +142,7 @@ CONFIG_PARSER_PROTOTYPE(config_parse_ifnames);
CONFIG_PARSER_PROTOTYPE(config_parse_ip_port);
CONFIG_PARSER_PROTOTYPE(config_parse_mtu);
CONFIG_PARSER_PROTOTYPE(config_parse_rlimit);
CONFIG_PARSER_PROTOTYPE(config_parse_vlanprotocol);
typedef enum Disabled {
DISABLED_CONFIGURATION,