[openib-general] [PATCH] arping for IPoIB

Hal Rosenstock halr at voltaire.com
Fri Aug 5 08:46:12 PDT 2005


Fix broadcast address for IPoIB interfaces

Note this patch is (currently) dependent on the previous sockaddr_ll
change. Should I make it otherwise ?

Note also that this reincludes Tom patch as well.

Signed-off-by: Hal Rosenstock <halr at voltaire.com>

--- arping.c.orig	2001-10-05 18:42:47.000000000 -0400
+++ arping.c	2005-08-05 08:45:02.000000000 -0400
@@ -56,9 +56,17 @@ struct timeval start, last;
 int sent, brd_sent;
 int received, brd_recv, req_recv;
 
+static const uint8_t ipv4_bcast_addr[] = {
+	0x00, 0xff, 0xff, 0xff,
+	0xff, 0x12, 0x40, 0x1b, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+};
+
 #define MS_TDIFF(tv1,tv2) ( ((tv1).tv_sec-(tv2).tv_sec)*1000 + \
 			   ((tv1).tv_usec-(tv2).tv_usec)/1000 )
 
+#define min(x,y) ((x)<(y) ? (x) : (y))
+
 void usage(void)
 {
 	fprintf(stderr,
@@ -476,7 +484,10 @@ main(int argc, char **argv)
 	}
 
 	he = me;
-	memset(he.sll_addr, -1, he.sll_halen);
+	if (me.sll_hatype == ARPHRD_INFINIBAND)
+		memcpy(&he.sll_addr, &ipv4_bcast_addr, sizeof(ipv4_bcast_addr));
+	else
+		memset(he.sll_addr, -1, min(he.sll_halen, sizeof he.sll_addr));
 
 	if (!quiet) {
 		printf("ARPING %s ", inet_ntoa(dst));






More information about the general mailing list