summaryrefslogtreecommitdiff
path: root/src/networkd.c
diff options
context:
space:
mode:
authorLukas Märdian <slyon@ubuntu.com>2021-05-17 14:00:52 +0200
committerGitHub <noreply@github.com>2021-05-17 14:00:52 +0200
commit833952e9031244091ce2aa4b7cc48a4c921b945e (patch)
treeab1cd4a8bf9c01e1e0cdcc47e873f9cc12c66cc1 /src/networkd.c
parentdd4db6b00eb813d0be1119bc451a597e5f7a10e4 (diff)
Fix ABI regression LP: #1922898 FR-1273 (#206)
In libnetplan v0.102 we introduced a regression, by breaking the ABI compatibility with netplan.io v0.101 (https://pad.lv/1922898) This happened by introducing two new settings to the NetplanNetDefinition struct (char* filename and guint tunnel.ttl), modifying the memory layout, thus breaking applications linked against older versions of libnetplan0. For char* filename, we can fix the problem by moving the new field to the end of the NetplanNetDefinition struct, thus not modifying the existing data layout, but only appending to it for the newer version. For guint netdef->tunnels.ttl we cannot easily fix the problem easily, as this is a struct inside a struct and there seems to be only one byte left (at least on x86_64) before we hit the memory boundary, while this new guint field needs 4 bytes. So we rename that field as tunnel_ttl and append it to the end of the net_definition struct. COMMITS: * Revert "Added TTL option for tunnels (LP: #1846783) (#194)" This reverts commit 6c8ed65df7c7f31280d5d27b67195a1e9a746e7a. * parse.h: move new 'filename' pointer to the end to avoid changes in the memory layout * Revert "Revert "Added TTL option for tunnels (LP: #1846783) (#194)"" This reverts commit 97d7d35704f3c3b80ba63e4f054fd8ac6303ba37. * parse: fix ABI compatibility with tunnel.ttl * doc: update tunnel_ttl documentation
Diffstat (limited to 'src/networkd.c')
-rw-r--r--src/networkd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/networkd.c b/src/networkd.c
index 05a6bf9..08cb0f1 100644
--- a/src/networkd.c
+++ b/src/networkd.c
@@ -142,8 +142,8 @@ write_tunnel_params(GString* s, const NetplanNetDefinition* def)
g_string_append_printf(params, "Mode=%s\n", tunnel_mode_to_string(def->tunnel.mode));
g_string_append_printf(params, "Local=%s\n", def->tunnel.local_ip);
g_string_append_printf(params, "Remote=%s\n", def->tunnel.remote_ip);
- if (def->tunnel.ttl)
- g_string_append_printf(params, "TTL=%u\n", def->tunnel.ttl);
+ if (def->tunnel_ttl)
+ g_string_append_printf(params, "TTL=%u\n", def->tunnel_ttl);
if (def->tunnel.input_key)
g_string_append_printf(params, "InputKey=%s\n", def->tunnel.input_key);
if (def->tunnel.output_key)