client/rhel/rhn-client-tools/rhn-client-tools.spec | 9 +- client/rhel/rhn-client-tools/src/up2date_client/hardware.py | 54 +++++------- rel-eng/packages/rhn-client-tools | 2 3 files changed, 34 insertions(+), 31 deletions(-)
New commits: commit 87fb465638eb66f566d35d6779070e261905b4ab Author: Miroslav Suchý msuchy@redhat.com Date: Fri Dec 2 14:19:14 2011 +0100
Automatic commit of package [rhn-client-tools] release [1.6.39-1].
diff --git a/client/rhel/rhn-client-tools/rhn-client-tools.spec b/client/rhel/rhn-client-tools/rhn-client-tools.spec index 9b8d624..2758c51 100644 --- a/client/rhel/rhn-client-tools/rhn-client-tools.spec +++ b/client/rhel/rhn-client-tools/rhn-client-tools.spec @@ -4,7 +4,7 @@ Group: System Environment/Base Source0: https://fedorahosted.org/releases/s/p/spacewalk/%%7Bname%7D-%%7Bversion%7D.t... URL: https://fedorahosted.org/spacewalk Name: rhn-client-tools -Version: 1.6.38 +Version: 1.6.39 Release: 1%{?dist} BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch @@ -334,6 +334,13 @@ make -f Makefile.rhn-client-tools test %endif
%changelog +* Fri Dec 02 2011 Miroslav Suchý 1.6.39-1 +- IPv6: first try findHostByRoute() and then try getaddrinfo() +- IPv6: assign to hostname only if we are unable to resolve it +- IPv6: IPv4 is most probably set up better, lets overwrite IPv6 values (if + mismatch) +- 743259 - take hostname of client instead of server + * Tue Nov 29 2011 Miroslav Suchý 1.6.38-1 - define __init__, __getattribute__, __setattr__ on Debian and workaround those mising methods on RHEL5 diff --git a/rel-eng/packages/rhn-client-tools b/rel-eng/packages/rhn-client-tools index acf9c10..769ba24 100644 --- a/rel-eng/packages/rhn-client-tools +++ b/rel-eng/packages/rhn-client-tools @@ -1 +1 @@ -1.6.38-1 client/rhel/rhn-client-tools/ +1.6.39-1 client/rhel/rhn-client-tools/
commit ea2d344fc0be493428ff2b9a1659e5c22b1ba5c8 Author: Miroslav Suchý msuchy@redhat.com Date: Fri Dec 2 14:10:47 2011 +0100
IPv6: first try findHostByRoute() and then try getaddrinfo()
in case host has multiple IP (like google.com) it will get more sane results
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/hardware.py b/client/rhel/rhn-client-tools/src/up2date_client/hardware.py index 30f24a3..86500ca 100644 --- a/client/rhel/rhn-client-tools/src/up2date_client/hardware.py +++ b/client/rhel/rhn-client-tools/src/up2date_client/hardware.py @@ -488,34 +488,28 @@ def read_network(): netdict = {} netdict['class'] = "NETINFO"
- netdict['hostname'] = gethostname() - try: - list_of_addrs = getaddrinfo(gethostname(), None) - ipv4_addrs = filter(lambda x:x[0]==socket.AF_INET, list_of_addrs) - # take first ipv4 addr - netdict['ipaddr'] = ipv4_addrs[0][4][0] - except: - netdict['ipaddr'] = "127.0.0.1" + netdict['hostname'], netdict['ipaddr'], netdict['ip6addr'] = findHostByRoute()
- try: - list_of_addrs = getaddrinfo(gethostname(), None) - ipv6_addrs = filter(lambda x:x[0]==socket.AF_INET6, list_of_addrs) - # take first ipv6 addr - netdict['ip6addr'] = ipv6_addrs[0][4][0] - except: - netdict['ip6addr'] = "::1" - - if netdict['hostname'] == 'localhost.localdomain' or \ - netdict['ipaddr'] == "127.0.0.1" or \ - netdict['ip6addr'] == "::1": - hostname, ipaddr, ip6addr = findHostByRoute() - - if netdict['hostname'] == 'localhost.localdomain': - netdict['hostname'] = hostname - if netdict['ipaddr'] == "127.0.0.1": - netdict['ipaddr'] = ipaddr - if netdict['ip6addr'] == "::1": - netdict['ip6addr'] = ip6addr + if netdict['hostname'] == "unknown": + netdict['hostname'] = gethostname() + + if netdict['ipaddr'] is None: + try: + list_of_addrs = getaddrinfo(netdict['hostname'], None) + ipv4_addrs = filter(lambda x:x[0]==socket.AF_INET, list_of_addrs) + # take first ipv4 addr + netdict['ipaddr'] = ipv4_addrs[0][4][0] + except: + netdict['ipaddr'] = "127.0.0.1" + + if netdict['ip6addr'] is None: + try: + list_of_addrs = getaddrinfo(netdict['hostname'], None) + ipv6_addrs = filter(lambda x:x[0]==socket.AF_INET6, list_of_addrs) + # take first ipv6 addr + netdict['ip6addr'] = ipv6_addrs[0][4][0] + except: + netdict['ip6addr'] = "::1"
if netdict['ipaddr'] is None: netdict['ipaddr'] = ''
commit 120f042027d5f2829dc152aadec658cca9d2252d Author: Miroslav Suchý msuchy@redhat.com Date: Thu Dec 1 10:34:55 2011 +0100
IPv6: assign to hostname only if we are unable to resolve it
getfqdn() return its parameter if it can be resolved. in this case we try to determine it in next loop or leave it as unknown
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/hardware.py b/client/rhel/rhn-client-tools/src/up2date_client/hardware.py index 6bbb290..30f24a3 100644 --- a/client/rhel/rhn-client-tools/src/up2date_client/hardware.py +++ b/client/rhel/rhn-client-tools/src/up2date_client/hardware.py @@ -433,7 +433,9 @@ def findHostByRoute(): intf = intf_tmp else: intf6 = intf_tmp - hostname = socket.getfqdn(intf_tmp) + hostname_tmp = socket.getfqdn(intf_tmp) + if hostname_tmp != intf_tmp: + hostname = hostname_tmp except socket.error: s.close() continue
commit 94e5593adca38cd5dc4358c020fef6f2e8e2f1a2 Author: Miroslav Suchý msuchy@redhat.com Date: Thu Dec 1 10:31:43 2011 +0100
IPv6: IPv4 is most probably set up better, lets overwrite IPv6 values (if mismatch)
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/hardware.py b/client/rhel/rhn-client-tools/src/up2date_client/hardware.py index d85d5d0..6bbb290 100644 --- a/client/rhel/rhn-client-tools/src/up2date_client/hardware.py +++ b/client/rhel/rhn-client-tools/src/up2date_client/hardware.py @@ -417,7 +417,7 @@ def findHostByRoute(): servertype = serverUrl.split(':')[0] port = st[servertype]
- for family in (AF_INET, AF_INET6): + for family in (AF_INET6, AF_INET): s = socket.socket(family)
if cfg['enableProxy']:
spacewalk-commits@lists.fedorahosted.org