|
|
18971c |
From 368f08cb7efca9738292859e179da269597412e4 Mon Sep 17 00:00:00 2001
|
|
|
18971c |
From: Harald Hoyer <harald@redhat.com>
|
|
|
18971c |
Date: Wed, 14 Jan 2015 11:28:16 +0100
|
|
|
18971c |
Subject: [PATCH] network: add support for comma separated autoconf options
|
|
|
18971c |
|
|
|
18971c |
ip=eth0:auto6,dhcp
|
|
|
18971c |
|
|
|
18971c |
might work now
|
|
|
18971c |
---
|
|
|
18971c |
modules.d/40network/ifup.sh | 24 ++++++++++--------
|
|
|
18971c |
modules.d/40network/parse-ip-opts.sh | 38 +++++++++++++++-------------
|
|
|
18971c |
2 files changed, 33 insertions(+), 29 deletions(-)
|
|
|
18971c |
|
|
|
18971c |
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
|
|
|
18971c |
index 67b1d9f8..8749c4c2 100755
|
|
|
18971c |
--- a/modules.d/40network/ifup.sh
|
|
|
18971c |
+++ b/modules.d/40network/ifup.sh
|
|
|
18971c |
@@ -326,17 +326,19 @@ for p in $(getargs ip=); do
|
|
|
18971c |
eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
|
|
|
18971c |
done > /tmp/net.$netif.override
|
|
|
18971c |
|
|
|
18971c |
- case $autoconf in
|
|
|
18971c |
- dhcp|on|any)
|
|
|
18971c |
- do_dhcp -4 ;;
|
|
|
18971c |
- dhcp6)
|
|
|
18971c |
- load_ipv6
|
|
|
18971c |
- do_dhcp -6 ;;
|
|
|
18971c |
- auto6)
|
|
|
18971c |
- do_ipv6auto ;;
|
|
|
18971c |
- *)
|
|
|
18971c |
- do_static ;;
|
|
|
18971c |
- esac
|
|
|
18971c |
+ for autoopt in $(str_replace "$autoconf" "," " "); do
|
|
|
18971c |
+ case $autoopt in
|
|
|
18971c |
+ dhcp|on|any)
|
|
|
18971c |
+ do_dhcp -4 ;;
|
|
|
18971c |
+ dhcp6)
|
|
|
18971c |
+ load_ipv6
|
|
|
18971c |
+ do_dhcp -6 ;;
|
|
|
18971c |
+ auto6)
|
|
|
18971c |
+ do_ipv6auto ;;
|
|
|
18971c |
+ *)
|
|
|
18971c |
+ do_static ;;
|
|
|
18971c |
+ esac
|
|
|
18971c |
+ done
|
|
|
18971c |
|
|
|
18971c |
> /tmp/net.${netif}.up
|
|
|
18971c |
|
|
|
18971c |
diff --git a/modules.d/40network/parse-ip-opts.sh b/modules.d/40network/parse-ip-opts.sh
|
|
|
18971c |
index b029d007..5b96e069 100755
|
|
|
18971c |
--- a/modules.d/40network/parse-ip-opts.sh
|
|
|
18971c |
+++ b/modules.d/40network/parse-ip-opts.sh
|
|
|
18971c |
@@ -66,24 +66,26 @@ for p in $(getargs ip=); do
|
|
|
18971c |
fi
|
|
|
18971c |
|
|
|
18971c |
# Error checking for autoconf in combination with other values
|
|
|
18971c |
- case $autoconf in
|
|
|
18971c |
- error) die "Error parsing option 'ip=$p'";;
|
|
|
18971c |
- bootp|rarp|both) die "Sorry, ip=$autoconf is currenty unsupported";;
|
|
|
18971c |
- none|off)
|
|
|
18971c |
- [ -z "$ip" ] && \
|
|
|
18971c |
- die "For argument 'ip=$p'\nValue '$autoconf' without static configuration does not make sense"
|
|
|
18971c |
- [ -z "$mask" ] && \
|
|
|
18971c |
- die "Sorry, automatic calculation of netmask is not yet supported"
|
|
|
18971c |
- ;;
|
|
|
18971c |
- auto6);;
|
|
|
18971c |
- dhcp|dhcp6|on|any) \
|
|
|
18971c |
- [ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
|
|
|
18971c |
- die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
|
|
|
18971c |
- [ -n "$ip" ] && \
|
|
|
18971c |
- die "For argument 'ip=$p'\nSorry, setting client-ip does not make sense for '$autoconf'"
|
|
|
18971c |
- ;;
|
|
|
18971c |
- *) die "For argument 'ip=$p'\nSorry, unknown value '$autoconf'";;
|
|
|
18971c |
- esac
|
|
|
18971c |
+ for autoopt in $(str_replace "$autoconf" "," " "); do
|
|
|
18971c |
+ case $autoopt in
|
|
|
18971c |
+ error) die "Error parsing option 'ip=$p'";;
|
|
|
18971c |
+ bootp|rarp|both) die "Sorry, ip=$autoopt is currenty unsupported";;
|
|
|
18971c |
+ none|off)
|
|
|
18971c |
+ [ -z "$ip" ] && \
|
|
|
18971c |
+ die "For argument 'ip=$p'\nValue '$autoopt' without static configuration does not make sense"
|
|
|
18971c |
+ [ -z "$mask" ] && \
|
|
|
18971c |
+ die "Sorry, automatic calculation of netmask is not yet supported"
|
|
|
18971c |
+ ;;
|
|
|
18971c |
+ auto6);;
|
|
|
18971c |
+ dhcp|dhcp6|on|any) \
|
|
|
18971c |
+ [ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
|
|
|
18971c |
+ die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
|
|
|
18971c |
+ [ -n "$ip" ] && \
|
|
|
18971c |
+ die "For argument 'ip=$p'\nSorry, setting client-ip does not make sense for '$autoopt'"
|
|
|
18971c |
+ ;;
|
|
|
18971c |
+ *) die "For argument 'ip=$p'\nSorry, unknown value '$autoopt'";;
|
|
|
18971c |
+ esac
|
|
|
18971c |
+ done
|
|
|
18971c |
|
|
|
18971c |
if [ -n "$dev" ] ; then
|
|
|
18971c |
# We don't like duplicate device configs
|