From: Guillaume Nault <gnault@redhat.com>
To: David Ahern <dsahern@kernel.org>
Cc: David Miller <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH v2 net-next 3/4] selftests: fcnal: Test SO_DONTROUTE on UDP sockets.
Date: Thu, 11 May 2023 17:55:59 +0200 [thread overview]
Message-ID: <ZF0QDwICQk9JK90Z@debian> (raw)
In-Reply-To: <40497aaa-ac1e-32c3-16ba-f61b22013e28@kernel.org>
On Thu, May 11, 2023 at 09:03:44AM -0600, David Ahern wrote:
> On 5/11/23 8:39 AM, Guillaume Nault wrote:
> > Use nettest --client-dontroute to test the kernel behaviour with UDP
> > sockets having the SO_DONTROUTE option. Sending packets to a neighbour
> > (on link) host, should work. When the host is behind a router, sending
> > should fail.
> >
> > Signed-off-by: Guillaume Nault <gnault@redhat.com>
> > ---
> > v2: Use 'nettest -B' instead of invoking two nettest instances for
> > client and server.
> >
> > tools/testing/selftests/net/fcnal-test.sh | 17 +++++++++++++++++
> > 1 file changed, 17 insertions(+)
> >
> > diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh
> > index 3a1f3051321f..08b4b96cbd63 100755
> > --- a/tools/testing/selftests/net/fcnal-test.sh
> > +++ b/tools/testing/selftests/net/fcnal-test.sh
> > @@ -1641,6 +1641,23 @@ ipv4_udp_novrf()
> > log_start
> > run_cmd nettest -D -d ${NSA_DEV} -r ${a}
> > log_test_addr ${a} $? 2 "No server, device client, local conn"
> > +
> > + #
> > + # Link local connection tests (SO_DONTROUTE).
> > + # Connections should succeed only when the remote IP address is
> > + # on link (doesn't need to be routed through a gateway).
> > + #
> > +
> > + a=${NSB_IP}
> > + log_start
> > + do_run_cmd nettest -B -D -N "${NSA}" -O "${NSB}" -r ${a} --client-dontroute
> > + log_test_addr ${a} $? 0 "SO_DONTROUTE client"
> > +
> > + a=${NSB_LO_IP}
> > + log_start
> > + show_hint "Should fail 'Network is unreachable' since server is not on link"
> > + do_run_cmd nettest -B -D -N "${NSA}" -O "${NSB}" -r ${a} --client-dontroute
> > + log_test_addr ${a} $? 1 "SO_DONTROUTE client"
> > }
> >
> > ipv4_udp_vrf()
>
> Reviewed-by: David Ahern <dsahern@kernel.org>
>
> Have you looked at test cases with VRF - both UDP and TCP?
I haven't looked at the VRF cases. I don't really see what kernel path
I could cover that isn't already covered by the non-vrf cases:
* From ns-B point of view, VRF_IP is just a routed IP, like NSA_LO_IP.
So testing SO_DONTROUTE on a socket belonging to ns-B wouldn't
cover any new kernel code path.
* From ns-A point of view, the routing table content is the same. It
just has to use table $VRF_TABLE instead of main. So the test would
just ensure that we jump to the right routing table, something that
SO_DONTROUTE doesn't influences. But the route lookup itself is
actually the same as for the non-vrf test (just using a different
table). Therefore I feel that adding vrf tests for SO_DONTROUTE
wouldn't bring much value.
But I may very well be missing some interesting points. If you have any
VRF test case in mind, I can add them.
next prev parent reply other threads:[~2023-05-11 15:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-11 14:39 [PATCH v2 net-next 0/4] selftests: fcnal: Test SO_DONTROUTE socket option Guillaume Nault
2023-05-11 14:39 ` [PATCH v2 net-next 1/4] selftests: Add SO_DONTROUTE option to nettest Guillaume Nault
2023-05-11 15:00 ` David Ahern
2023-05-11 14:39 ` [PATCH v2 net-next 2/4] selftests: fcnal: Test SO_DONTROUTE on TCP sockets Guillaume Nault
2023-05-11 15:02 ` David Ahern
2023-05-11 14:39 ` [PATCH v2 net-next 3/4] selftests: fcnal: Test SO_DONTROUTE on UDP sockets Guillaume Nault
2023-05-11 15:03 ` David Ahern
2023-05-11 15:55 ` Guillaume Nault [this message]
2023-05-11 14:39 ` [PATCH v2 net-next 4/4] selftests: fcnal: Test SO_DONTROUTE on raw and ping sockets Guillaume Nault
2023-05-11 15:04 ` David Ahern
2023-05-12 8:50 ` [PATCH v2 net-next 0/4] selftests: fcnal: Test SO_DONTROUTE socket option patchwork-bot+netdevbpf
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=ZF0QDwICQk9JK90Z@debian \
--to=gnault@redhat.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).