Bug 193609

Summary: Error manually configuring network interface in text-mode install
Product: [Fedora] Fedora Reporter: Chris Tracy <redhat>
Component: anacondaAssignee: Anaconda Maintenance Team <anaconda-maint-list>
Status: CLOSED RAWHIDE QA Contact: Mike McLean <mikem>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: dchapman
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-06-15 20:24:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Small python script to illustrate the issue none

Description Chris Tracy 2006-05-31 03:41:42 UTC
Created attachment 130252 [details]
Small python script to illustrate the issue

Comment 1 Chris Tracy 2006-05-31 03:41:42 UTC
Description of problem:
Trying to install rawhide on an opteron system.  (Sun Ultra 20)  Doing a
network-install via PXE and FTP.

I uncheck "Configure using DHCP" and leave "Activate on boot" selected.
Fill out the IP address and netmask fields with valid info (the same info the
box is currently using inside anaconda, actually):

IP Address: 10.0.0.3
Netmask: 255.255.255.0

Click "OK" and I get a message box saying:

"You must enter valid IP information to continue"

If I recheck "Configure using DHCP" it works fine.  If I uncheck "Activate
on boot" I can proceed, but I do want this interface activated on boot.  :-)

Version-Release number of selected component (if applicable):
anaconda-11.1.0.21 (x86_64)


How reproducible:
Happens to me on this system every time.  Don't have another available to test.


Steps to Reproduce:
1.  PXE boot the rawhide kernel image/initrd.
2.  Use text mode install.  (Happened automatically here, a regression that I've
not tracked down yet)
3.  Uncheck "Configure using DHCP" when prompted, supply valid IP and netmask.
  
Actual results:
Message box containing error:
You must enter valid IP information to continue

Expected results:
No error, install should proceed to the next screen.

Additional info:

Dropping to the debugger in anaconda, I see that in textw/network_text.py:171
there's a call to isys.inet_calcNetBroad which leads to isys/isys.py:417
a call to inet_aton, which in turn is at isys.py:393.

The kicker here is the line:

return struct.unpack('L', socket.inet_aton(addr))[0]

single stepping through with the debugger, the call to
"struct.unpack" is failing with the error:

struct.error: unpack str size does not match format

I created a small test program that basically does the same thing as inet_aton()
here.  On my i686 FC3 box (python-2.3.4) it works fine.  On a CentOS 4.3 x86_64
box I have access to (python-2.3.4) it fails with the same "struct.error: ..."

(I've attached the program to this bug)

Linux defines "struct in_addr" to contain one field, "__u32 saddr", an explicit
32-bit unsigned int.  So changing the struct.unpack() format string from
'L' to 'I' would seem to be the right thing to do.  And indeed, my test program
works correctly on both i686 and x86_64 when done that way.

I've not rebuilt anaconda and tried to test the patch there, however, and I'm
largely out of my depth here, so I could be all wrong.  Hopefully this is at
least somewhat helpful, however.

Comment 2 Chris Lumens 2006-05-31 14:06:58 UTC
Yep, we noticed this after FC5 went out as well.  It has been fixed in anaconda.
 Here's the appropriate patch:

RCS file: /usr/local/CVS/anaconda/isys/isys.py,v
retrieving revision 1.165
retrieving revision 1.166
diff -u -r1.165 -r1.166
--- isys.py     30 Mar 2006 18:06:41 -0000      1.165
+++ isys.py     26 Apr 2006 15:49:47 -0000      1.166
@@ -27,6 +27,7 @@
 import warnings
 import resource
 import rhpl
+import struct
 
 import logging
 log = logging.getLogger("anaconda")
@@ -387,11 +388,11 @@
 
 # XXX: Use socket.getnameinfo for ipv6 compatibility
 def inet_ntoa (addr):
-    return socket.inet_ntoa(addr)
+    return socket.inet_ntoa(struct.pack('l', addr))
     
 def inet_aton (addr):
     try:
-        return socket.inet_aton(addr)
+        return struct.unpack('L', socket.inet_aton(addr))[0]
     except:
         raise ValueError


Comment 3 Chris Lumens 2006-05-31 15:29:33 UTC
Oh sorry, I didn't read carefully enough.  Thanks for the patch - we only tested
this on i386.  Committing the fix.

Comment 4 Chris Lumens 2006-06-01 21:12:55 UTC
*** Bug 193824 has been marked as a duplicate of this bug. ***

Comment 5 Doug Chapman 2006-06-14 15:03:03 UTC
Has the patch been applied to the rawhide tree?  We are still seeing this
failure on rawhide-20060614 anaconda-11.1.0.33-1 at least on ia64.


Comment 6 Chris Lumens 2006-06-15 20:24:02 UTC
Jeremy committed a fix for this today.  This code should be dying in the future
though.