[openib-general] [PATCH] ib_addr: local/loopback address handling

Michael S. Tsirkin mst at mellanox.co.il
Sun Mar 26 06:49:06 PST 2006


Quoting r. Michael S. Tsirkin <mst at mellanox.co.il>:
> Subject: [PATCH] CMA: local/loopback address handling
> 
> Sean,
> Apparently, on bind, loopback addresses such as 127.0.0.1 in TCP have the same
> meaning as zeronet ANY address.
> 
> Specifically,
> getaddrinfo(NULL, port, &hints, &res);
> 
> seems to return 127.0.0.1 as interface.
> 
> The following patch makes it work for CMA as well.
> I also changed cma_loopback_addr to match any address in LOOPBACK
> subnet.
> 
> --
> 
> Interpret any ZERONET/LOOPBACK address as INADDR_ANY.
> Make cma_loopback_addr match any address in LOOPBACK subnet.
> 
> Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>
> 
> Interpret any ZERONET/LOOPBACK address as INADDR_ANY.
> Make cma_loopback_addr match any address in LOOPBACK subnet.
> 
> Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>

Same thing for addr.c:

---

Interpret any ZERONET/LOOPBACK address as INADDR_ANY for address resolution.

Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>

Index: linux-2.6.16/drivers/infiniband/core/addr.c
===================================================================
--- linux-2.6.16/drivers/infiniband/core/addr.c	(revision 6012)
+++ linux-2.6.16/drivers/infiniband/core/addr.c	(working copy)
@@ -272,7 +279,7 @@ static int addr_resolve_local(struct soc
 	if (!dev)
 		return -EADDRNOTAVAIL;
 
-	if (!src_ip) {
+	if (ZERONET(src_ip) || LOOPBACK(src_ip)) {
 		src_in->sin_family = dst_in->sin_family;
 		src_in->sin_addr.s_addr = dst_ip;
 		ret = copy_addr(addr, dev, dev->dev_addr);

-- 
Michael S. Tsirkin
Staff Engineer, Mellanox Technologies



More information about the general mailing list