Bug 718610

Summary: net-tools: update for two-digit versions
Product: [Fedora] Fedora Reporter: Kyle McMartin <kmcmartin>
Component: net-toolsAssignee: Jiri Popelka <jpopelka>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: iprikryl, jpopelka, peterm
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: net-tools-1.60-122.fc16 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-07-07 09:43:45 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
test both 2 and 3 none

Description Kyle McMartin 2011-07-04 01:48:10 UTC
ifconfig (and other components of net-tools) check the uname return to figure out if they should grovel /proc or just try opening sockets. Unfortunately with 3.0 version numbers, they fall back to a pre v2.1 behaviour, which results in autoloading a pile of crappy socket types (an entirely different bug.)

Prevent this by parsing both two and 3 digit Linux version numbers.

Patch attached.

(strace of the behaviour)
uname({sys="Linux", node="dreadnought.i.jkkm.org", ...}) = 0
access("/proc/net", R_OK)               = 0
socket(PF_FILE, SOCK_DGRAM, 0)          = 3
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
socket(PF_INET6, SOCK_DGRAM, IPPROTO_IP) = 5
socket(PF_AX25, SOCK_DGRAM, 0)          = -1 EAFNOSUPPORT (Address family not supported by protocol)
socket(PF_NETROM, SOCK_SEQPACKET, 0)    = -1 EAFNOSUPPORT (Address family not supported by protocol)
socket(PF_ROSE, SOCK_DGRAM, 0)          = -1 ESOCKTNOSUPPORT (Socket type not supported)
socket(PF_IPX, SOCK_DGRAM, [PF_UNSPEC]) = 6

(normal strace)
uname({sys="Linux", node="feynman.i.jkkm.org", ...}) = 0
access("/proc/net", R_OK)               = 0
access("/proc/net/unix", R_OK)          = 0
socket(PF_FILE, SOCK_DGRAM, 0)          = 3
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
access("/proc/net/if_inet6", R_OK)      = 0
socket(PF_INET6, SOCK_DGRAM, IPPROTO_IP) = 5
access("/proc/net/ax25", R_OK)          = -1 ENOENT (No such file or directory)

Comment 1 Kyle McMartin 2011-07-04 03:11:02 UTC
Created attachment 511097 [details]
test both 2 and 3

Comment 2 Jiri Popelka 2011-07-07 09:43:45 UTC
Thanks for the patch! Applied in net-tools-1.60-122.fc16.

Comment 3 Kyle McMartin 2011-07-15 18:10:26 UTC
Thanks very much, I'll update you when we know what the version number for 3.0 will finally be, we may be able to drop the patch.

--Kyle

Comment 4 Jiri Popelka 2012-01-05 15:19:36 UTC
The uts.release string looks like '3.1.6-1.fc16.x86_64'
on my machine, so the
sscanf(uts.release, "%d.%d.%d", &major, &minor, &patch)
returns 3.

Does that mean we can eventually drop the patch ?

Comment 5 Kyle McMartin 2012-01-05 15:21:57 UTC
Yes, Linus changed his mind when he released 3.0.

regards, Kyle