summaryrefslogtreecommitdiff
path: root/src/network/networkd-link.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-02-10 18:41:54 +0100
committerTom Gundersen <teg@jklm.no>2014-02-10 19:00:17 +0100
commit672682a6b9d6fb6a3722c3fea1a93b4831747b54 (patch)
tree8d7956ff4c9171faad0702afe01b9ac2656d3322 /src/network/networkd-link.c
parent3831838ae7b3ac145711bb84a71cb86cdd829975 (diff)
networkd: VLAN - allow multiple vlans to be created on a link
Also limit the range of vlan ids. Other implementations and documentation use the ranges {0,1}-{4094,4095}, but we use the one accepted by the kernel: 0-4094. Reported-by: Oleksii Shevchuk <alxchk@gmail.com>
Diffstat (limited to 'src/network/networkd-link.c')
-rw-r--r--src/network/networkd-link.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 6468f9cd31..5e763069f3 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -866,6 +866,8 @@ static int enslave_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
}
static int link_enter_enslave(Link *link) {
+ NetDev *vlan;
+ Iterator i;
int r;
assert(link);
@@ -874,7 +876,7 @@ static int link_enter_enslave(Link *link) {
link->state = LINK_STATE_ENSLAVING;
- if (!link->network->bridge && !link->network->bond && !link->network->vlan)
+ if (!link->network->bridge && !link->network->bond && !link->network->vlans)
return link_enslaved(link);
if (link->network->bridge) {
@@ -898,20 +900,17 @@ static int link_enter_enslave(Link *link) {
link->enslaving ++;
}
- if (link->network->vlan) {
+ HASHMAP_FOREACH(vlan, link->network->vlans, i) {
log_struct_link(LOG_DEBUG, link,
"MESSAGE=%s: enslaving by '%s'",
- link->ifname, link->network->vlan->name,
- NETDEV(link->network->vlan),
- NULL);
+ link->ifname, vlan->name, NETDEV(vlan), NULL);
- r = netdev_enslave(link->network->vlan, link, &enslave_handler);
+ r = netdev_enslave(vlan, link, &enslave_handler);
if (r < 0) {
log_struct_link(LOG_WARNING, link,
"MESSAGE=%s: could not enslave by '%s': %s",
- link->ifname, link->network->vlan->name,
- strerror(-r), NETDEV(link->network->vlan),
- NULL);
+ link->ifname, vlan->name, strerror(-r),
+ NETDEV(vlan), NULL);
link_enter_failed(link);
return r;
}