+ bhe for reviewing
On 11/19/18 at 04:56pm, Dave Young wrote:
> On 11/15/18 at 02:18pm, Kairui Song wrote:
> > Currently we still don't support multipath route, when parsing multipath
> > route kdumpctl will wrong consider 'nexthop' as the destination
address,
> > and raise errors in second kernel.
> >
> > When multipath route is in use, ip route output should be like this:
> > $ /sbin/ip route show
> > default via 192.168.122.1 dev ens1 proto dhcp metric 100
> > 192.168.122.0/24 dev ens1 proto kernel scope link src 192.168.122.161 metric
100
> > 192.168.122.8
> > nexthop via 192.168.122.1 dev ens1 weight 50
> > nexthop via 192.168.122.2 dev ens1 weight 5
> >
> > As we won't care about HA/performance, simply use the rule with highest
> > weight and ignore the rest.
> > ---
> > dracut-module-setup.sh | 41 ++++++++++++++++++++++++++++++++++++++++-
> > 1 file changed, 40 insertions(+), 1 deletion(-)
> >
> > diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
> > index 2f9d762..7499678 100755
> > --- a/dracut-module-setup.sh
> > +++ b/dracut-module-setup.sh
> > @@ -126,7 +126,8 @@ kdump_static_ip() {
> > echo -n "${_srcaddr}::${_gateway}:${_netmask}::"
> > fi
> >
> > - /sbin/ip $_ipv6_flag route show | grep -v default | grep ".*via.*
$_netdev " |\
> > + /sbin/ip $_ipv6_flag route show | grep -v default |\
> > + grep ".*via.* $_netdev " | grep -v
"^[[:space:]]*nexthop" |\
> > while read _route; do
> > _target=`echo $_route | cut -d ' ' -f1`
> > _nexthop=`echo $_route | cut -d ' ' -f3`
> > @@ -136,6 +137,44 @@ kdump_static_ip() {
> > fi
> > echo "rd.route=$_target:$_nexthop:$_netdev"
> > done >> ${initdir}/etc/cmdline.d/45route-static.conf
> > +
> > + kdump_handle_mulitpath_route $_netdev $_srcaddr
> > +}
> > +
> > +kdump_handle_mulitpath_route() {
> > + local _netdev="$1" _srcaddr="$2" _ipv6_flag
> > + local _target _nexthop _route _weight _max_weight _rule
> > +
> > + if is_ipv6_address $_srcaddr; then
> > + _ipv6_flag="-6"
> > + fi
> > +
> > + while IFS="" read _route; do
> > + if [[ "$_route" =~ [[:space:]]+nexthop ]]; then
> > + _route=$(echo "$_route" | sed -e
's/^[[:space:]]*//')
> > + # Parse multipath route, using previous _target
> > + [[ "$_target" == 'default' ]] &&
continue
> > + [[ "$_route" =~ .*via.*\ $_netdev ]] || continue
> > +
> > + _weight=`echo "$_route" | cut -d ' ' -f7`
> > + if [[ "$_weight" -gt "$_max_weight" ]]; then
> > + _nexthop=`echo "$_route" | cut -d ' ' -f3`
> > + _max_weight=$_weight
> > + if [ "x" != "x"$_ipv6_flag ]; then
> > + _rule="rd.route=[$_target]:[$_nexthop]:$_netdev"
> > + else
> > + _rule="rd.route=$_target:$_nexthop:$_netdev"
> > + fi
> > + fi
> > + else
> > + [[ -n "$_rule" ]] && echo "$_rule"
> > + _target=`echo "$_route" | cut -d ' ' -f1`
> > + _rule="" _max_weight=0 _weight=0
> > + fi
> > + done >> ${initdir}/etc/cmdline.d/45route-static.conf\
> > + < <(/sbin/ip $_ipv6_flag route show)
> > +
> > + [[ -n $_rule ]] && echo $_rule >>
${initdir}/etc/cmdline.d/45route-static.conf
> > }
> >
> > kdump_get_mac_addr() {
> > --
> > 2.17.1
> >
>
>
> Baoquan, Pingfan, can you review this patch?
>
> Thanks
> Dave
> _______________________________________________
> kexec mailing list -- kexec(a)lists.fedoraproject.org
> To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org
> Fedora Code of Conduct:
https://getfedora.org/code-of-conduct.html
> List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives:
https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org