Hi Marc,
When you come back, could you please help look at this issue when it's
convenient to you?
I remember in rhel6 originally I posted patch to fix static route on
exact route way. This is NACKed by you because in rhel6 the different
config can't be added to the same netdev. Since in handlenetdev() it
will check if the process is related to a handled netdev. Then you
posted patch on a new way that all routes going through that netdev are
saved and added into 2nd kernel.
If above what I remember is correct, then the exact route way can solve
the problems you mentioned there's a complex network environment which
customers is encountering, such as at the same time the heartbeats,
kdump and other usage. Then now we need go back to the old way I
suggested for rhel7/fedora, the exact route way. The reason as I have
replied to Vivek, is the route adding in 2nd kernel is handled in
Dracut. If we add all routes related to a netdev, then there could be
many duplicate routes, repeatedly adding them can cause warning message
printed, user may be not comfortable and think it's a bug. If I asked to
change the route adding in dracut, Harald may be not happy, because
duplicate is not their fault. So if exact route could solve the complex
network issue, I would like to sove it using exact route way.
Please help have a look at it if you have time. We plan to add this fix
into rhel7.1.
Thanks
Baoquan
On 08/18/14 at 04:34pm, Baoquan He wrote:
Previously for solving static route issues, all routes which go
through a specific dev will be saved in 1st kernel, and then added
in 2nd kernel. Because we use below search pattern, an exception
will happen:
/sbin/ip route show | grep -v default | grep "^[[:digit:]].*via.* $_netdev"
That exception is a corner case which happened when 2 machines connected
directly by cable and the 2 network interfaces are configured in
different network subnets. E.g there are 2 machines A and B:
A:ens10 < ------ > B:ens9
A:ens10 inet 192.168.100.111/24 scope global ens10
route need be added in A:
192.168.110.0/24 dev ens10
B:ens9 inet 192.168.110.222/24 scope global ens9
route need be added in B
192.168.100.0/24 dev ens9
Now if A want to dump to B, the route "192.168.110.0/24 dev ens10"
has to be saved and added in 2nd kernel.
So in this patch "ip route get to $target" command is executed, then
an exact route can be got for going to that target. By this, static
route works and the corner case can be fixed too.
Signed-off-by: Baoquan He <bhe(a)redhat.com>
---
dracut-module-setup.sh | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 02a0557..9da1a41 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -79,11 +79,6 @@ kdump_static_ip() {
_gateway=$(ip route list dev $_netdev | awk '/^default /{print $3}')
echo -n "${_srcaddr}::${_gateway}:${_netmask}::"
fi
-
- /sbin/ip route show | grep -v default | grep "^[[:digit:]].*via.* $_netdev
" |\
- while read line; do
- echo $line | awk '{printf("rd.route=%s:%s:%s\n", $1, $3,
$5)}'
- done >> ${initdir}/etc/cmdline.d/45route-static.conf
}
kdump_get_mac_addr() {
@@ -212,9 +207,27 @@ kdump_setup_znet() {
echo rd.znet=${NETTYPE},${SUBCHANNELS}${_options} >
${initdir}/etc/cmdline.d/30znet.conf
}
+get_routes() {
+ local _netdev="$1" _target="$2"
+ local _route
+
+ _route=`/sbin/ip route get to $_target 2>&1`
+ if /sbin/ip route get to $_target | grep "via";
+ then
+ # route going to a different subnet via a router
+ echo $_route | awk '{printf("rd.route=%s:%s:%s\n", $1, $3,
$5)}' \
+ >> ${initdir}/etc/cmdline.d/45route-static.conf
+ else
+ # route going to a different subnet though directly connected
+ echo $_route | awk '{printf("rd.route=%s::%s\n", $1, $3)}' \
+ >> ${initdir}/etc/cmdline.d/45route-static.conf
+ fi
+
+}
+
# Setup dracut to bringup a given network interface
kdump_setup_netdev() {
- local _netdev=$1 _srcaddr=$2
+ local _netdev=$1 _srcaddr=$2 _target=$3
local _static _proto _ip_conf _ip_opts _ifname_opts
if [ "$(uname -m)" = "s390x" ]; then
@@ -229,6 +242,8 @@ kdump_setup_netdev() {
_proto=dhcp
fi
+ get_routes $_netdev $_target
+
_ip_conf="${initdir}/etc/cmdline.d/40ip.conf"
_ip_opts=" ip=${_static}$(kdump_setup_ifname $_netdev):${_proto}"
@@ -281,7 +296,7 @@ kdump_install_net() {
_netdev=`echo $_netdev|awk '{print $3}'|head -n 1`
fi
- kdump_setup_netdev "${_netdev}" "${_srcaddr}"
+ kdump_setup_netdev "${_netdev}" "${_srcaddr}"
"${_server}"
#save netdev used for kdump as cmdline
# Whoever calling kdump_install_net() is setting up the default gateway,
@@ -439,7 +454,7 @@ kdump_setup_iscsi_device() {
srcaddr=$(echo $netdev | awk '{ print $3; exit }')
netdev=$(echo $netdev | awk '{ print $1; exit }')
- kdump_setup_netdev $netdev $srcaddr
+ kdump_setup_netdev $netdev $srcaddr $tgt_ipaddr
# prepare netroot= command line
# FIXME: IPV6 addresses require explicit [] around $tgt_ipaddr
--
1.9.0
_______________________________________________
kexec mailing list
kexec(a)lists.fedoraproject.org
https://lists.fedoraproject.org/mailman/listinfo/kexec