Bug 1190098

Summary: IPv6 NFS addresses are parsed incorrectly
Product: Red Hat Enterprise Linux 7 Reporter: Hathazy Laszlo <laszlo.hathazy>
Component: dracutAssignee: dracut-maint
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team-automation>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.0CC: bogdan.marincas, dracut-maint-list, eguan, harald, jiyin, mbanas, mkovarik, steved, yoyang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 12:52:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Hathazy Laszlo 2015-02-06 10:19:56 UTC
Description of problem:
This bug is very similar to the same as found in RHEL 6.4:
Bug 1029075 - Anaconda parses ipv6 addresses for nfs mounts wrong 

When specifying an nfs path containing an ipv6 address, either on the kernel cmdline as

ks=nfs:[fc00::xxxx:xxxx]:/path/to/kickstart

or in the kickstart file as the path for stage2:

nfs --server [fc00::xxxx:xxxx] --dir /opt/opsware/boot/kickstart/rhel70x64

the nfs address is parsed wrong.
The reason why this is happening is the nfs parser considers the following format: nfs:options:address:path/to/ks, not nfs:options:[address]:path/to/ks, and because of this 

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

How reproducible:

Always

Steps to Reproduce:
1. Boot RHEL 7.0 install cd with kernel argument "ks=nfs:[ipv6address]:/path/to/ks"
2. Wait for OS to load, and at a time will fail with incorrect mount options specified

Actual results:

For an example ipv6 address of [fc00:123:1:0:250:56ff:fe00:1234]

The NFS url gets parsed as:
options="[fc00"
server="123:1:0:250:56ff:fe00:1234]"
path="/path/to/kickstart"

Expected results:

Same example address:

options=""
server="[fc00:123:1:0:250:56ff:fe00:1234]"
path="/path/to/kickstart"



Additional info:
A temporary fix for this issue is modifying the usr/lib/nfs-lib.sh script with the following:
--- nfs-lib.sh.orig	2015-02-04 13:20:46.012774000 +0200
+++ nfs-lib.sh	2015-02-05 18:41:31.040445034 +0200
@@ -17,6 +17,7 @@
     # FIXME: local netif=${2:-$netif}?
     case "$1" in
         nfs://*) rfc2224_nfs_to_var "$1" ;;
+        nfs:*[*) anaconda_nfsv6_to_var "$1" ;;
         nfs:*:*:/*) anaconda_nfs_to_var "$1" ;;
         *) nfsroot_to_var "$1" ;;
     esac
@@ -86,6 +87,23 @@
     path="/${1##*:/}"
 }
 
+# IPv6 nfs path will be treated separately
+anaconda_nfsv6_to_var() {
+    nfs="nfs"
+    path="$1:"
+    options="${path#*:/}"
+    path="/${options%%:*}"
+    server="${1#*nfs:}"
+    if [[ $server == [* ]]; then 
+       server="${server%:/*}"
+       options="${options#*:*}"
+    else 
+       server="${server%:/*}"
+       options="${server%%:*}"
+       server="${server#*:}"
+    fi
+}
+
 # nfsroot_from_dhcp NETIF
 # fill in missing server/path from DHCP options.
 nfsroot_from_dhcp() {

Comment 6 errata-xmlrpc 2015-11-19 12:52:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2091.html