|
|
0903d0 |
From 26273649dcfbc095c8e9dbc0f65bb02fd90ee510 Mon Sep 17 00:00:00 2001
|
|
|
0903d0 |
From: Pingfan Liu <piliu@redhat.com>
|
|
|
0903d0 |
Date: Tue, 24 Apr 2018 16:41:21 +0800
|
|
|
0903d0 |
Subject: [PATCH] 40network: introduce ip=either6 option
|
|
|
0903d0 |
|
|
|
0903d0 |
In kdump, if dump-target is ssh on ipv6, we need to sync until ipv6 addr
|
|
|
0903d0 |
is ready. Currently ip=auto6/dhcp6 provides such function. But in 1st kernel,
|
|
|
0903d0 |
it is hard to know whether the ipv6 addr is got by dhcpv6 or SLAAC.
|
|
|
0903d0 |
E.g ifcfg-eth* contains DHCPV6C=yes direction, but there is no dhcpv6
|
|
|
0903d0 |
server in the network, and then after the system is up, the user
|
|
|
0903d0 |
echo 1 > /proc/sys/net/ipv6/conf/eth0/autoconf && accept_ra by manual
|
|
|
0903d0 |
to obtain a ipv6 addr. Or vice.
|
|
|
0903d0 |
So this patch suggests to make dhcpv6 as auto6 fallback
|
|
|
0903d0 |
|
|
|
0903d0 |
Signed-off-by: Pingfan Liu <piliu@redhat.com>
|
|
|
0903d0 |
|
|
|
0903d0 |
Cherry-picked from: 67354ee
|
|
|
0903d0 |
Resolves: #1582398
|
|
|
0903d0 |
---
|
|
|
0903d0 |
dracut.cmdline.7.asc | 4 +++-
|
|
|
0903d0 |
modules.d/40network/ifup.sh | 6 +++++-
|
|
|
0903d0 |
modules.d/40network/net-lib.sh | 4 ++--
|
|
|
0903d0 |
modules.d/40network/parse-ip-opts.sh | 1 +
|
|
|
0903d0 |
4 files changed, 11 insertions(+), 4 deletions(-)
|
|
|
0903d0 |
|
|
|
0903d0 |
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
|
|
|
0903d0 |
index 45902fa9..1204aeb2 100644
|
|
|
0903d0 |
--- a/dracut.cmdline.7.asc
|
|
|
0903d0 |
+++ b/dracut.cmdline.7.asc
|
|
|
0903d0 |
@@ -449,7 +449,7 @@ USB Android phone::
|
|
|
0903d0 |
* enp0s29u1u2
|
|
|
0903d0 |
=====================
|
|
|
0903d0 |
|
|
|
0903d0 |
-**ip=**__{dhcp|on|any|dhcp6|auto6}__::
|
|
|
0903d0 |
+**ip=**__{dhcp|on|any|dhcp6|auto6|either6}__::
|
|
|
0903d0 |
dhcp|on|any::: get ip from dhcp server from all interfaces. If root=dhcp,
|
|
|
0903d0 |
loop sequentially through all interfaces (eth0, eth1, ...) and use the first
|
|
|
0903d0 |
with a valid DHCP root-path.
|
|
|
0903d0 |
@@ -458,6 +458,8 @@ USB Android phone::
|
|
|
0903d0 |
|
|
|
0903d0 |
dhcp6::: IPv6 DHCP
|
|
|
0903d0 |
|
|
|
0903d0 |
+ either6::: if auto6 fails, then dhcp6
|
|
|
0903d0 |
+
|
|
|
0903d0 |
**ip=**__<interface>__:__{dhcp|on|any|dhcp6|auto6}__[:[__<mtu>__][:__<macaddr>__]]::
|
|
|
0903d0 |
This parameter can be specified multiple times.
|
|
|
0903d0 |
+
|
|
|
0903d0 |
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
|
|
|
0903d0 |
index 9ed48155..b3631648 100755
|
|
|
0903d0 |
--- a/modules.d/40network/ifup.sh
|
|
|
0903d0 |
+++ b/modules.d/40network/ifup.sh
|
|
|
0903d0 |
@@ -76,6 +76,7 @@ load_ipv6() {
|
|
|
0903d0 |
}
|
|
|
0903d0 |
|
|
|
0903d0 |
do_ipv6auto() {
|
|
|
0903d0 |
+ local ret
|
|
|
0903d0 |
load_ipv6
|
|
|
0903d0 |
echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
|
|
|
0903d0 |
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
|
|
|
0903d0 |
@@ -84,10 +85,11 @@ do_ipv6auto() {
|
|
|
0903d0 |
[ -n "$macaddr" ] && ip link set address $macaddr dev $netif
|
|
|
0903d0 |
[ -n "$mtu" ] && ip link set mtu $mtu dev $netif
|
|
|
0903d0 |
wait_for_ipv6_auto $netif
|
|
|
0903d0 |
+ ret=$?
|
|
|
0903d0 |
|
|
|
0903d0 |
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
|
|
0903d0 |
|
|
|
0903d0 |
- return 0
|
|
|
0903d0 |
+ return $ret
|
|
|
0903d0 |
}
|
|
|
0903d0 |
|
|
|
0903d0 |
# Handle static ip configuration
|
|
|
0903d0 |
@@ -393,6 +395,8 @@ for p in $(getargs ip=); do
|
|
|
0903d0 |
do_dhcp -6 ;;
|
|
|
0903d0 |
auto6)
|
|
|
0903d0 |
do_ipv6auto ;;
|
|
|
0903d0 |
+ either6)
|
|
|
0903d0 |
+ do_ipv6auto || do_dhcp -6 ;;
|
|
|
0903d0 |
*)
|
|
|
0903d0 |
do_static ;;
|
|
|
0903d0 |
esac
|
|
|
0903d0 |
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
|
|
|
0903d0 |
index 23f2f9ff..9e87aeab 100755
|
|
|
0903d0 |
--- a/modules.d/40network/net-lib.sh
|
|
|
0903d0 |
+++ b/modules.d/40network/net-lib.sh
|
|
|
0903d0 |
@@ -445,7 +445,7 @@ ip_to_var() {
|
|
|
0903d0 |
fi
|
|
|
0903d0 |
|
|
|
0903d0 |
if [ $# -eq 1 ]; then
|
|
|
0903d0 |
- # format: ip={dhcp|on|any|dhcp6|auto6}
|
|
|
0903d0 |
+ # format: ip={dhcp|on|any|dhcp6|auto6|either6}
|
|
|
0903d0 |
# or
|
|
|
0903d0 |
# ip=<ipv4-address> means anaconda-style static config argument cluster
|
|
|
0903d0 |
autoconf="$1"
|
|
|
0903d0 |
@@ -472,7 +472,7 @@ ip_to_var() {
|
|
|
0903d0 |
return 0
|
|
|
0903d0 |
fi
|
|
|
0903d0 |
|
|
|
0903d0 |
- if [ "$2" = "dhcp" -o "$2" = "on" -o "$2" = "any" -o "$2" = "dhcp6" -o "$2" = "auto6" ]; then
|
|
|
0903d0 |
+ if [ "$2" = "dhcp" -o "$2" = "on" -o "$2" = "any" -o "$2" = "dhcp6" -o "$2" = "auto6" -o "$2" = "either6" ]; then
|
|
|
0903d0 |
# format: ip=<interface>:{dhcp|on|any|dhcp6|auto6}[:[<mtu>][:<macaddr>]]
|
|
|
0903d0 |
[ -n "$1" ] && dev="$1"
|
|
|
0903d0 |
[ -n "$2" ] && autoconf="$2"
|
|
|
0903d0 |
diff --git a/modules.d/40network/parse-ip-opts.sh b/modules.d/40network/parse-ip-opts.sh
|
|
|
0903d0 |
index 68afe91b..3d1e95a6 100755
|
|
|
0903d0 |
--- a/modules.d/40network/parse-ip-opts.sh
|
|
|
0903d0 |
+++ b/modules.d/40network/parse-ip-opts.sh
|
|
|
0903d0 |
@@ -78,6 +78,7 @@ for p in $(getargs ip=); do
|
|
|
0903d0 |
die "Sorry, automatic calculation of netmask is not yet supported"
|
|
|
0903d0 |
;;
|
|
|
0903d0 |
auto6);;
|
|
|
0903d0 |
+ either6);;
|
|
|
0903d0 |
dhcp|dhcp6|on|any) \
|
|
|
0903d0 |
#[ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
|
|
|
0903d0 |
# die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
|