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

getent networks ip is not working #5256

Closed
pbrezina opened this issue Jul 27, 2020 · 2 comments
Closed

getent networks ip is not working #5256

pbrezina opened this issue Jul 27, 2020 · 2 comments
Labels
Closed: Fixed Issue was closed as fixed.

Comments

@pbrezina
Copy link
Member

#1000 introduced networks database support, however simple command getent networks 127.100.0.0 is not working. This command triggers getnetbyaddr and fails here because address type is unspecified (AF_UNSPEC).

This should be supported, at least glibc sources says so.

Also the current code does not support IPv6 which should work as well.

@scabrero Do you have any thoughts on this as the author?

@scabrero
Copy link
Contributor

Hi @pbrezina,

if AF_UNSPEC is received we could try to parse to an IPv4 and continue if it succeed.

But with regard to IPv6 support for network lookup I am not aware of any implementation supporting it, neither glibc files nor nss_ldap seems to support parsing IPv6 addresses. The POSIX man does not says anything about IPv4 / IPv6, but Linux man says that resulting netent-->n_addrtype is always AF_INET.

scabrero added a commit to scabrero/sssd that referenced this issue Aug 26, 2020
If type is AF_UNSPEC try to parse to a IPv4 address.

Resolves:
    SSSD#5256

Signed-off-by: Samuel Cabrero <scabrero@suse.de>
scabrero added a commit to scabrero/sssd that referenced this issue Aug 26, 2020
The address is received in host byte order, but the nss protocol
parser expects it in network byte order.

Resolves:
    SSSD#5256

Signed-off-by: Samuel Cabrero <scabrero@suse.de>
scabrero added a commit to scabrero/sssd that referenced this issue Aug 26, 2020
The inet_pton function returns the address in network byte order, but
getnetbyaddr_r expects it in host byte order.

Resolves:
    SSSD#5256

Signed-off-by: Samuel Cabrero <scabrero@suse.de>
scabrero added a commit to scabrero/sssd that referenced this issue Aug 26, 2020
Resolves:
    SSSD#5256

Signed-off-by: Samuel Cabrero <scabrero@suse.de>
scabrero added a commit to scabrero/sssd that referenced this issue Sep 29, 2020
If type is AF_UNSPEC try to parse to a IPv4 address.

Resolves:
    SSSD#5256

Signed-off-by: Samuel Cabrero <scabrero@suse.de>
scabrero added a commit to scabrero/sssd that referenced this issue Sep 29, 2020
The address is received in host byte order, but the nss protocol
parser expects it in network byte order.

Resolves:
    SSSD#5256

Signed-off-by: Samuel Cabrero <scabrero@suse.de>
scabrero added a commit to scabrero/sssd that referenced this issue Sep 29, 2020
The inet_pton function returns the address in network byte order, but
getnetbyaddr_r expects it in host byte order.

Resolves:
    SSSD#5256

Signed-off-by: Samuel Cabrero <scabrero@suse.de>
scabrero added a commit to scabrero/sssd that referenced this issue Sep 29, 2020
Resolves:
    SSSD#5256

Signed-off-by: Samuel Cabrero <scabrero@suse.de>
pbrezina pushed a commit that referenced this issue Sep 30, 2020
The address is received in host byte order, but the nss protocol
parser expects it in network byte order.

Resolves:
    #5256

Signed-off-by: Samuel Cabrero <scabrero@suse.de>

Reviewed-by: Sumit Bose <sbose@redhat.com>
pbrezina pushed a commit that referenced this issue Sep 30, 2020
The inet_pton function returns the address in network byte order, but
getnetbyaddr_r expects it in host byte order.

Resolves:
    #5256

Signed-off-by: Samuel Cabrero <scabrero@suse.de>

Reviewed-by: Sumit Bose <sbose@redhat.com>
pbrezina pushed a commit that referenced this issue Sep 30, 2020
Resolves:
    #5256

Signed-off-by: Samuel Cabrero <scabrero@suse.de>

Reviewed-by: Sumit Bose <sbose@redhat.com>
@pbrezina
Copy link
Member Author

Pushed PR: #5297

  • master
    • 7773406 - TESTS: Extend resolver tests to check getnetbyaddr with AF_UNSPEC
    • 69af684 - TESTS: Fix resolver test calling getnetbyname instead of getnetbyaddr
    • 9edc3c4 - TESTS: getnetbyaddr_r expects network in host byte order
    • a590fd9 - PROXY: getnetbyaddr_r expects the net argument in host byte order
    • 2c45695 - NSS: Fix _nss_sss_getnetbyaddr_r address byte order
    • 9d350e0 - NSS: Fix get ip network by address when address type is AF_UNSPEC
    • 430e695 - PROXY: Fix iphost not found code path in get_host_by_name_internal

@pbrezina pbrezina added the Closed: Fixed Issue was closed as fixed. label Sep 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed: Fixed Issue was closed as fixed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants