diff mbox

iSER with policy based routing error

Message ID CAANLjFpHbMXjMnxO0B7sn9rRz2Sn3CEx-bEWKW5BrYj3itQ0HQ@mail.gmail.com (mailing list archive)
State Rejected
Headers show

Commit Message

Robert LeBlanc May 24, 2017, 6:14 p.m. UTC
On Tue, May 23, 2017 at 5:17 PM, Robert LeBlanc <robert@leblancnet.us> wrote:
> I could not replicate ping6 working today without passing the -I
> parameter. I created https://github.com/linux-rdma/rdma-core/pull/136
> and now you can pass -I to rping to have it bind to a source address
> just like ping and the rules and additional routing table works for
> rping.
>
> However, iSER is not able to find a network route. Where do you think
> I should look next? It seems that RDMA_CM is able to work properly if
> given the right information.
>
> Thanks,
> Robert
> ----------------
> Robert LeBlanc
> PGP Fingerprint 79A2 9CA4 6CC4 45DD A904  C70E E654 3BB2 FA62 B9F1
>
>

Looks like the bug is in iSER, it is always passing NULL for the source address.


Hard coding the source IP address allows the connection to work fine.
It seems for some reason, it is not using the information from the
iface that we configured. I can try to create a patch, but I'm not
sure where to query the ifaces for the required info. If you can point
me in the right place, I can give it a shot.

Thanks,
----------------
Robert LeBlanc
PGP Fingerprint 79A2 9CA4 6CC4 45DD A904  C70E E654 3BB2 FA62 B9F1
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Jason Gunthorpe May 24, 2017, 7:25 p.m. UTC | #1
On Wed, May 24, 2017 at 12:14:53PM -0600, Robert LeBlanc wrote:
> On Tue, May 23, 2017 at 5:17 PM, Robert LeBlanc <robert@leblancnet.us> wrote:
> > I could not replicate ping6 working today without passing the -I
> > parameter. I created https://github.com/linux-rdma/rdma-core/pull/136

It shouldn't have worked, the route cache probably needed flushing
after configuring policy routing.

> Hard coding the source IP address allows the connection to work fine.
> It seems for some reason, it is not using the information from the
> iface that we configured.

Only information provided by the user can be used for route lookup.

Do not try an extract a source address from some other information..

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Robert LeBlanc May 24, 2017, 7:41 p.m. UTC | #2
On Wed, May 24, 2017 at 1:25 PM, Jason Gunthorpe
<jgunthorpe@obsidianresearch.com> wrote:
> On Wed, May 24, 2017 at 12:14:53PM -0600, Robert LeBlanc wrote:
>> On Tue, May 23, 2017 at 5:17 PM, Robert LeBlanc <robert@leblancnet.us> wrote:
>> > I could not replicate ping6 working today without passing the -I
>> > parameter. I created https://github.com/linux-rdma/rdma-core/pull/136
>
> It shouldn't have worked, the route cache probably needed flushing
> after configuring policy routing.

What I'm thinking happened is I tried the test too quickly after
modifing the route tables, so something was cached that made it work.

>> Hard coding the source IP address allows the connection to work fine.
>> It seems for some reason, it is not using the information from the
>> iface that we configured.
>
> Only information provided by the user can be used for route lookup.

I'm trying to provide this information through iscsiadm ifaces, but
iSER completely ignores it.

# iscsiadm -m iface -I eth0iser -o new
# iscsiadm -m iface -I eth0iser -o update -n iface.ipaddress -v 192.168.13.14
# iscsiadm -m iface -I eth0iser -o update -n iface.transport_name -v iser
# iscsiadm -m discovery -t st -p 192.168.13.13 -I eth0iser

My routing information:

# ip route
default via 10.64.0.1 dev eno1 proto static metric 100
10.64.0.0/10 dev eno1 proto kernel scope link src 10.91.0.14 metric 100

# ip rule
0:      from all lookup local
32765:  from 192.168.13.14 lookup r0
32766:  from all lookup main
32767:  from all lookup default

# ip route show table r0
192.168.13.0/24 dev eth0 scope link

The target has the IP 192.168.13.13 and the route in the default
routing table (automatic entries not modified by me for simplicity).

If I take out the hardcoded 'NULL' in iser_connect() and put in a
hardcoded source IP address, just to test, then the connection is set
up properly. That tells me that iser_connect() knows what to do and
how to do it, it just never tries to use a source address if supplied
through the iface configuration.

> Do not try an extract a source address from some other information..

I want to get the source address (iface.ipaddress) from the iface
(eth0iser in this case) and pass that into iser_connect(). I'm just
not sure how to do that and where the best place to do that is. That
is what I need some help understanding. Any push in the right
direction is appreciated. Is the iface info parsed by the base iscsi
code and then put into a struct that I can query? I sure hope it is
that easy, but I'm having difficulty locating that code.

Thanks,
----------------
Robert LeBlanc
PGP Fingerprint 79A2 9CA4 6CC4 45DD A904  C70E E654 3BB2 FA62 B9F1
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jason Gunthorpe May 24, 2017, 9:13 p.m. UTC | #3
On Wed, May 24, 2017 at 01:41:25PM -0600, Robert LeBlanc wrote:

> > Do not try an extract a source address from some other information..
> 
> I want to get the source address (iface.ipaddress) from the iface
> (eth0iser in this case) and pass that into iser_connect().

That makes sense, I can't help you figure out where iface.ipaddress
appears in the kernel though :)

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Or Gerlitz May 25, 2017, 4:03 p.m. UTC | #4
On Wed, May 24, 2017 at 10:41 PM, Robert LeBlanc <robert@leblancnet.us> wrote:
[...]
> I want to get the source address (iface.ipaddress) from the iface
> (eth0iser in this case) and pass that into iser_connect(). I'm just
> not sure how to do that and where the best place to do that is. That
> is what I need some help understanding. Any push in the right
> direction is appreciated. Is the iface info parsed by the base iscsi
> code and then put into a struct that I can query? I sure hope it is
> that easy, but I'm having difficulty locating that code.

If you get the source address into the iscsi initiator UAPI it would
be very simple kernel
code change to get that to iser_connect --> rdma_resolve_address as
you indicated.

Currently only the dst address is passed from user-space, to see it
clone [1] and look

$ vim usr/netlink.c +/ktransport_ep_connect

see  there

memcpy(setparam_buf + sizeof(*ev), dst_addr, addrlen);

for the kernel side of things look here

$ vim drivers/scsi/scsi_transport_iscsi.c +/ep_connect

see there

dst_addr = (struct sockaddr *)((char*)ev + sizeof(*ev));
ep = transport->ep_connect(shost, dst_addr, non_blocking);


Or.


[1] https://github.com/open-iscsi/open-iscsi.git
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c
b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 5a887ef..e9741df 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -59,6 +59,7 @@ 
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/module.h>
+#include <linux/inet.h>

#include <net/sock.h>

@@ -814,6 +815,10 @@  static int iscsi_iser_get_ep_param(struct
iscsi_endpoint *ep,
       int err;
       struct iser_conn *iser_conn;
       struct iscsi_endpoint *ep;
+       struct sockaddr_in s_addr;
+       memset(&s_addr, 0, sizeof(s_addr));
+       s_addr.sin_family = AF_INET;
+       s_addr.sin_addr.s_addr = in_aton("192.168.13.14");

       ep = iscsi_create_endpoint(0);
       if (!ep)
@@ -829,7 +834,8 @@  static int iscsi_iser_get_ep_param(struct
iscsi_endpoint *ep,
       iser_conn->ep = ep;
       iser_conn_init(iser_conn);

-       err = iser_connect(iser_conn, NULL, dst_addr, non_blocking);
+       //err = iser_connect(iser_conn, NULL, dst_addr, non_blocking);
+       err = iser_connect(iser_conn, (struct sockaddr *) &s_addr,
dst_addr, non_blocking);
       if (err)
               goto failure;

diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c
b/drivers/infiniband/ulp/iser/iser_verbs.c
index c538a38..6ce1845 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -953,6 +953,7 @@  int iser_connect(struct iser_conn   *iser_conn,
       sprintf(iser_conn->name, "%pISp", dst_addr);

       iser_info("connecting to: %s\n", iser_conn->name);
+       iser_err("connecting from: %p\n", src_addr);

       /* the device is known only --after-- address resolution */
       ib_conn->device = NULL;