summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Andres Granados <jgranado@redhat.com>2008-05-05 13:53:58 +0200
committerJoel Andres Granados <jgranado@redhat.com>2008-05-05 13:53:58 +0200
commit159597a4e96789713e74112b0349a1a950c2fbce (patch)
treea1fdbf34a8a597b0ea7eaadbd30a7e77f2d9cffa
parent03fd949f1d49b0c8dbe7f72f6d1b505bd424e994 (diff)
downloadanaconda-159597a4e96789713e74112b0349a1a950c2fbce.tar.gz
anaconda-159597a4e96789713e74112b0349a1a950c2fbce.tar.xz
anaconda-159597a4e96789713e74112b0349a1a950c2fbce.zip
Do a better job at identifying ipv6 addresses for s390 (#362411).
Three basic things were added: 1. Reject addresses with more than one double colon sequence (10::10:10::10) 2. Reject addresses that have a lonly colon at the end (10::10:) 3. Reject addresses that have more than two consecutive colons (10:::10:10)
-rw-r--r--loader2/linuxrc.s39011
1 files changed, 10 insertions, 1 deletions
diff --git a/loader2/linuxrc.s390 b/loader2/linuxrc.s390
index 50b7db039..0400ede87 100644
--- a/loader2/linuxrc.s390
+++ b/loader2/linuxrc.s390
@@ -40,7 +40,16 @@ checkip()
checkipv6()
{
ip=$1
- echo $ip | awk -F ':' 'BEGIN{ error = 0} { if (NF > 8) error=1; i = 1; while (i++<=NF) {if (!match(toupper($i), "^[0-9A-F]*$")){ error=1}}exit error}'
+ DOUBLE_COLON_PAIRS="::[^:]+::" # ipv6 addresses dont have more than 1 ';;'
+ THREE_COLONS=":::" # ipv6 addresses dont have more that 2 consecutive colons.
+ LONLY_END_COLON="[^:]+:$" # ipv6 addresses dont have a lonly colon at the end.
+
+ HITS=`echo $ip | grep -E "($DOUBLE_COLON_PAIRS)|($THREE_COLONS)|($LONLY_END_COLON)" | wc -l`
+ if [ $HITS -gt 0 ]; then
+ return 1
+ fi
+
+ echo $ip | awk -F ':' '{ if (NF > 8 || NF < 3) exit 1; i = 1; while(i<=NF) {if (!match(toupper($i), "^[0-9A-F]*$")){ exit 1}; i++} exit 0}'
return $?;
}