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