Package: ifupdown
Version: 0.7.53.1
Severity: normal
Tags: patch

Hi,

InfiniBand supports partitions for network isolation using a 16-bit
partition key. This is similar to VLANs. You can use IPoIB to run IP
traffic over a InfiniBand partition. The IP devices is called
$interface.$partition where $partition is the hex value of the
partition. Example: ib0.beef ib0.d00d are two partitions of the
InfiniBand device ib0.

ifupdown assumes that the InfiniBand partitions are VLANs and tries to
run "ip link add link" (ifup) and "ip link del" (ifdown) on them, which
will cause error messages.

Instead ifupdown should create the InfiniBand partitions if they are not
present on ifup by running 
"echo 0x%partition% > /sys/class/net/%device%/create_child"
and delete it on ifdown by running
"echo 0x%partition% > /sys/class/net/%device%/delete_child".

We implemented a fix for jessie by patching the link.defn to check the
device to be a InfiniBand devices and run the commands above instead
(patch is attached).. Maybe the InfiniBand support should be placed in a
separate .defn definition file.

-- 
Benjamin Drung
System Developer
Debian & Ubuntu Developer

ProfitBricks GmbH
Greifswalder Str. 207
D - 10405 Berlin

Email: [email protected]
URL:  http://www.profitbricks.com

Sitz der Gesellschaft: Berlin.
Registergericht: Amtsgericht Charlottenburg, HRB 125506B.
Geschäftsführer: Andreas Gauger, Achim Weiss.
>From dbf88e8b4f1535a6b83a666630f52539d756e51b Mon Sep 17 00:00:00 2001
From: Benjamin Drung <[email protected]>
Date: Wed, 6 Jul 2016 16:26:16 +0200
Subject: [PATCH] Add Infiniband partition key support

InfiniBand supports partitions for network isolation using a 16-bit
partition key. This is similar to VLANs. You can use IPoIB to run IP
traffic over a InfiniBand partition. The IP devices is called
$interface.$partition where $partition is the hex value of the
partition. Example: ib0.beef ib0.d00d are two partitions of the
InfiniBand device ib0.

ifupdown assumes that the InfiniBand partitions are VLANs and tries to
run "ip link add link" (ifup) and "ip link del" (ifdown) on them, which
will cause error messages.

Instead ifupdown should create the InfiniBand partitions if they are not
present on ifup by running
"echo 0x%partition% > /sys/class/net/%device%/create_child"
and delete it on ifdown by running
"echo 0x%partition% > /sys/class/net/%device%/delete_child".

diff --git a/debian/changelog b/debian/changelog
diff --git a/link.defn b/link.defn
index 5e296a6..456c710 100644
--- a/link.defn
+++ b/link.defn
@@ -13,13 +13,21 @@ method none
     if test -d /sys/class/net/%link% -a \
             ! -d /sys/class/net/%iface0% ; \
     then \
-        ip link set up dev %link%; \
-        ip link add link %link% name %iface0% type vlan id %vlan_id%; \
+        if test -d /sys/class/net/%link%/device/infiniband; then \
+            echo 0x%vlan_id% > /sys/class/net/%link%/create_child; \
+        else \
+            ip link set up dev %link%; \
+            ip link add link %link% name %iface0% type vlan id %vlan_id%; \
+        fi; \
     fi if (iface_has(".") && (!var_set_anywhere("bridge_ports", ifd)))
     -ip link set up dev %iface% 2>/dev/null \
 	if (iface_is_lo())
   down
-    ip link del %iface% if (iface_has(".") && (!iface_has(":")) && (!var_set_anywhere("bridge_ports", ifd)))
+    if test -d /sys/class/net/%link%/device/infiniband; then \
+        echo 0x%vlan_id% > /sys/class/net/%link%/delete_child; \
+    else \
+        ip link del %iface%; \
+    fi if (iface_has(".") && (!iface_has(":")) && (!var_set_anywhere("bridge_ports", ifd)))
     -ip link set down dev %iface% 2>/dev/null \
 	if (iface_is_lo())
 
-- 
2.7.4

Reply via email to