Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipapython.ipautil.UnsafeIPAddress: support netaddr older than 1.0.0 #7482

Closed
wants to merge 1 commit into from

Conversation

mastersin
Copy link

Don't use netaddr.IPAddress flags for netaddr.IPNetwork in modern python-netaddr releases.

https://pagure.io/freeipa/issue/9645

Don't use netaddr.IPAddress flags for netaddr.IPNetwork in modern
python-netaddr releases.

https://pagure.io/freeipa/issue/9645

Signed-off-by: Evgeny Sinelnikov <[email protected]>
@rcritten rcritten added the re-run Trigger a new run of PR-CI label Aug 6, 2024
@freeipa-pr-ci freeipa-pr-ci removed the re-run Trigger a new run of PR-CI label Aug 6, 2024
@rcritten rcritten added the re-run Trigger a new run of PR-CI label Aug 6, 2024
@freeipa-pr-ci freeipa-pr-ci removed the re-run Trigger a new run of PR-CI label Aug 6, 2024
@rcritten
Copy link
Contributor

rcritten commented Aug 6, 2024

You mean "newer" and not "older" in this context.

Versions > 1.0.0 do not work with the flags option, at least when the flags are set to INET_PTON, on newer versions. I'll take your word on where the cut-off is but I tested 1.3.0 and saw the same behavior where it throws:

ValueError: Unrecognized IPAddress flags value: 1

Looks like a bug in python3-netaddr that it errors with "IPAddress" and not "IPNetwork". Not something in our control.

@abbra
Copy link
Contributor

abbra commented Aug 6, 2024

The only way netaddr will throw a ValueError is when flags is not a NOHOST. This is the situation for past 14 years, so any version comparison is not really solving a problem.

        if flags & ~NOHOST:
            raise ValueError('Unrecognized IPAddress flags value: %s' % (flags,))

I think we should simply always set flags=0 to the IPNetwork() call because we never have NOHOST in there anyway.

@flo-renaud
Copy link
Contributor

PR #7535 should fix the issue.

@freeipa-pr-ci freeipa-pr-ci added the needs rebase Pull Request cannot be automatically merged - needs to be rebased label Sep 13, 2024
@abbra
Copy link
Contributor

abbra commented Sep 18, 2024

@mastersin since #7535 was merged, could you please retry master or ipa-4-12 (where #7536 was merged)? It should have a fix to this problem.
Once you have verified, we can close this PR.

@flo-renaud
Copy link
Contributor

@mastersin
I'm closing this PR as the issue should already be fixed in master and ipa-4-12 branches. Feel free to open a new ticket if that's not the case.

@flo-renaud flo-renaud closed this Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs rebase Pull Request cannot be automatically merged - needs to be rebased
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants