Merge pull request #3892 from toanju/fix-brvlan-error-on-normal-bridge

networkd: apply bridge vlan configuration correct
This commit is contained in:
Lennart Poettering
2016-08-04 20:39:57 +02:00
committed by GitHub
5 changed files with 25 additions and 2 deletions
+20
View File
@@ -257,6 +257,24 @@ static int parse_vid_range(const char *rvalue, uint16_t *vid, uint16_t *vid_end)
return r;
}
int config_parse_brvlan_pvid(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;
int r;
uint16_t pvid;
r = parse_vlanid(rvalue, &pvid);
if (r < 0)
return r;
network->pvid = pvid;
network->use_br_vlan = true;
return 0;
}
int config_parse_brvlan_vlan(const char *unit, const char *filename,
unsigned line, const char *section,
unsigned section_line, const char *lvalue,
@@ -288,6 +306,7 @@ int config_parse_brvlan_vlan(const char *unit, const char *filename,
for (; vid <= vid_end; vid++)
set_bit(vid, network->br_vid_bitmap);
}
network->use_br_vlan = true;
return 0;
}
@@ -325,5 +344,6 @@ int config_parse_brvlan_untagged(const char *unit, const char *filename,
set_bit(vid, network->br_untagged_bitmap);
}
}
network->use_br_vlan = true;
return 0;
}
+1
View File
@@ -25,5 +25,6 @@ typedef struct Link Link;
int br_vlan_configure(Link *link, uint16_t pvid, uint32_t *br_vid_bitmap, uint32_t *br_untagged_bitmap);
int config_parse_brvlan_pvid(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 config_parse_brvlan_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);
int config_parse_brvlan_untagged(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);
+2 -1
View File
@@ -2060,7 +2060,8 @@ static int link_joined(Link *link) {
log_link_error_errno(link, r, "Could not set bridge message: %m");
}
if (link->network->bridge || streq_ptr("bridge", link->kind)) {
if (link->network->use_br_vlan &&
(link->network->bridge || streq_ptr("bridge", link->kind))) {
r = link_set_bridge_vlan(link);
if (r < 0)
log_link_error_errno(link, r, "Could not set bridge vlan: %m");
+1 -1
View File
@@ -115,7 +115,7 @@ Bridge.AllowPortToBeRoot, config_parse_bool,
Bridge.UnicastFlood, config_parse_bool, 0, offsetof(Network, unicast_flood)
BridgeFDB.MACAddress, config_parse_fdb_hwaddr, 0, 0
BridgeFDB.VLANId, config_parse_fdb_vlan_id, 0, 0
BridgeVLAN.PVID, config_parse_vlanid, 0, offsetof(Network, pvid)
BridgeVLAN.PVID, config_parse_brvlan_pvid, 0, 0
BridgeVLAN.VLAN, config_parse_brvlan_vlan, 0, 0
BridgeVLAN.EgressUntagged, config_parse_brvlan_untagged, 0, 0
/* backwards compatibility: do not add new entries to this section */
+1
View File
@@ -151,6 +151,7 @@ struct Network {
bool unicast_flood;
unsigned cost;
bool use_br_vlan;
uint16_t pvid;
uint32_t br_vid_bitmap[BRIDGE_VLAN_BITMAP_LEN];
uint32_t br_untagged_bitmap[BRIDGE_VLAN_BITMAP_LEN];