[openib-general] [PATCH] Enable inet6 on ib interface

Nitin Hande Nitin.Hande at Sun.COM
Thu Nov 11 09:58:45 PST 2004


signed off by: Nitin Hande <Nitin.Hande at Sun.Com>

I would appreciate if someone can review my patch to enable inet6
address on ib interface. This is the first cut, will like to hear from
all. I plan to setup a bugzilla account and append this patch to the bug
that Tom has created for inet6.


diff -Nurp -X dontdiff
/build1/nitin/linux/linux-2.6.9/net/ipv6/addrconf.c
linux-2.6.9/net/ipv6/addrconf.c
--- /build1/nitin/linux/linux-2.6.9/net/ipv6/addrconf.c	2004-11-10
14:43:53.568970000 -0800
+++ linux-2.6.9/net/ipv6/addrconf.c	2004-11-10 15:07:40.196227944 -0800
@@ -1110,6 +1110,13 @@ static int ipv6_generate_eui64(u8 *eui,
 		memset(eui, 0, 7);
 		eui[7] = *(u8*)dev->dev_addr;
 		return 0;
+	case ARPHRD_INFINIBAND:
+		/* XXX: replace len with IPOIB_HW_ADDR_LEN later */
+		if (dev->addr_len != 20)
+			return -1;
+		memcpy(eui, dev->dev_addr + 12, 8);
+		eui[0] ^= 2;
+		return 0;
 	}
 	return -1;
 }
@@ -1809,6 +1816,7 @@ static void addrconf_dev_config(struct n
 	if ((dev->type != ARPHRD_ETHER) &&
 	    (dev->type != ARPHRD_FDDI) &&
 	    (dev->type != ARPHRD_IEEE802_TR) &&
+	    (dev->type != ARPHRD_INFINIBAND) &&
 	    (dev->type != ARPHRD_ARCNET)) {
 		/* Alas, we support only Ethernet autoconfiguration. */
 		return;


--------------------------------------------
Usage and output:

Playing with link local address:
================================
sins-stinger-8:~/ipoibcfg/src # ifconfig ib0.8001 inet6 up

sins-stinger-8:~/ipoibcfg/src # ifconfig ib0.8001
ib0.8001  Link encap:UNSPEC  HWaddr
00-02-00-14-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:192.168.100.107  Bcast:192.168.100.255
Mask:255.255.255.0
          inet6 addr: fe80::202:c901:976:1f81/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:2044  Metric:1
          RX packets:31 errors:0 dropped:0 overruns:0 frame:0
          TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:128
          RX bytes:2832 (2.7 Kb)  TX bytes:3532 (3.4 Kb)

sins-stinger-8:~/ipoibcfg/src # ip -6 addr show
1: lo: <LOOPBACK,UP> mtu 16436
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
7: ib0.8001: <BROADCAST,MULTICAST,UP> mtu 2044 qlen 128
    inet6 fe80::202:c901:976:1f81/64 scope link
       valid_lft forever preferred_lft forever

sins-stinger-8:~/ipoibcfg/src # route -A inet6
Kernel IPv6 routing table
Destination                                 Next Hop
            Flags Metric Ref    Use Iface
::1/128                                     ::
            U     0      33       2 lo
fe80::202:c901:976:1f81/128                 ::
            U     0      9        2 lo
fe80::202:c901:976:5161/128                 fe80::202:c901:976:5161
            UC    0      2        0 ib0.8001
fe80::/64                                   ::
            U     256    0        0 ib0.8001
ff00::/8                                    ::
            U     256    0        0 ib0.8001

sins-stinger-8:~/ipoibcfg/src # ping6 -I ib0.8001 fe80::202:c901:976:5161
PING fe80::202:c901:976:5161(fe80::202:c901:976:5161) from
fe80::202:c901:976:1f81 ib0.8001: 56 data bytes
64 bytes from fe80::202:c901:976:5161: icmp_seq=1 ttl=64 time=2.77 ms
64 bytes from fe80::202:c901:976:5161: icmp_seq=2 ttl=64 time=0.067 ms
64 bytes from fe80::202:c901:976:5161: icmp_seq=3 ttl=64 time=0.066 ms
------------------------------------------------------------


global address and ssh test
================================

sins-stinger-8:~ # ifconfig ib0.8001 inet6 add 2222::2/64
sins-stinger-8:~ # ifconfig ib0.8001
ib0.8001  Link encap:UNSPEC  HWaddr
00-01-00-14-00-00-00-00-00-00-00-00-00-00-00-00
          inet6 addr: 2222::2/64 Scope:Global
          inet6 addr: fe80::202:c901:976:1f81/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:2044  Metric:1
          RX packets:549 errors:0 dropped:0 overruns:0 frame:0
          TX packets:174 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:128
          RX bytes:41510 (40.5 Kb)  TX bytes:25115 (24.5 Kb)

sins-stinger-8:~/ipoibcfg/src # ssh 2222::1
The authenticity of host '2222::1 (2222::1)' can't be established.
RSA key fingerprint is c5:47:5d:44:85:09:a9:b5:38:d7:48:78:f0:77:30:eb.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '2222::1' (RSA) to the list of known hosts.
Password:
Last login: Thu Nov 11 09:36:10 2004 from sr1-umpk-04.sfbay.sun.com
sins-stinger-04:~ # ifconfig ib0.8001
ib0.8001  Link encap:UNSPEC  HWaddr
00-01-00-14-00-00-00-00-00-00-00-00-00-00-00-00
          inet6 addr: 2222::1/64 Scope:Global
          inet6 addr: fe80::202:c901:976:5161/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:2044  Metric:1
          RX packets:703 errors:0 dropped:0 overruns:0 frame:0
          TX packets:652 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:128
          RX bytes:72617 (70.9 Kb)  TX bytes:66817 (65.2 Kb)
-----------------------------------------------

Interoperability between Solaris and Linux:
==============================================

sins-stinger-04:~/ipoibcfg/src # ifconfig ib0.8001
ib0.8001  Link encap:UNSPEC  HWaddr
00-01-00-14-00-00-00-00-00-00-00-00-00-00-00-00
          inet6 addr: 2222::1/64 Scope:Global
          inet6 addr: fe80::202:c901:976:5161/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:2044  Metric:1
          RX packets:726 errors:0 dropped:0 overruns:0 frame:0
          TX packets:668 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:128
          RX bytes:74673 (72.9 Kb)  TX bytes:69193 (67.5 Kb)

sins-stinger-04:~/ipoibcfg/src # uname -a
Linux sins-stinger-04 2.6.9 #4 SMP Tue Nov 9 20:25:28 PST 2004 x86_64
x86_64 x86_64 GNU/Linux
sins-stinger-04:~/ipoibcfg/src # ping6 -I ib0.8001 fe80::202:c901:976:5b01
PING fe80::202:c901:976:5b01(fe80::202:c901:976:5b01) from
fe80::202:c901:976:5161 ib0.8001: 56 data bytes
64 bytes from fe80::202:c901:976:5b01: icmp_seq=1 ttl=255 time=0.401 ms
64 bytes from fe80::202:c901:976:5b01: icmp_seq=2 ttl=255 time=0.228 ms
64 bytes from fe80::202:c901:976:5b01: icmp_seq=3 ttl=255 time=0.237 ms

--- fe80::202:c901:976:5b01 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.228/0.288/0.401/0.081 ms

root at caseate# ifconfig ibd1 inet6
ibd1: flags=2000841<UP,RUNNING,MULTICAST,IPv6> mtu 2044 index 4
        inet6 fe80::202:c901:976:5b01/10
root at caseate#
root at caseate# uname -a
SunOS caseate.SFBay.Sun.COM 5.10 s10_70 sun4u sparc SUNW,Sun-Fire-280R
root at caseate# ping fe80::202:c901:976:5161
fe80::202:c901:976:5161 is alive
root at caseate#


IThanks
Nitin






More information about the general mailing list