installer/netcfg gives misleading error message when parsing line with trailing blanks

Bug #1541955 reported by bugproxy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
debian-installer (Ubuntu)
Fix Released
Low
Dimitri John Ledkov
netcfg (Ubuntu)
Fix Released
Low
Dimitri John Ledkov

Bug Description

== Comment: #0 - Thorsten Diehl - 2016-02-04 08:52:12 ==
During the very early phase of the installer (build 416) within the z/VM console, when I enter e.g. the IP address and append by accident one ore more trailing blanks, the IP address is treated as malformed.
Recommendation: leading and trailing blanks should be ignored.

Configure a network using static addressing
-------------------------------------------

The IP address is unique to your computer and may be:

 * four numbers separated by periods (IPv4);
 * blocks of hexadecimal characters separated by colons (IPv6).

You can also optionally append a CIDR netmask (such as "/24").

If you don't know what to use here, consult your network administrator.
IP address:
Prompt: '?' for help> 9.152.162.103
9.152.162.103

!! ERROR: Malformed IP address

The IP address you provided is malformed. It should be in the form x.x.x.x
where each 'x' is no larger than 255 (an IPv4 address), or a sequence of blocks

of hexadecimal digits separated by colons (an IPv6 address). Please try again.
?Press enter to continue?

bugproxy (bugproxy)
tags: added: architecture-s39064 bugnameltc-136619 severity-low targetmilestone-inin1604
Changed in ubuntu:
assignee: nobody → Skipper Bug Screeners (skipper-screen-team)
Kevin W. Rudd (kevinr)
affects: ubuntu → debian-installer (Ubuntu)
dann frazier (dannf)
Changed in debian-installer (Ubuntu):
assignee: Skipper Bug Screeners (skipper-screen-team) → Dimitri John Ledkov (xnox)
Changed in netcfg (Ubuntu):
assignee: nobody → Dimitri John Ledkov (xnox)
Changed in netcfg (Ubuntu):
status: New → Confirmed
importance: Undecided → Low
Changed in debian-installer (Ubuntu):
status: New → Confirmed
importance: Undecided → Low
bugproxy (bugproxy)
tags: removed: bugnameltc-136619 severity-low
bugproxy (bugproxy)
tags: added: bugnameltc-136619 severity-low
Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2016-03-18 12:49 EDT-------
Package: netcfg
Version: 1.137
Severity: normal
Tags: d-i

Dear maintainer(s),

when specifying IP addresses with leading or trailing blanks, netcfg does not
correctly identify the IP address and fails. For example,

Configure a network using static addressing
-------------------------------------------

The IP address is unique to your computer and may be:

* four numbers separated by periods (IPv4);
* blocks of hexadecimal characters separated by colons (IPv6).

You can also optionally append a CIDR netmask (such as "/24").

If you don't know what to use here, consult your network administrator.
IP address:
Prompt: '?' for help> 9.152.162.103
9.152.162.103

!! ERROR: Malformed IP address

The IP address you provided is malformed. It should be in the form x.x.x.x
where each 'x' is no larger than 255 (an IPv4 address), or a sequence of blocks

of hexadecimal digits separated by colons (an IPv6 address). Please try again.
Press enter to continue

This can easily happen, especially, when entering IP addresses within
command line console, such as the z/VM console on z Systems (s390x).

The expected behavior is that leading and trailing blanks should be ignored.
Note that the root cause of the error condition above is triggered by a
failing inet_pton() call which does not expect blanks for an IP address
string.

To correct this behavior, I have attached two patches for discussion:

The first patch removes trailing blanks for the case above. Note that there
is already an rtrim() function that has been reused. Also an additional
function, strtrim(), is introduced to remove any leading blanks.
The "make test" has been enhanced to verify this behavior.

The second patch removes leading and trailing blanks on IP addresses entered
for other network configurations, for example, point-to-point.

The patch are attached on the related Debian bug report at:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=818611

Changed in debian-installer (Ubuntu):
status: Confirmed → In Progress
Changed in netcfg (Ubuntu):
status: Confirmed → Fix Committed
Revision history for this message
Dimitri John Ledkov (xnox) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package netcfg - 1.135ubuntu2

---------------
netcfg (1.135ubuntu2) xenial; urgency=medium

  Cherrypick commits from debian netcfg master.

  [ Hendrik Brueckner ]
  * common/ipaddr: remove leading and trailing whitespaces
  * static: trim user-specified values for IP and other addresses
  * Closes: #818611, LP: #1541955

  [ Dimitri John Ledkov ]
  * Makefile: link with -lm to resolve undefined log and other functions

 -- Dimitri John Ledkov <email address hidden> Thu, 31 Mar 2016 13:55:14 +0100

Changed in netcfg (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

I have rebuild d-i with updated netcfg and it appears that I am still seeing "Malformed IP address" notices from netcfg. This is with z/VM installation. I guess i should rebuild a debug version which logs actual characters that are communicated across. This is with apl charset.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

actually, this is all good - booted out of date installer.

Changed in debian-installer (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package debian-installer - 20101020ubuntu445

---------------
debian-installer (20101020ubuntu445) xenial; urgency=medium

  * Add necessory files to enable FTP Load / IPL on s390x, ported from
    debian-cd.
  * Drop s390-dasd, is now pulled in via hw-detect /
    harddrive-detection-dasd.
  * Rebuild with ipv6 capable network-console. LP: #1552368

 -- Dimitri John Ledkov <email address hidden> Tue, 05 Apr 2016 09:51:35 +0100

Changed in debian-installer (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
bugproxy (bugproxy) wrote :

------- Comment From <email address hidden> 2016-04-07 04:33 EDT-------
sucessfully verified with installer version 445. Closed.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.