Commit 5e5aa39c authored by Thomas Haller's avatar Thomas Haller

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?
parent 4057a310
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment