mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-08 04:50:17 +01:00
core: allow omitting @src argument in nm_utils_ip6_address_clear_host_address()
For convenience, to clear the address inplace, allow to leave @src NULL, instead of requiring to set @src to @dst. The only problem is, if you make use of this extended behavior and later backport the use to an older branch, ensure that you cherry-pick this commit too. That is easy to miss, but you are testing the backport, right?
This commit is contained in:
parent
4057a31017
commit
5e5aa39c97
1 changed files with 4 additions and 2 deletions
|
|
@ -287,15 +287,17 @@ nm_utils_ip4_address_clear_host_address (in_addr_t addr, guint8 plen)
|
|||
* @plen: prefix length of network
|
||||
*
|
||||
* Note: this function is self assignment safe, to update @src inplace, set both
|
||||
* @dst and @src to the same destination.
|
||||
* @dst and @src to the same destination or set @src NULL.
|
||||
*/
|
||||
const struct in6_addr *
|
||||
nm_utils_ip6_address_clear_host_address (struct in6_addr *dst, const struct in6_addr *src, guint8 plen)
|
||||
{
|
||||
g_return_val_if_fail (plen <= 128, NULL);
|
||||
g_return_val_if_fail (src, NULL);
|
||||
g_return_val_if_fail (dst, NULL);
|
||||
|
||||
if (!src)
|
||||
src = dst;
|
||||
|
||||
if (plen < 128) {
|
||||
guint nbytes = plen / 8;
|
||||
guint nbits = plen % 8;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue