teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone
Blob Blame History Raw
From 65b8b293a6a8560fc1d6eecf7712f870d597965b Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Mon, 7 Jul 2014 14:18:26 +0200
Subject: [PATCH] networkd: netdev - add missing refs

Without this, the underlying device would get freed (and hence
fail).

(cherry picked from commit e04468dec04a968c523ee09da7d2163a1d1a5a15)
---
 src/network/networkd-macvlan.c | 2 ++
 src/network/networkd-tunnel.c  | 2 ++
 src/network/networkd-vlan.c    | 2 ++
 src/network/networkd-vxlan.c   | 2 ++
 4 files changed, 8 insertions(+)

diff --git a/src/network/networkd-macvlan.c b/src/network/networkd-macvlan.c
index 9227144531..7c234264ac 100644
--- a/src/network/networkd-macvlan.c
+++ b/src/network/networkd-macvlan.c
@@ -150,6 +150,8 @@ int netdev_create_macvlan(NetDev *netdev, Link *link, sd_rtnl_message_handler_t
                 return r;
         }
 
+        link_ref(link);
+
         log_debug_netdev(netdev, "creating netdev");
 
         netdev->state = NETDEV_STATE_CREATING;
diff --git a/src/network/networkd-tunnel.c b/src/network/networkd-tunnel.c
index 7341487795..5a244f61b0 100644
--- a/src/network/networkd-tunnel.c
+++ b/src/network/networkd-tunnel.c
@@ -529,6 +529,8 @@ int netdev_create_tunnel(NetDev *netdev, Link *link, sd_rtnl_message_handler_t c
                 return r;
         }
 
+        link_ref(link);
+
         log_debug_netdev(netdev, "Creating tunnel netdev: %s",
                          netdev_kind_to_string(netdev->kind));
 
diff --git a/src/network/networkd-vlan.c b/src/network/networkd-vlan.c
index 1d812fdcaa..8727b9f103 100644
--- a/src/network/networkd-vlan.c
+++ b/src/network/networkd-vlan.c
@@ -139,6 +139,8 @@ int netdev_create_vlan(NetDev *netdev, Link *link, sd_rtnl_message_handler_t cal
                 return r;
         }
 
+        link_ref(link);
+
         log_debug_netdev(netdev, "creating netdev");
 
         netdev->state = NETDEV_STATE_CREATING;
diff --git a/src/network/networkd-vxlan.c b/src/network/networkd-vxlan.c
index 8832024ef1..160459450d 100644
--- a/src/network/networkd-vxlan.c
+++ b/src/network/networkd-vxlan.c
@@ -154,6 +154,8 @@ int netdev_create_vxlan(NetDev *netdev, Link *link, sd_rtnl_message_handler_t ca
                 return r;
         }
 
+        link_ref(link);
+
         log_debug_netdev(netdev, "Creating vxlan netdev: %s",
                          netdev_kind_to_string(netdev->kind));