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