Bug 19440 - eth_devices.sort() in /etc/hosts
eth_devices.sort() in /etc/hosts
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Network
UCS 2.4
Other Linux
: P5 enhancement (vote)
: UCS 3.1
Assigned To: Philipp Hahn
Janek Walkenhorst
: interim-1
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-08-13 12:33 CEST by Janis Meybohm
Modified: 2012-12-12 21:09 CET (History)
3 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Janis Meybohm univentionstaff 2010-08-13 12:33:40 CEST
Im Template der /etc/network/interfaces wird die Liste der Interfaces sortiert, im Template von /etc/hosts geschieht dies nicht. Ist vermutlich nicht tragisch, führt aber dazu "socket.getaddrinfo('HOSTNAME', None, socket.AF_INET)" als erste Adresse nicht unbeding die Adresse von eth0 zurückgibt (bug19439).
Comment 1 Philipp Hahn univentionstaff 2012-08-08 14:05:24 CEST
Die Sortierung in der /etc/hosts-Datei wirkt sich auf die Reihenfolge von socket.getaddrinfo() aus:

# grep foo /etc/hosts
2.3.4.5 foo1
1.2.3.4 foo1
3.4.5.6 foo2
4.5.6.7 foo2

# python -c 'import socket,sys;print socket.getaddrinfo(sys.argv[1], None, socket.AF_INET, socket.SOCK_STREAM, socket.SOL_TCP)' foo1
[(2, 1, 6, '', ('2.3.4.5', 0)), (2, 1, 6, '', ('1.2.3.4', 0))]

# python -c 'import socket,sys;print socket.getaddrinfo(sys.argv[1], None, socket.AF_INET, socket.SOCK_STREAM, socket.SOL_TCP)' foo2
[(2, 1, 6, '', ('3.4.5.6', 0)), (2, 1, 6, '', ('4.5.6.7', 0))]

svn34718, univention-base-files_2.0.1-1.90.201208081403

Changeog: svn14250
\item Modify \ucsUCR{}-Template to order host addesses in \ucsFile{/etc/hosts} by the network interface name (\ucsBug{19440}).
Comment 2 Tim Petersen univentionstaff 2012-09-12 09:48:18 CEST
Aufgefallen an Ticket #2012082421000978:
Verwendet man ein virtuelles Interface eth0:0 und man möchte die entsprechende IP-Adresse nicht in samba/interfaces hinterlegen, kommt es zu Problemen mit s4search.
Hintergrund ist, dass aufgrund der fehlenden Sortierung im Template die Adresse von eth0:0 "oben" steht und s4search versucht eine Verbindung gegen die entsprechende IP aufzubauen - das wird ohne Eintrag in der samba/interfaces abgelehnt.
Comment 3 Tim Petersen univentionstaff 2012-09-12 10:02:18 CEST
Umgehen werden kann dies unter Umständen, indem man die Variable interfaces/<interface>/hosts setzt. Hierüber kann ein alternativer Name spezifiziert werden - ein leerer String führt dazu, dass die IP nicht eingetragen wird.
Comment 4 Janek Walkenhorst univentionstaff 2012-09-12 16:14:27 CEST
Einträge in /etc/hosts sind wie in /etc/network/interfaces sortiert: OK
(Einträge von "virtuellen" Schnittstellen sortieren nach hinten: OK)
Changelog: OK
Comment 5 Stefan Gohmann univentionstaff 2012-12-12 21:09:17 CET
UCS 3.1-0 has been released: 
 http://forum.univention.de/viewtopic.php?f=54&t=2125

If this error occurs again, please use "Clone This Bug".