Description of Problem: The /sbin/ifup script generates (on at least one of my systems) an "integer expression expected error at line 203. It turns out that $NUMDEFROUTES is empty. One potential fix is to add a BEGIN clause to the awk command just above, like "BEGIN { nlines=0 }". How Reproducible: Seems to always happen on my ThinkPad A21p and one of my HP servers (RH 8.0, also). Have not seen it on the (RH 8.0) HP servers that is the DHCP and DNS server for the LAN. Apart from the error message, there seems to be no ill effect, but non-error error messages should be eliminated where possible. Steps to Reproduce: 1. /sbin/ifup eth0 Actual Results: from /var/log/messages: ifup: ./ifup: line 203: [: : integer expression expected Expected Results: no such error message from ifup
Can you post your /etc/sysconfig/network and /etc/sysconfig/network-scripts/ifcfg-*?
/etc/sysconfig/network: NETWORKING=yes HOSTNAME=falkor /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 BOOTPROTO=dhcp ONBOOT=yes DHCP_HOSTNAME=falkor USERCTL=no PEERDNS=yes TYPE=Ethernet
I have seen this same problem under RedHat 8.0, and now that 9 is out I have the same issue under 9. It occurs for me on any machine on a test subnet we have setup where the DHCP server does not issue a default route. I agree with heiby_rh about the solution. I used the exact same fix of initializing the nlines variable in the awk script.
*** Bug 90858 has been marked as a duplicate of this bug. ***
Still there in Rawhide with initscripts-7.24-1
I have seen this problem also. A specific example is: [root@dragon root]# ifup eth1 Determining IP information for eth1... done. /sbin/ifup: line 206: [: : integer expression expected The immediate cause is that there is no default route present in the routing table while ifup attempts to determine if there is more than one. E.g., suppose that eth1 received an address via DHCP but the DHCP server provided it with no default route. The code in question is: # DHCP likes to create duplicate routes. Fix that up. NUMDEFROUTES=`ip -o route | \ grep "^default" | \ awk '{ nlines++ } END { print nlines }'` if [ -n "$NUMDEFROUTES" -a "$NUMDEFROUTES" -gt 1 ]; then If there is no default route, then "ip | grep" produces no output, and the awk expression "nlines++" is never executed, so the value of nlines remains null, rather than 0. Adding the awk command "BEGIN { nlines = 0 }" solves the problem.
Fixed in CVS, will be in the next build