Re: [ofa-general] [PATCH 2.6.25] RDMA/cxgb3: Fail loopbackconnections.

2008-02-13 Thread Steve Wise

Steve Wise wrote:

Roland Dreier wrote:

Steve, I had to update the patch adding an include and fixing the
function declaration (as below)... but how much testing have you done
with this??



Now I understand.  I thought I'd fixed these!  I fixed them locally in 
the test tree on my victim and then tested, but forgot to update my git 
tree.


Sorry for this.

You want me to resubmit?



BTW: Testing:  I cloned my git tree, resolved the two compile issues 
(void + include), then built and installed the kernel (2.6.25-rc1 + the 
fixed patch).  I then ensured that a connection to the local address 
caused the ENOSYS error.


I just forgot to pull the updated file back into my stg managed git tree.

:(
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [ofa-general] [PATCH 2.6.25] RDMA/cxgb3: Fail loopbackconnections.

2008-02-13 Thread Steve Wise

Roland Dreier wrote:

Steve, I had to update the patch adding an include and fixing the
function declaration (as below)... but how much testing have you done
with this??



Now I understand.  I thought I'd fixed these!  I fixed them locally in 
the test tree on my victim and then tested, but forgot to update my git 
tree.


Sorry for this.

You want me to resubmit?



commit 8704e9a8790cc9e394198663c1c9150c899fb9a2
Author: Steve Wise <[EMAIL PROTECTED]>
Date:   Tue Feb 12 16:09:29 2008 -0600

RDMA/cxgb3: Fail loopback connections

The cxgb3 HW and driver don't support loopback RDMA connections.  So

fail any connection attempt where the destination address is local.

Signed-off-by: Steve Wise <[EMAIL PROTECTED]>

Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>

diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c 
b/drivers/infiniband/hw/cxgb3/iwch_cm.c
index e9a08fa..320f2b6 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_cm.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 

 #include 
@@ -1784,6 +1785,17 @@ err:
return err;
 }
 
+static int is_loopback_dst(struct iw_cm_id *cm_id)

+{
+   struct net_device *dev;
+
+   dev = ip_dev_find(&init_net, cm_id->remote_addr.sin_addr.s_addr);
+   if (!dev)
+   return 0;
+   dev_put(dev);
+   return 1;
+}
+
 int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
 {
int err = 0;
@@ -1791,6 +1803,11 @@ int iwch_connect(struct iw_cm_id *cm_id, struct 
iw_cm_conn_param *conn_param)
struct iwch_ep *ep;
struct rtable *rt;
 
+	if (is_loopback_dst(cm_id)) {

+   err = -ENOSYS;
+   goto out;
+   }
+
ep = alloc_ep(sizeof(*ep), GFP_KERNEL);
if (!ep) {
printk(KERN_ERR MOD "%s - cannot alloc ep.\n", __FUNCTION__);


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [ofa-general] [PATCH 2.6.25] RDMA/cxgb3: Fail loopbackconnections.

2008-02-13 Thread Roland Dreier
Steve, I had to update the patch adding an include and fixing the
function declaration (as below)... but how much testing have you done
with this??

commit 8704e9a8790cc9e394198663c1c9150c899fb9a2
Author: Steve Wise <[EMAIL PROTECTED]>
Date:   Tue Feb 12 16:09:29 2008 -0600

RDMA/cxgb3: Fail loopback connections

The cxgb3 HW and driver don't support loopback RDMA connections.  So
fail any connection attempt where the destination address is local.

Signed-off-by: Steve Wise <[EMAIL PROTECTED]>
Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>

diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c 
b/drivers/infiniband/hw/cxgb3/iwch_cm.c
index e9a08fa..320f2b6 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_cm.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1784,6 +1785,17 @@ err:
return err;
 }
 
+static int is_loopback_dst(struct iw_cm_id *cm_id)
+{
+   struct net_device *dev;
+
+   dev = ip_dev_find(&init_net, cm_id->remote_addr.sin_addr.s_addr);
+   if (!dev)
+   return 0;
+   dev_put(dev);
+   return 1;
+}
+
 int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
 {
int err = 0;
@@ -1791,6 +1803,11 @@ int iwch_connect(struct iw_cm_id *cm_id, struct 
iw_cm_conn_param *conn_param)
struct iwch_ep *ep;
struct rtable *rt;
 
+   if (is_loopback_dst(cm_id)) {
+   err = -ENOSYS;
+   goto out;
+   }
+
ep = alloc_ep(sizeof(*ep), GFP_KERNEL);
if (!ep) {
printk(KERN_ERR MOD "%s - cannot alloc ep.\n", __FUNCTION__);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [ofa-general] [PATCH 2.6.25] RDMA/cxgb3: Fail loopbackconnections.

2008-02-13 Thread Steve Wise

Roland Dreier wrote:

  > how can a static void function return 0?

good question... I've fixed the patch in my tree.


oops.


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [ofa-general] [PATCH 2.6.25] RDMA/cxgb3: Fail loopbackconnections.

2008-02-13 Thread Roland Dreier
  > how can a static void function return 0?

good question... I've fixed the patch in my tree.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [ofa-general] [PATCH 2.6.25] RDMA/cxgb3: Fail loopbackconnections.

2008-02-13 Thread Diego Guella

One question below


- Original Message - 
From: "Roland Dreier" <[EMAIL PROTECTED]>

To: "Steve Wise" <[EMAIL PROTECTED]>
Cc: ; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, February 13, 2008 1:26 AM
Subject: Re: [ofa-general] [PATCH 2.6.25] RDMA/cxgb3: Fail loopbackconnections.



applied, although:

> +static void is_loopback_dst(struct iw_cm_id *cm_id)
> +{
> + struct net_device *dev;
> + 
> + dev = ip_dev_find(&init_net, cm_id->remote_addr.sin_addr.s_addr);

> + if (!dev)
> + return 0;


how can a static void function return 0?
%)


> + dev_put(dev);
> + return 1;


same here


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html