Previously for fixing the static route problem, all routes get through a specific network interface will be saved and added in 2nd kernel. Search pattern is used to get routes: /sbin/ip route show | grep -v default | grep "^[[:digit:]].*via.* $_netdev"
An exception existed though, that is 2 machines connected directly and the network interfaces wihch are configured as in different network subnets.
So in the v1 and v2, "ip route get to $target" command is executed and an exact route to a target is saved and added in 2nd kernel. This works for static route issue and can fix the corner case above.
v1: Introduced the new way which get exact route to remote target.
v1->v2: Since a grammer error which saved exact route, v2 is posted.
v2->v3: Per Vivek's comment, route to target should not be related to static ip issues. So in v3 introduced the get_routes function and take it out of kdump_static_ip.
Baoquan He (1): save exact route to remote target
dracut-module-setup.sh | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-)
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@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
Hi,
This is the patch1/1. Please review this one. I will check that patch series and add the patch sequence number if it doesn't have one in patch subject.
Sorry if this makes you confused.
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@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
On Tue, Aug 19, 2014 at 10:24:16AM +0800, Baoquan He wrote:
Hi,
This is the patch1/1. Please review this one. I will check that patch series and add the patch sequence number if it doesn't have one in patch subject.
Hi Bao,
git-send-email automatically creates a series and adds these numbers.
I use following.
git send-email --no-chain-reply-to --no-signed-off-by-cc --suppress-from --suppress-cc all --to <recepient-mail-id> patches-sent/
Thanks Vivek
Sorry if this makes you confused.
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@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@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On Mon, Aug 18, 2014 at 04:34:53PM +0800, 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.
Hi Bao,
Using "ip route get to" requires knowing the target. But that's little different than bringing up an interface. There can be multiple static routes going through an interface which lead to multiple targets.
I think this makes the whole mechanism less generic. I liked the previous method better where if we bring an interface, all the static routes going through that interface will come up too. (Instead of only one static route coming up for the target).
So I would rather stick to the mechanism of determining all the routes going through an interface and add the ones which are not present in second kernel's routing table.
Thanks Vivek
Signed-off-by: Baoquan He bhe@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@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On Wed, Aug 20, 2014 at 10:42:28AM -0400, Vivek Goyal wrote:
[..]
So I would rather stick to the mechanism of determining all the routes going through an interface and add the ones which are not present in second kernel's routing table.
Hi Bao,
In first kernel, who brings up the static routes? I am assuming Network Manager. If that's the case, why not copy the relevant configuration files in kdump initramfs and let network manager do the job.
Do we have network manager working in kdump initramfs or not?
Thanks Vivek
On 08/20/14 at 01:47pm, Vivek Goyal wrote:
On Wed, Aug 20, 2014 at 10:42:28AM -0400, Vivek Goyal wrote:
[..]
So I would rather stick to the mechanism of determining all the routes going through an interface and add the ones which are not present in second kernel's routing table.
Hi Bao,
In first kernel, who brings up the static routes? I am assuming Network Manager. If that's the case, why not copy the relevant configuration files in kdump initramfs and let network manager do the job.
Yeah, originally I thought so. Later it's not about the static route. Any route need be considered. It will be much simpler if only think about the static route conf.
That will be /etc/sysconfig/route-eth0 according its using in 1st kernel.
Do we have network manager working in kdump initramfs or not?
Thanks Vivek
On 08/20/14 at 10:42am, Vivek Goyal wrote:
On Mon, Aug 18, 2014 at 04:34:53PM +0800, 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.
Hi Bao,
Using "ip route get to" requires knowing the target. But that's little different than bringing up an interface. There can be multiple static routes going through an interface which lead to multiple targets.
I think this makes the whole mechanism less generic. I liked the previous method better where if we bring an interface, all the static routes going through that interface will come up too. (Instead of only one static route coming up for the target).
So I would rather stick to the mechanism of determining all the routes going through an interface and add the ones which are not present in second kernel's routing table.
In fact, this issue has got out of the range of static route. In previous implementation, all routes in 1st kernel which go through that interface will be added to 2nd kernel. Among these routes, any routes could be added, not only the static routes. Those manually added will be added to 2nd kernel as long as it's an available route to target.
So now, could that be true that 2 targets are goint through 1 NIC, then kdump_setup_netdev() will be called twice or 3 times?
Thanks Vivek
On 08/20/14 at 10:42am, Vivek Goyal wrote:
Hi Bao,
Using "ip route get to" requires knowing the target. But that's little different than bringing up an interface. There can be multiple static routes going through an interface which lead to multiple targets.
I think this makes the whole mechanism less generic. I liked the previous method better where if we bring an interface, all the static routes going through that interface will come up too. (Instead of only one static route coming up for the target).
So I would rather stick to the mechanism of determining all the routes going through an interface and add the ones which are not present in second kernel's routing table.
I think you are right about this. Since Marc said other modules could use network too, such as heartbeat. In kdump we need build the network conf for it. I don't remember this clearly, need wait for Marc to check this.
The reason I tried the exact route is some duplicate routes may exist in dracut. From dracut's point of view, it can handle route correctly if user can pass it the correct route. If duplicate routes are added, either we tolerate the warning message, or we require to change the implementation of dracut handling. But from dracut's side, they don't do anything wrong, why they need be changed.
Thanks Vivek
Hi,
Sorry for the late response.
On 08/21/2014 08:34 AM, Baoquan He wrote:
On 08/20/14 at 10:42am, Vivek Goyal wrote:
Hi Bao,
Using "ip route get to" requires knowing the target. But that's little different than bringing up an interface. There can be multiple static routes going through an interface which lead to multiple targets.
I think this makes the whole mechanism less generic. I liked the previous method better where if we bring an interface, all the static routes going through that interface will come up too. (Instead of only one static route coming up for the target).
So I would rather stick to the mechanism of determining all the routes going through an interface and add the ones which are not present in second kernel's routing table.
I think you are right about this. Since Marc said other modules could use network too, such as heartbeat. In kdump we need build the network conf for it. I don't remember this clearly, need wait for Marc to check this.
The reason I tried the exact route is some duplicate routes may exist in dracut. From dracut's point of view, it can handle route correctly if user can pass it the correct route. If duplicate routes are added, either we tolerate the warning message, or we require to change the implementation of dracut handling. But from dracut's side, they don't do anything wrong, why they need be changed.
I have found the following things that could each use a different route, and should be fully supported: * ssh/NFS/iscsi - but only one of these per configuration (as far as I know). * Name resolution (/etc/resolv.conf specifies this) * Heartbeat
I am not sure if we support: NIS (YP)
Additionally, customers could access the network through their own scripts, but it would be reasonable to not set up networks specifically for this.
Regards,
Marc
On 09/05/14 at 10:18am, Marc Milgram wrote:
Hi,
Sorry for the late response.
On 08/21/2014 08:34 AM, Baoquan He wrote:
I think you are right about this. Since Marc said other modules could use network too, such as heartbeat. In kdump we need build the network conf for it. I don't remember this clearly, need wait for Marc to check this.
The reason I tried the exact route is some duplicate routes may exist in dracut. From dracut's point of view, it can handle route correctly if user can pass it the correct route. If duplicate routes are added, either we tolerate the warning message, or we require to change the implementation of dracut handling. But from dracut's side, they don't do anything wrong, why they need be changed.
Hi Marc,
Re-read your mail, I am kind of confused.
I have found the following things that could each use a different route, and should be fully supported:
- ssh/NFS/iscsi - but only one of these per configuration (as far
as I know).
For above configuration, we can get route and add in 2nd kernel by kdump scripts.
- Name resolution (/etc/resolv.conf specifies this)
- Heartbeat
For above 2, how do we handle them? And who will setup network connections for them, especially Heartbeat?
Currently even previous design just add routes through a specific NIC. If kdump script only take care of the NIC which dumping will go through, but Heartbeat takes different path through different NIC, what will happen? Is this related to static route issue and need be considered in kdump scripts?
Thanks Baoquan
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@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@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
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@redhat.com
I think we can clean up a bit for the part of determing subnet. See my inline comment below. Because this patch has been sitting in the mail list for quite long, I'll merge this patch and leave the cleanup part for Bao or someone else to address later.
Acked-by: WANG Chao chaowang@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
The logic of determining subnet is used twice in dracut-module-setup.sh, the other instance is in kdump_install_net(). We can extract a function for both places to use.
Thanks WANG Chao
Hi Bao,
Where is the patch. I only see changelog?
Thanks Vivek
On Mon, Aug 18, 2014 at 04:34:52PM +0800, Baoquan He wrote:
Previously for fixing the static route problem, all routes get through a specific network interface will be saved and added in 2nd kernel. Search pattern is used to get routes: /sbin/ip route show | grep -v default | grep "^[[:digit:]].*via.* $_netdev"
An exception existed though, that is 2 machines connected directly and the network interfaces wihch are configured as in different network subnets.
So in the v1 and v2, "ip route get to $target" command is executed and an exact route to a target is saved and added in 2nd kernel. This works for static route issue and can fix the corner case above.
v1: Introduced the new way which get exact route to remote target.
v1->v2: Since a grammer error which saved exact route, v2 is posted.
v2->v3: Per Vivek's comment, route to target should not be related to static ip issues. So in v3 introduced the get_routes function and take it out of kdump_static_ip.
Baoquan He (1): save exact route to remote target
dracut-module-setup.sh | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-)
-- 1.9.0
On 08/18/14 at 01:24pm, Vivek Goyal wrote:
Hi Bao,
Where is the patch. I only see changelog?
I used the "git format-patch -1 --cover-letter" to get patch and its cover letter. Seems that it didn't add the patch0/1 and patch1/1 automatically. This is the cover letter produced by git.
Please see the other one in the same thread, it is the patch1/1.
Thanks Vivek
On Mon, Aug 18, 2014 at 04:34:52PM +0800, Baoquan He wrote:
Previously for fixing the static route problem, all routes get through a specific network interface will be saved and added in 2nd kernel. Search pattern is used to get routes: /sbin/ip route show | grep -v default | grep "^[[:digit:]].*via.* $_netdev"
An exception existed though, that is 2 machines connected directly and the network interfaces wihch are configured as in different network subnets.
So in the v1 and v2, "ip route get to $target" command is executed and an exact route to a target is saved and added in 2nd kernel. This works for static route issue and can fix the corner case above.
v1: Introduced the new way which get exact route to remote target.
v1->v2: Since a grammer error which saved exact route, v2 is posted.
v2->v3: Per Vivek's comment, route to target should not be related to static ip issues. So in v3 introduced the get_routes function and take it out of kdump_static_ip.
Baoquan He (1): save exact route to remote target
dracut-module-setup.sh | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-)
-- 1.9.0
On Tue, Aug 19, 2014 at 10:09:26AM +0800, Baoquan He wrote:
On 08/18/14 at 01:24pm, Vivek Goyal wrote:
Hi Bao,
Where is the patch. I only see changelog?
I used the "git format-patch -1 --cover-letter" to get patch and its cover letter. Seems that it didn't add the patch0/1 and patch1/1 automatically. This is the cover letter produced by git.
Please see the other one in the same thread, it is the patch1/1.
I think you also need to use option -n so that your patches are numbered. It is very important in a series. Otherwise it is very confusing.
Vivek
Thanks Vivek
On Mon, Aug 18, 2014 at 04:34:52PM +0800, Baoquan He wrote:
Previously for fixing the static route problem, all routes get through a specific network interface will be saved and added in 2nd kernel. Search pattern is used to get routes: /sbin/ip route show | grep -v default | grep "^[[:digit:]].*via.* $_netdev"
An exception existed though, that is 2 machines connected directly and the network interfaces wihch are configured as in different network subnets.
So in the v1 and v2, "ip route get to $target" command is executed and an exact route to a target is saved and added in 2nd kernel. This works for static route issue and can fix the corner case above.
v1: Introduced the new way which get exact route to remote target.
v1->v2: Since a grammer error which saved exact route, v2 is posted.
v2->v3: Per Vivek's comment, route to target should not be related to static ip issues. So in v3 introduced the get_routes function and take it out of kdump_static_ip.
Baoquan He (1): save exact route to remote target
dracut-module-setup.sh | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-)
-- 1.9.0
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 08/20/14 at 10:29am, Vivek Goyal wrote:
On Tue, Aug 19, 2014 at 10:09:26AM +0800, Baoquan He wrote:
On 08/18/14 at 01:24pm, Vivek Goyal wrote:
Hi Bao,
Where is the patch. I only see changelog?
I used the "git format-patch -1 --cover-letter" to get patch and its cover letter. Seems that it didn't add the patch0/1 and patch1/1 automatically. This is the cover letter produced by git.
Please see the other one in the same thread, it is the patch1/1.
I think you also need to use option -n so that your patches are numbered. It is very important in a series. Otherwise it is very confusing.
Yeah, for this kind of only 1 patch with 1 cover-letter, option -n need be specified. Usually when 2 or more than 2 patches are produced, they are numbered automatically.
Thanks for your notice. I just made this kind of patch set first time.
Vivek
On 08/18/2014 04:34 AM, Baoquan He wrote:
Previously for fixing the static route problem, all routes get through a specific network interface will be saved and added in 2nd kernel. Search pattern is used to get routes: /sbin/ip route show | grep -v default | grep "^[[:digit:]].*via.* $_netdev"
An exception existed though, that is 2 machines connected directly and the network interfaces wihch are configured as in different network subnets.
So in the v1 and v2, "ip route get to $target" command is executed and an exact route to a target is saved and added in 2nd kernel. This works for static route issue and can fix the corner case above.
v1: Introduced the new way which get exact route to remote target.
v1->v2: Since a grammer error which saved exact route, v2 is posted.
v2->v3: Per Vivek's comment, route to target should not be related to static ip issues. So in v3 introduced the get_routes function and take it out of kdump_static_ip.
Baoquan He (1): save exact route to remote target
dracut-module-setup.sh | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-)
Sorry for the very late response...
It looks like the first change was applied by another change. Otherwise this looks good.
Marc
On 10/22/14 at 11:14am, Marc Milgram wrote:
On 08/18/2014 04:34 AM, Baoquan He wrote:
Previously for fixing the static route problem, all routes get through a specific network interface will be saved and added in 2nd kernel. Search pattern is used to get routes: /sbin/ip route show | grep -v default | grep "^[[:digit:]].*via.* $_netdev"
An exception existed though, that is 2 machines connected directly and the network interfaces wihch are configured as in different network subnets.
So in the v1 and v2, "ip route get to $target" command is executed and an exact route to a target is saved and added in 2nd kernel. This works for static route issue and can fix the corner case above.
v1: Introduced the new way which get exact route to remote target.
v1->v2: Since a grammer error which saved exact route, v2 is posted.
v2->v3: Per Vivek's comment, route to target should not be related to static ip issues. So in v3 introduced the get_routes function and take it out of kdump_static_ip.
Baoquan He (1): save exact route to remote target
dracut-module-setup.sh | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-)
Sorry for the very late response...
It looks like the first change was applied by another change. Otherwise this looks good.
Hi Marc,
The patch can be applied without any conflict. I didn't got the first change you mentioned, do you mean the change in this patch?
Thanks Baoquan
On 10/26/2014 10:21 PM, Baoquan He wrote:
On 10/22/14 at 11:14am, Marc Milgram wrote:
On 08/18/2014 04:34 AM, Baoquan He wrote:
Previously for fixing the static route problem, all routes get through a specific network interface will be saved and added in 2nd kernel. Search pattern is used to get routes: /sbin/ip route show | grep -v default | grep "^[[:digit:]].*via.* $_netdev"
An exception existed though, that is 2 machines connected directly and the network interfaces wihch are configured as in different network subnets.
So in the v1 and v2, "ip route get to $target" command is executed and an exact route to a target is saved and added in 2nd kernel. This works for static route issue and can fix the corner case above.
v1: Introduced the new way which get exact route to remote target.
v1->v2: Since a grammer error which saved exact route, v2 is posted.
v2->v3: Per Vivek's comment, route to target should not be related to static ip issues. So in v3 introduced the get_routes function and take it out of kdump_static_ip.
Baoquan He (1): save exact route to remote target
dracut-module-setup.sh | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-)
Sorry for the very late response...
It looks like the first change was applied by another change. Otherwise this looks good.
Hi Marc,
The patch can be applied without any conflict. I didn't got the first change you mentioned, do you mean the change in this patch?
Thanks Baoquan
I had the wrong version checked out.
I checked out the master version, and the patch applies without conflict.
ACK