[ofa-general] patch to ib_addr for sending arps

Leo Tominna leo.tominna at oracle.com
Wed Jul 8 16:11:29 PDT 2009


This patch appears to help when strict ARP handling is enabled or when 
non-standard routing tables are used.  The ARP request is replied to 
through the device that will be used for subsequent communication, so 
the ARP entry gets associated with the correct device in the ARP cache.  
tcpdump shows consistent ARPs generated by similar arguments to ping and 
rds-ping. 

--- ofa_kernel-1.5/drivers/infiniband/core/addr.c.orig  2009-07-08 
15:07:52.000000000 -0700
+++ ofa_kernel-1.5/drivers/infiniband/core/addr.c       2009-07-08 
15:23:49.000000000 -0700
@@ -176,7 +176,7 @@
        mutex_unlock(&lock);
 }
 
-static void addr_send_arp(struct sockaddr *dst_in)
+static void addr_send_arp(struct sockaddr *src_in, struct sockaddr *dst_in)
 {
        struct rtable *rt;
        struct flowi fl;
@@ -185,6 +185,9 @@
 
        switch (dst_in->sa_family) {
        case AF_INET:
+               if (src_in)
+                       fl.nl_u.ip4_u.saddr =
+                               ((struct sockaddr_in *) 
src_in)->sin_addr.s_addr;
                fl.nl_u.ip4_u.daddr =
                        ((struct sockaddr_in *) dst_in)->sin_addr.s_addr;
 
@@ -200,6 +203,9 @@
        {
                struct dst_entry *dst;
 
+               if (src_in)
+                       fl.nl_u.ip6_u.saddr =
+                               ((struct sockaddr_in6 *) src_in)->sin6_addr;
                fl.nl_u.ip6_u.daddr =
                        ((struct sockaddr_in6 *) dst_in)->sin6_addr;
 
@@ -467,7 +473,7 @@
        case -ENODATA:
                req->timeout = msecs_to_jiffies(timeout_ms) + jiffies;
                queue_req(req);
-               addr_send_arp(dst_in);
+               addr_send_arp(src_in, dst_in);
                break;
        default:
                ret = req->status;




More information about the general mailing list