summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-03-02 15:38:01 +0100
committerThomas Haller <thaller@redhat.com>2019-03-07 17:54:25 +0100
commitf3ac8c6fe83a18c99fbbd32100924402a360e16e (patch)
treeb26343675220d33f089f273e6974098dae70815c
parent8ae9aa2428c10aafb837c692fb39bfd04ef4235c (diff)
downloadNetworkManager-f3ac8c6fe83a18c99fbbd32100924402a360e16e.tar.gz
libnm: fix return value for nm_wireguard_peer_append_allowed_ip()
According to documentation, this returns a boolean indicating whether the value is valid. Previously, it was indicating whether the instance was modified. Together with the @accept_invalid argument, both behaviors make some sense. Change it, because that is also how the other setters behave.
-rw-r--r--libnm-core/nm-setting-wireguard.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libnm-core/nm-setting-wireguard.c b/libnm-core/nm-setting-wireguard.c
index 6785bf4a4b..7629bfef4e 100644
--- a/libnm-core/nm-setting-wireguard.c
+++ b/libnm-core/nm-setting-wireguard.c
@@ -647,6 +647,7 @@ _peer_append_allowed_ip (NMWireGuardPeer *self,
int prefix;
NMIPAddr addrbin;
char *str;
+ gboolean is_valid = TRUE;
nm_assert (NM_IS_WIREGUARD_PEER (self, FALSE));
nm_assert (allowed_ip);
@@ -662,6 +663,7 @@ _peer_append_allowed_ip (NMWireGuardPeer *self,
return FALSE;
/* mark the entry as invalid by having a "X" prefix. */
str = g_strconcat (ALLOWED_IP_INVALID_X_STR, allowed_ip, NULL);
+ is_valid = FALSE;
} else {
char addrstr[NM_UTILS_INET_ADDRSTRLEN];
@@ -679,7 +681,7 @@ _peer_append_allowed_ip (NMWireGuardPeer *self,
self->allowed_ips = g_ptr_array_new_with_free_func (g_free);
g_ptr_array_add (self->allowed_ips, str);
- return TRUE;
+ return is_valid;
}
/**