Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Mar 2019 01:32:38 +0100
From:      Andreas Kempe <kempe@lysator.liu.se>
To:        freebsd-net@freebsd.org
Subject:   Infiniband: IPv6 neighbour discovery issues using Mellanox MT26418 between Linux and FreeBSD
Message-ID:  <19d07d9c-aa07-41a5-26fb-5fd2c9df99ca@lysator.liu.se>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------2A3F9CC92A10F5FDE9880DF5
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Hello!

We have been trying to use IPv6 together with Mellanox MT26418 and are
having issues with neighbour discovery responses not getting back to the
requesting machine when connecting a Linux machine to a FreeBSD machine.
The request is visible in tcpdump on both machines. On the responding
machine, the outgoing response message is visible, but on the requesting
machine, the response is not visible. It didn't matter whether the Linux
box or the FreeBSD box was the requester.

We applied the attached patch to ndp (since ndp is currently lacking
support for link layer addresses larger than 6 bytes) to be able to set
static neighbours and then the traffic got through.

When running traffic between two FreeBSD hosts, it worked without any
manual intervention.

The Linux machine is running Gentoo with Linux 4.14.83 and was acting as
the OpenSM master, while the FreeBSD machines are running 11.2-RELEASE-p9.

Does anyone recognise these issues?

Thank you for any assistance!
Cordially,
Andreas Kempe

--------------2A3F9CC92A10F5FDE9880DF5
Content-Type: text/x-patch;
 name="ndp-ib-lladdr-fix.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
 filename="ndp-ib-lladdr-fix.patch"

--- usr.sbin/ndp/ndp.c.old	2019-03-13 22:06:05.472614000 +0100
+++ usr.sbin/ndp/ndp.c	2019-03-14 01:10:30.049934000 +0100
@@ -388,7 +388,7 @@
 	register struct sockaddr_dl *sdl;
 	register struct rt_msghdr *rtm =3D &(m_rtmsg.m_rtm);
 	struct addrinfo hints, *res;
-	int gai_error;
+	int gai_error, l;
 	u_char *ea;
 	char *host =3D argv[0], *eaddr =3D argv[1];
=20
@@ -410,8 +410,9 @@
 	sin->sin6_scope_id =3D
 	    ((struct sockaddr_in6 *)res->ai_addr)->sin6_scope_id;
 	ea =3D (u_char *)LLADDR(&sdl_m);
-	if (ndp_ether_aton(eaddr, ea) =3D=3D 0)
-		sdl_m.sdl_alen =3D 6;
+	l =3D ndp_ether_aton(eaddr, ea);
+	if (l !=3D -1)
+		sdl_m.sdl_alen =3D l;
 	flags =3D expire_time =3D 0;
 	while (argc-- > 0) {
 		if (strncmp(argv[0], "temp", 4) =3D=3D 0) {
@@ -804,17 +805,33 @@
 static int
 ndp_ether_aton(char *a, u_char *n)
 {
-	int i, o[6];
+	int i, l, o[20];
+	char buf[60];
+	char *p;
=20
-	i =3D sscanf(a, "%x:%x:%x:%x:%x:%x", &o[0], &o[1], &o[2],
-	    &o[3], &o[4], &o[5]);
-	if (i !=3D 6) {
-		fprintf(stderr, "ndp: invalid Ethernet address '%s'\n", a);
-		return (1);
+	l =3D 0;
+	p =3D strncpy(buf, a, sizeof(buf));
+	if (p < (buf + sizeof(buf))) {
+		for (p =3D strtok(buf, ":"); p; l++, p =3D strtok(NULL, ":")) {
+			if (l > 19) {
+				/* l =3D 0 to indicate an error */
+				l =3D 0;
+				break;
+			}
+
+			if (sscanf(p, "%x", &o[l]) !=3D 1) {
+				break;
+			}
+		}
 	}
-	for (i =3D 0; i < 6; i++)
+	if (l > 20 || (l !=3D 6 && l !=3D 20)) {
+		fprintf(stderr, "ndp:  invalid Ethernet address '%s'\n",
+		    a);
+		return (-1);
+	}
+	for (i =3D 0; i < l; i++)
 		n[i] =3D o[i];
-	return (0);
+	return (l);
 }
=20
 static void

--------------2A3F9CC92A10F5FDE9880DF5--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19d07d9c-aa07-41a5-26fb-5fd2c9df99ca>