summaryrefslogtreecommitdiff
path: root/src/network/networkd-netdev.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-06-20 12:59:22 +0200
committerTom Gundersen <teg@jklm.no>2014-06-20 12:59:22 +0200
commit6278a2019055ba63bfa80c2b107e16616ca648b1 (patch)
tree77d1e31285193d29aae9d7194fd1ddac2fa0effc /src/network/networkd-netdev.c
parent375eadd911a9f83f89f1e7de5e05f44cc81e3642 (diff)
networkd: veth - fix creation of veth netdev
Avoid freeing the netdev structure in the cleanup macro.
Diffstat (limited to 'src/network/networkd-netdev.c')
-rw-r--r--src/network/networkd-netdev.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c
index 016daf38c3..dcf7596c48 100644
--- a/src/network/networkd-netdev.c
+++ b/src/network/networkd-netdev.c
@@ -691,7 +691,8 @@ static int netdev_load_one(Manager *manager, const char *filename) {
LIST_HEAD_INIT(netdev->callbacks);
- if(netdev->kind == NETDEV_KIND_VETH) {
+ switch (netdev->kind) {
+ case NETDEV_KIND_VETH:
if (!netdev->ifname_peer) {
log_warning("Veth NetDev without peer name configured "
"in %s. Ignoring", filename);
@@ -707,19 +708,19 @@ static int netdev_load_one(Manager *manager, const char *filename) {
}
}
- return netdev_create_veth(netdev, netdev_create_handler);
- }
+ r = netdev_create_veth(netdev, netdev_create_handler);
+ if (r < 0)
+ return r;
- if (netdev->kind != NETDEV_KIND_VLAN &&
- netdev->kind != NETDEV_KIND_MACVLAN &&
- netdev->kind != NETDEV_KIND_VXLAN &&
- netdev->kind != NETDEV_KIND_IPIP &&
- netdev->kind != NETDEV_KIND_GRE &&
- netdev->kind != NETDEV_KIND_SIT &&
- netdev->kind != NETDEV_KIND_VTI) {
+ break;
+ case NETDEV_KIND_BRIDGE:
+ case NETDEV_KIND_BOND:
r = netdev_create(netdev, NULL, NULL);
if (r < 0)
return r;
+ break;
+ default:
+ break;
}
log_debug_netdev(netdev, "loaded %s", netdev_kind_to_string(netdev->kind));