On 11/26/18 at 04:58pm, Kairui Song wrote:
Hi Baoquan, thanks for the review!
Unfortunately, I didn't find any better doc than you do, I take
iproute2's manpage and code
(
https://github.com/shemminger/iproute2/blob/707f612c00a91fe3c17d7af5319e4...)
as the reference and did some experiment if there are any confusing.
And default gateway can have multiple weighted nexthop.
OK, that's good.
You can have my Acked-by when you merge it with tiny adjustment in log.
Thanks
Baoquan
> On Mon, Nov 26, 2018 at 4:10 PM Baoquan He <bhe(a)redhat.com> 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,
> > wrongly
> > > 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
> >
> > I didn't find out a good doc about linux multipath route, just this one:
> >
https://codecave.cc/multipath-routing-in-linux-part-2.html
> >
> > It says ipv4 supports weighted multipath route, ipv6 hasn't, in v4.12.
> > But it may not impact this patch.
> > >
> > > As we won't care about HA/performance, simply use the rule with
highest
> > don't
> > > 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" |\
> >
> > I am not sure if default gateway also has multiple weighted nexthop. Is
> > there a doc about this?
> >
> > Otherwise this patch looks good to me.
> >
> > Thanks
> > Baoquan
> > > 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
> > > _______________________________________________
> > > 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
>
>
>
> --
> Best Regards,
> Kairui Song