public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v4 2/2] net/route: Add netlink based route change gw/dest tests
Date: Thu, 16 Apr 2020 16:19:09 +0200	[thread overview]
Message-ID: <20200416141909.GA16790@dell5510> (raw)
In-Reply-To: <b7673e46-60de-9039-5179-3d96c0b9a538@oracle.com>

Hi Alexey,

> > +++ b/runtest/net_stress.route
> > @@ -2,11 +2,15 @@
> >  route4-change-dst route-change-dst.sh
> >  route4-change-gw route-change-gw.sh
> >  route4-change-if route-change-if.sh
> > +route4-change-netlink-dst route-change-netlink-dst.sh
> > +route4-change-netlink-gw route-change-netlink-gw.sh -g
> >  route4-redirect route4-redirect
> >  route4-rmmod route4-rmmod

> >  route6-change-dst route-change-dst.sh -6
> >  route6-change-gw route-change-gw.sh -6
> >  route6-change-if route-change-if.sh -6
> > +route6-change-netlink-dst route-change-netlink-dst.sh
> > +route6-change-netlink-gw route-change-netlink-gw.sh -g

> "-6" option?
Thanks!
+ -g should not be there (first I thought I'd have a single script).

> > +++ b/testcases/network/stress/route/route-change-netlink.c
...
> > +#define IP_ADDR_DELIMITER '^'

> Why not to use more obvious delimiter, comma?
+1
BTW going to use IP_ADDR_DELIM (shorter name).

...
> > +struct ip_addr {
> > +	char ip[INET6_ADDRSTRLEN];

> What about adding 'struct addrinfo' here, and use it instead of ip
> string manipulation during the test?
Hm, probably good idea.
String manipulation is needed for creating destination (char dst[INET6_ADDRSTRLEN]).
But that should be done during setup as well => would it be better to have also
struct ip_addr *dst?

I separated number if IP from number of loops, so one can have really big loop
to stress system without requiring a lot of memory.

...
> > +int save_ip(struct ip_addr **list, char *item)
> > +{
> > +	int len = 0;
> > +
> > +	while ((item = strtok(item, CHR2STR(IP_ADDR_DELIMITER))) != NULL) {
> > +		save_ip_str(list, item);
> > +		item = NULL;
> > +		len++;
> > +	}
> > +
> > +	return len;
> > +}
> > +

> It would be better to pass a callback (save_ip_str or save_iface_str), these
> two functions are almost identical.
+1

...
> > +static void send_udp(char *local, char *remote)
> > +{
> > +	fd = SAFE_SOCKET(family, SOCK_DGRAM, IPPROTO_UDP);
> > +
> > +	struct addrinfo hints;
> > +	memset(&hints, 0, sizeof(struct addrinfo));
> > +	hints.ai_family = family;
> > +	hints.ai_socktype = SOCK_DGRAM;
> > +	hints.ai_flags = 0;
> > +	hints.ai_protocol = 0;
> > +	hints.ai_addr = INADDR_ANY;

> It seems this block can be moved to setup, socket() and hints.
+1

> > +
> > +	tst_setup_addrinfo(local, NULL, &hints, &lhost_addrinfo);

> lhost_addrinfo - is it used?
No, it's not, thanks. Yes, it does not make even sense, as code is for client.


Kind regards,
Petr

  reply	other threads:[~2020-04-16 14:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-14 15:24 [LTP] [PATCH v4 0/2] Route tests using netlink API (dst,gw) Petr Vorel
2020-04-14 15:24 ` [LTP] [PATCH v4 1/2] net: Move setup_addrinfo() into tst_net.h Petr Vorel
2020-04-14 15:24 ` [LTP] [PATCH v4 2/2] net/route: Add netlink based route change gw/dest tests Petr Vorel
2020-04-16 12:27   ` Alexey Kodanev
2020-04-16 14:19     ` Petr Vorel [this message]
2020-04-17 13:25       ` 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=20200416141909.GA16790@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox