From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3 4/5] network/route: Rewrite route-change-gw into new API
Date: Fri, 9 Aug 2019 18:02:54 +0200 [thread overview]
Message-ID: <20190809160254.GA342@dell5510> (raw)
In-Reply-To: <4a9a229c-b00a-5427-0760-9312df90e5af@oracle.com>
Hi Alexey,
> >>> + local gw="$(tst_ipaddr_un 1 $(($1 + 1)))"
> >> We should keep $(($1 + 1)) within the valid range except already added IP address
> >> ($lhost), i.e. for IPv4 the range is 2..254 for host id:
> >> local gw="$(tst_ipaddr_un 1 $(($1 % 253 + 2)))"
> >> Either we could limit the value here or in the tst_ipaddr_un(). Looks like
> >> route-change-if needs a similar fix for net id?
> > Good point (sorry to keep octet/hextet overflow related errors).
> > Although it'd be simpler to fix it in the code, I'd prefer to have this support
> > in tst_ipaddr_un(). Diff below adds -l MIN_HOST_ID (I'll post it as a part of v3),
> > do we want to lower also max host id?
> It can only be "max host id" option since we already have this variable in the
> function, and in the test setup, we could assign "lhost" variable with the max
> value:
> lhost="$(tst_ipaddr_un 1 $max_host_id)"
I'll have to implement min value as well, because we have for non-counter mode
(e.g tst_ipaddr_un $net_id $host_id) 0 as well, so it will break for invalid
gateway 10.23.1.0. I wanted to avoid -c mode for these route tests.
I guess <0-254> for max host ID for this mode was good idea, but IMHO it should
be: <0-255> (to allow both network address and broadcast address), and allow to
have minimize both min and max. So for case of valid address it'd would be:
tst_ipaddr_un -l 1 -m 254 $net_id $host_id
Other could be to have range for this mode default suitable for hosts (<1..254>)
as we have it for -c mode. Getting network would be:
tst_ipaddr_un -n $net_id # instead of tst_ipaddr_un $net_id 0
Getting broadcast would be:
tst_ipaddr_un -b $net_id # currently not possible at all with tst_ipaddr_un
This second proposal looks more usable to me, although -b and -n aren't obvious
(long getopts would be better, but I think it's better to avoid them).
+ I'd still keep proposed -m max_host_id, so we could use tst_ipaddr_un $net_id 254
for route and tst_ipaddr_un -m 253 $net_id $1 for hosts.
Kind regards,
Petr
next prev parent reply other threads:[~2019-08-09 16:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-25 11:10 [LTP] [PATCH v3 0/5] net/route: rewrite route-change-{dst, gw, if} into new API Petr Vorel
2019-07-25 11:10 ` [LTP] [PATCH v3 1/5] tst_net.sh: enhance tst_add_ipaddr(), add tst_del_ipaddr() Petr Vorel
2019-07-25 11:10 ` [LTP] [PATCH v3 2/5] tst_net.sh: Add -m option to return mask in tst_ipaddr_un() Petr Vorel
2019-07-25 11:10 ` [LTP] [PATCH v3 3/5] network/route: Rewrite route-change-dst into new API Petr Vorel
2019-08-02 12:59 ` Petr Vorel
2019-07-25 11:10 ` [LTP] [PATCH v3 4/5] network/route: Rewrite route-change-gw " Petr Vorel
2019-08-06 13:38 ` Alexey Kodanev
2019-08-06 19:55 ` Petr Vorel
2019-08-08 11:59 ` Alexey Kodanev
2019-08-09 16:02 ` Petr Vorel [this message]
2019-07-25 11:10 ` [LTP] [PATCH v3 5/5] network/route: Rewrite route-change-if " Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190809160254.GA342@dell5510 \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.