summaryrefslogtreecommitdiff
path: root/src/devices/nm-device-ip-tunnel.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-08-22 09:28:39 +0200
committerThomas Haller <thaller@redhat.com>2019-08-28 16:27:00 +0200
commitdc275121847fcfd02aeeb6360309e54300ebf3d4 (patch)
treeda260bde15bbe65f51733458434ff82fa0c922ef /src/devices/nm-device-ip-tunnel.c
parentcca0c2b56a4c637d8fc222353126b6f46187ba53 (diff)
downloadNetworkManager-dc275121847fcfd02aeeb6360309e54300ebf3d4.tar.gz
device: don't let subclasses call NMDevice's act_stage1_prepare()
NMDevice's act_stage1_prepare() now does nothing. Calling it is not useful and has no effect. In general, when a subclass overwrites a virtual function, it must be defined whether the subclass must, may or must-not call the parents implementation. Likewise, it must be clear when the parents implementation should be chained: first, as last, does it matter? In any case, that very much depends on how the parent is implemented and this can only be solved by documentation and common conventions. It's a forgiving approach to have a parents implementation do nothing, then the subclass may call it at any time (or not call it at all). This is especially useful if classes don't know their parent class well. But in NetworkManager code the relationship between classes are known at compile time, so every of these classes knows it derives directly from NMDevice. This forgingin approach was what NMDevice's act_stage1_prepare() was doing. However, it also adds lines of code resulting in a different kind of complexity. So, it's not clear that this forgiving approach is really better. Note that it also has a (tiny) runtime and code-size overhead. Change the expectation of how NMDevice's act_stage1_prepare() should be called: it is no longer implemented, and subclasses *MUST* not chain up.
Diffstat (limited to 'src/devices/nm-device-ip-tunnel.c')
-rw-r--r--src/devices/nm-device-ip-tunnel.c6
1 files changed, 0 insertions, 6 deletions
diff --git a/src/devices/nm-device-ip-tunnel.c b/src/devices/nm-device-ip-tunnel.c
index ede4487e3a..a490ea4cd2 100644
--- a/src/devices/nm-device-ip-tunnel.c
+++ b/src/devices/nm-device-ip-tunnel.c
@@ -968,12 +968,6 @@ set_property (GObject *object, guint prop_id,
static NMActStageReturn
act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
{
- NMActStageReturn ret;
-
- ret = NM_DEVICE_CLASS (nm_device_ip_tunnel_parent_class)->act_stage1_prepare (device, out_failure_reason);
- if (ret != NM_ACT_STAGE_RETURN_SUCCESS)
- return ret;
-
if (!nm_device_hw_addr_set_cloned (device, nm_device_get_applied_connection (device), FALSE))
return NM_ACT_STAGE_RETURN_FAILURE;