mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-02 03:00:37 +01:00
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.
This commit is contained in:
parent
8ae9aa2428
commit
f3ac8c6fe8
1 changed files with 3 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue