Skip to content

Filter IPv6 addresses not suitable for DNS updates#8142

Merged
alexey-tikhonov merged 2 commits into
SSSD:masterfrom
thalman:dyndns_update_ipv6_temporary
Nov 27, 2025
Merged

Filter IPv6 addresses not suitable for DNS updates#8142
alexey-tikhonov merged 2 commits into
SSSD:masterfrom
thalman:dyndns_update_ipv6_temporary

Conversation

@thalman

@thalman thalman commented Oct 14, 2025

Copy link
Copy Markdown
Contributor

Exclude IP addresses not suitable for DNS updates.

@alexey-tikhonov

Copy link
Copy Markdown
Member

Could you please add 'Resolves: #8089' line to the commit message?

@thalman

thalman commented Oct 16, 2025

Copy link
Copy Markdown
Contributor Author

Could you please add 'Resolves: #8089' line to the commit message?

Sure I will, so far it is not-working prototype

@thalman thalman changed the title Filter IPv6 addresses not suitable for DNS updates Draft: Filter IPv6 addresses not suitable for DNS updates Oct 16, 2025
@thalman
thalman force-pushed the dyndns_update_ipv6_temporary branch 2 times, most recently from 8be59bc to f54194d Compare October 21, 2025 15:23
@thalman thalman changed the title Draft: Filter IPv6 addresses not suitable for DNS updates Filter IPv6 addresses not suitable for DNS updates Oct 21, 2025
@thalman
thalman marked this pull request as ready for review October 21, 2025 15:27
@alexey-tikhonov alexey-tikhonov self-assigned this Oct 23, 2025
@justin-stephenson

Copy link
Copy Markdown
Contributor

@thalman are you able to write a test for this? or maybe QE?

@thalman

thalman commented Oct 23, 2025

Copy link
Copy Markdown
Contributor Author

@thalman are you able to write a test for this? or maybe QE?

So far I did not figured out how to mark IPv6 address temporary or deprecated. This can't be done from user space by using some tool. It might be possible to write some TCP client that will use/create temporary address and run it.

Also I was not able to figure out why DNS updates are not working in our ci containers.

Any Ideas are welcomed. Once we have such an address in CI the test is simple to write.

@justin-stephenson

Copy link
Copy Markdown
Contributor

@thalman are you able to write a test for this? or maybe QE?

So far I did not figured out how to mark IPv6 address temporary or deprecated. This can't be done from user space by using some tool. It might be possible to write some TCP client that will use/create temporary address and run it.

Also I was not able to figure out why DNS updates are not working in our ci containers.

Any Ideas are welcomed. Once we have such an address in CI the test is simple to write.

In that case a unit test would suffice, IMO.

Comment thread src/providers/be_dyndns.c Outdated
Comment thread src/providers/be_dyndns.c Outdated
@thalman
thalman force-pushed the dyndns_update_ipv6_temporary branch from f54194d to fac0f1f Compare October 23, 2025 15:50
@thalman

thalman commented Oct 23, 2025

Copy link
Copy Markdown
Contributor Author

So far I fixed the linking issue and @justin-stephenson's comments. I will think of some unit-test to be on the safe side.

@thalman

thalman commented Oct 31, 2025

Copy link
Copy Markdown
Contributor Author

@justin-stephenson Thanks for the suggestions. It took me some time to figure out the unit test. It is there as next commit.

@justin-stephenson justin-stephenson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Ack

@pbrezina
pbrezina force-pushed the master branch 2 times, most recently from f5d64b3 to b854636 Compare November 4, 2025 14:27
Comment thread Makefile.am
$(CMOCKA_LIBS) \
$(SSSD_LIBS) \
$(SSSD_INTERNAL_LTLIBS) \
$(LIBNL_LIBS) \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed in this patch?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for netlink library. I added unit test for it and there the dependency is introduced.

@alexey-tikhonov alexey-tikhonov Nov 5, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is added in a first commit - "Filter IPv6 addresses not suitable for DNS updates" - that doesn't add a test. That's why I automatically asked.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh good catch, thanks

Comment thread src/providers/be_dyndns.c
Comment thread src/providers/be_dyndns.c
}

struct sss_iface_addr *
sss_iface_addr_list_filter_addresses (struct sss_iface_addr *list,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be static?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one can, I will do it

Comment thread src/providers/be_dyndns.c
struct sss_iface_addr *prev;

struct sockaddr *addr;
int ifa_flags;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you foresee any use of this flag outside of sss_iface_addr_list_get()?

If not then I propose to apply a filter function right in the for (ifa = ifaces; ifa != NULL; ifa = ifa->ifa_next) loop, before address = talloc_zero(mem_ctx, struct sss_iface_addr);.

Imo, this would simplify the patch quite a bit.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I have read actual implementation and see that it's not so straightforward.

It feels weird that code now builds two lists - getifaddrs() and rtnl_addr_alloc_cache() - and then loops over to find matches just to call rtnl_addr_get_flags()

Would it be possible to get rid of getifaddrs() completely and rely on rtnl_addr_alloc_cache() to build (filtered on the fly) list? (Sorry in advance if question is silly.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't get rid of it completely we have to keep it for platforms that do not have netlink library. But I will think of better alternative.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have to keep it for platforms that do not have netlink library

If not (Free)BSD I would vote to make it unconditional requirement...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I will think of better alternative.

I added 'changes requested' based on this ^^
But we can go with current solution as well, thought it feels a bit awkward.

@alexey-tikhonov

Copy link
Copy Markdown
Member

@arrowd, do you build SSSD with libnl3 on FreeBSD?

@arrowd

arrowd commented Nov 5, 2025

Copy link
Copy Markdown
Contributor

We do not have libnl3. I'll look into porting it.

@thalman

thalman commented Nov 5, 2025

Copy link
Copy Markdown
Contributor Author

We do not have libnl3. I'll look into porting it.

When I was looking into this I have seen some documents about how this is done in BSD and IIRC it was much simpler and quite different from Linux. I doubt that there is the same netlink interface, but if there is then it will be worth to migrate to it completely. @arrowd please let us know.

@arrowd

arrowd commented Nov 14, 2025

Copy link
Copy Markdown
Contributor

You're right, it is much different to Linux. I made an attempt for porting libnl3 to FreeBSD, and while it might be possible at least to some extent, it clearly requires a lot of work and netlink knowledge.

@alexey-tikhonov

Copy link
Copy Markdown
Member

You're right, it is much different to Linux. I made an attempt for porting libnl3 to FreeBSD, and while it might be possible at least to some extent, it clearly requires a lot of work and netlink knowledge.

Ok, so we need to keep support building without libnl

@thalman

thalman commented Nov 27, 2025

Copy link
Copy Markdown
Contributor Author

@alexey-tikhonov, After an attempt to rewrite this completely with libnl (keeping freebsd in mind) I found out that this will be a bigger work, particularly in unit tests. Let's merge it as it is and I will work on better implementation later.

IPv6 brings a concept of address states defined in several
RFCs (RFC 2462, RFC 3041, RFC 4862). Adresses that are marked
as temporary, deprecated or tentative should not be used in
DNS updates.

This PR reads those flags via netlink interface and it
excludes addresses with those flags.

Resolves: SSSD#8089
Reviewed-by: Alexey Tikhonov <[email protected]>
Reviewed-by: Justin Stephenson <[email protected]>
IPv6 address can be marked as temporary, deprecated or
tentative. We should exclude them from  DNS updates.

Reviewed-by: Alexey Tikhonov <[email protected]>
Reviewed-by: Justin Stephenson <[email protected]>
@sssd-bot

Copy link
Copy Markdown
Contributor

The pull request was accepted by @alexey-tikhonov with the following PR CI status:


🟢 CodeFactor (success)
🟢 CodeQL (success)
NEUTRAL osh-diff-scan:fedora-rawhide-x86_64:upstream (neutral)
🟢 rpm-build:centos-stream-10-x86_64:upstream (success)
🟢 rpm-build:fedora-41-x86_64:upstream (success)
🟢 rpm-build:fedora-42-x86_64:upstream (success)
🟢 rpm-build:fedora-43-x86_64:upstream (success)
🟢 rpm-build:fedora-rawhide-x86_64:upstream (success)
🟢 Analyze (target) / All tests are successful (success)
🟢 Analyze (target) / cppcheck (success)
🟢 Build / freebsd (success)
🟢 Build / make-distcheck (success)
🟢 ci / All tests are successful (success)
🟢 ci / intgcheck (centos-10) (success)
🟢 ci / intgcheck (fedora-41) (success)
🟢 ci / intgcheck (fedora-42) (success)
🟢 ci / intgcheck (fedora-43) (success)
🟢 ci / intgcheck (fedora-44) (success)
🟢 ci / prepare (success)
🟢 ci / system (centos-10) (success)
🟢 ci / system (fedora-41) (success)
🟢 ci / system (fedora-42) (success)
🟢 ci / system (fedora-43) (success)
🟢 ci / system (fedora-44) (success)
➖ Coverity scan / coverity (skipped)
🟢 Static code analysis / All tests are successful (success)
🟢 Static code analysis / codeql (success)
🟢 Static code analysis / pre-commit (success)
🟢 Static code analysis / python-system-tests (success)


There are unsuccessful or unfinished checks. Make sure that the failures are not related to this pull request before merging.

@sssd-bot
sssd-bot force-pushed the dyndns_update_ipv6_temporary branch from 7bd3c43 to 6272ced Compare November 27, 2025 14:20
@alexey-tikhonov
alexey-tikhonov merged commit 637b7bc into SSSD:master Nov 27, 2025
11 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants