summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-08-08 17:40:37 +0200
committerThomas Haller <thaller@redhat.com>2022-08-09 08:02:42 +0200
commit92fe4c383eca478ed3f59bb29af96777ff40baab (patch)
tree9cd2e0859c10902edbb5cc99519eea34f286e825
parent413c1e3fa03cb11dcf2e3b1449516d8ce555bf2f (diff)
downloadNetworkManager-92fe4c383eca478ed3f59bb29af96777ff40baab.tar.gz
platform: use NLA_NEST_END() macro in _wireguard_create_change_nlmsgs()
-rw-r--r--src/libnm-platform/nm-linux-platform.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/src/libnm-platform/nm-linux-platform.c b/src/libnm-platform/nm-linux-platform.c
index 27904d4570..37cef59261 100644
--- a/src/libnm-platform/nm-linux-platform.c
+++ b/src/libnm-platform/nm-linux-platform.c
@@ -2873,14 +2873,6 @@ _wireguard_create_change_nlmsgs(NMPlatform *platfo
struct nlattr *nest_curr_allowed_ip;
NMPlatformWireGuardChangePeerFlags p_flags = NM_PLATFORM_WIREGUARD_CHANGE_PEER_FLAG_DEFAULT;
-#define _nla_nest_end(msg, nest_start) \
- G_STMT_START \
- { \
- if (nla_nest_end((msg), (nest_start)) < 0) \
- g_return_val_if_reached(-NME_BUG); \
- } \
- G_STMT_END
-
/* Adapted from LGPL-2.1+ code [1].
*
* [1] https://git.zx2c4.com/WireGuard/tree/contrib/examples/embeddable-wg-library/wireguard.c?id=5e99a6d43fe2351adf36c786f5ea2086a8fe7ab8#n1073 */
@@ -3036,36 +3028,36 @@ again:
if (nla_put_uint8(msg, WGALLOWEDIP_A_CIDR_MASK, aip->mask) < 0)
goto toobig_allowedips;
- _nla_nest_end(msg, nest_curr_allowed_ip);
+ NLA_NEST_END(msg, nest_curr_allowed_ip);
nest_curr_allowed_ip = NULL;
}
idx_allowed_ips_curr = IDX_NIL;
- _nla_nest_end(msg, nest_allowed_ips);
+ NLA_NEST_END(msg, nest_allowed_ips);
nest_allowed_ips = NULL;
}
}
- _nla_nest_end(msg, nest_curr_peer);
+ NLA_NEST_END(msg, nest_curr_peer);
nest_curr_peer = NULL;
}
- _nla_nest_end(msg, nest_peers);
+ NLA_NEST_END(msg, nest_peers);
goto send;
toobig_allowedips:
if (nest_curr_allowed_ip)
nla_nest_cancel(msg, nest_curr_allowed_ip);
if (nest_allowed_ips)
- _nla_nest_end(msg, nest_allowed_ips);
- _nla_nest_end(msg, nest_curr_peer);
- _nla_nest_end(msg, nest_peers);
+ NLA_NEST_END(msg, nest_allowed_ips);
+ NLA_NEST_END(msg, nest_curr_peer);
+ NLA_NEST_END(msg, nest_peers);
goto send;
toobig_peers:
if (nest_curr_peer)
nla_nest_cancel(msg, nest_curr_peer);
- _nla_nest_end(msg, nest_peers);
+ NLA_NEST_END(msg, nest_peers);
goto send;
send:
@@ -3081,8 +3073,6 @@ send:
nla_put_failure:
g_return_val_if_reached(-NME_BUG);
-
-#undef _nla_nest_end
}
static int