[PATCH 0/1] Add Host Transport Interface option (host-triface)
Belanger, Martin
Martin.Belanger at dell.com
Fri Apr 16 01:41:00 BST 2021
Re-sending in Plain Text mode.
Hi James,
With HOST_TRADDR, we use bind() to bind to an address just before invoking connect(). I also used to think that this was the way to force packets to be routed onto the interface matching the address used in the bind(). But that is not the case (I tested it). bind() does not control the routing of transmitted packets. The only thing that bind() does is to set the source address on the socket so that when a remote process queries the peer address (getpeername), it will see that address as the source address.
It's only a setsockopt() with SO_BINDTODEVICE that can force packets to go out on a specific interface (I tested that as well).
References:
https://codingrelic.geekhold.com/2009/10/code-snippet-sobindtodevice.html
https://www.javaer101.com/en/article/1866348.html
https://wiki.treck.com/Appendix_C:_Strong_End_System_Model_/_Weak_End_System_Model
Regards,
Martin
________________________________________
From: James Smart <jsmart2021 at gmail.com>
Sent: Thursday, April 15, 2021 19:05
To: Martin Belanger; linux-nvme at lists.infradead.org
Cc: kbusch at kernel.org; axboe at fb.com; hch at lst.de; sagi at grimberg.me; Belanger, Martin
Subject: Re: [PATCH 0/1] Add Host Transport Interface option (host-triface)
[EXTERNAL EMAIL]
On 4/15/2021 12:28 PM, Martin Belanger wrote:
> From: Martin Belanger <martin.belanger at dell.com>
>
> In our application, we need a way to force TCP connections to go out a
> specific interface instead of letting Linux select the interface based
> on the routing tables. This patch adds the option 'host-triface' to allow
> specifying the interface to use. Note that corresponding changes to the
> nvme-cli utility will follow.
>
> Martin Belanger (1):
> Add 'Transport Interface' (triface) option. This can be used to
> specify the IP interface to use for the connection. The driver uses
> that to set SO_BINDTODEVICE on the socket before connecting.
>
> drivers/nvme/host/core.c | 5 +++++
> drivers/nvme/host/fabrics.c | 14 +++++++++++++
> drivers/nvme/host/fabrics.h | 6 +++++-
> drivers/nvme/host/tcp.c | 41 ++++++++++++++++++++++++++++++++++---
> 4 files changed, 62 insertions(+), 4 deletions(-)
>
This wasn't able to be done via HOST_TRADDR ?
-- james
More information about the Linux-nvme
mailing list