Description of problem: gethostbyname(gethostname()) is wrong when IP is changed Version-Release number of selected component (if applicable): libxml2-python-2.6.26-2.1.2.8 libselinux-python-1.33.4-5.5.el5 audit-libs-python-1.7.17-3.el5 python-iniparse-0.2.3-4.el5 python-urlgrabber-3.1.0-5.el5 notify-python-0.1.0-3.fc6 gnome-python2-bonobo-2.16.0-1.fc6 MySQL-python-1.2.1-1 python-dmidecode-3.10.8-4.el5 python-sqlite-1.1.7-1.2.1 gamin-python-0.1.7-8.el5 python-numeric-23.7-2.2.2 python-elementtree-1.2.6-5 gnome-python2-canvas-2.16.0-1.fc6 gnome-python2-gconf-2.16.0-1.fc6 python-2.4.3-27.el5 dbus-python-0.70-9.el5_4 rpm-python-4.4.2.3-18.el5 gnome-python2-2.16.0-1.fc6 gnome-python2-gnomevfs-2.16.0-1.fc6 rhts-devel-python-3.3-54.el5 How reproducible: Steps to Reproduce: 1. install machine, have a fixed hostname up to mac address 1.1.1.1 = machine.something.com 2. wait a week or longer when your local dhcp server changes your IP but not hostname 1.1.1.159 = machine.something.com [root.com ~]# host machine.something.com machine.something.com has address 1.1.1.159 ifconfig shows the same 3. gethostbyname(gethostname()) shows wrong IP, the original one Actual results: [root.com ~]# python Python 2.4.3 (#1, Jun 11 2009, 14:09:37) [GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from socket import gethostname >>> from socket import gethostbyname >>> gethostname() 'machine.something.com' >>> gethostbyname(gethostname()) '1.1.1.1' >>> Expected results: gethostbyname(gethostname()) will return your actual IP, 1.1.1.159 Additional info:
This is IMHO not python bug, but probably initscripts component. gethostbyname() just utilize /etc/hosts and this file will have 1.1.1.159 machine.something.com There is nothing else python can do. The problem is that network script do not change /etc/hosts.
This request was evaluated by Red Hat Product Management for inclusion in Red Hat Enterprise Linux 5.6 and Red Hat does not plan to fix this issue the currently developed update. Contact your manager or support representative in case you need to escalate this bug.
Development Management has reviewed and declined this request. You may appeal this decision by reopening this request.