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

socket.gethostbyname(<hostname>) returns incorrect response #100094

Open
saudrehman00 opened this issue Dec 8, 2022 · 0 comments
Open

socket.gethostbyname(<hostname>) returns incorrect response #100094

saudrehman00 opened this issue Dec 8, 2022 · 0 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@saudrehman00
Copy link

saudrehman00 commented Dec 8, 2022

Bug report

A clear and concise description of what the bug is.
Include a minimal, reproducible example (https://stackoverflow.com/help/minimal-reproducible-example), if possible.

I am trying to use socket.gethostbyname(socket.gethostname())... It is returning an ip similar to 0.0.13.29 -> I should be getting 192.168.50.194
Alternatives I have tried include using socket.gethostbyname(socket.getfqdn())
In fairness socket.gethostname() is working correctly

It is also worthwhile to mention that should I bind a socket .getsockname() returns the same ip as above.

Your environment

  • CPython versions tested on:
  • Operating system and architecture:

Python 3.10.8 (main, Nov 14 2022, 00:00:00) [GCC 12.2.1 20220819 (Red Hat 12.2.1-2)] on linux
NAME="Fedora Linux"
VERSION="36 (Server Edition)"
ID=fedora
VERSION_ID=36
VERSION_CODENAME=""
PLATFORM_ID="platform:f36"
PRETTY_NAME="Fedora Linux 36 (Server Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:36"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f36/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=36
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=36
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
VARIANT="Server Edition"
VARIANT_ID=server

@saudrehman00 saudrehman00 added the type-bug An unexpected behavior, bug, or error label Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant