めもめも

このブログに記載の内容は個人の見解であり、必ずしも所属組織の立場、戦略、意見を代表するものではありません。

Private fix for the "ip netns" issue of Fedora17/18

Note(2013/02/20)

Official patch is now in the stable updates repo :)

You can now just apply the latest fix.

# yum update iproute

Background

Fedora17/18 has a problem that "ip netns exec" breaks the /sys mount tree and it impacts on using Quantum with netns enabled. The official patch is under development here. This is a way to apply a private fix to it until the official one is available.

Steps

Install pre-reqs for rpm build.

# yum groupinstall "Development Tools"
# yum install tar tex linuxdoc-tools linux-atm-libs-devel psutils libdb-devel iptables-devel libnl-devel texlive-cm-super texlive-ec

Install src.rpm of iproute.

# yum install yum-utils
# yumdownloader --source iproute
# rpm -ivh iproute-3.6.0-5.fc18.src.rpm 
# cd rpmbuild/SPECS/

Add a private patch.

../SOURCES/ipnetns.c.patch

--- iproute2-3.6.0/ip/ipnetns.c.orig	2012-11-29 18:05:19.304832997 +0900
+++ iproute2-3.6.0/ip/ipnetns.c		2012-12-01 11:48:33.224793150 +0900
@@ -153,6 +153,7 @@
 		return -1;
	}
	/* Mount a version of /sys that describes the network namespace */
+/*
	if (umount2("/sys", MNT_DETACH) < 0) {
		fprintf(stderr, "umount of /sys failed: %s\n", strerror(errno));
		return -1;
@@ -161,6 +162,7 @@
		fprintf(stderr, "mount of /sys failed: %s\n",strerror(errno));
		return -1;
	}
+*/

	/* Setup bind mounts for config files in /etc */
	bind_etc(name);

Modify the spec file.

iproute.spec

...
Patch12:            iproute2-3.7.0-ipv6-nexthop.patch
Patch13:            ipnetns.c.patch              # Add this line
...
%patch12 -p1 -b .ipv6-nexthop
%patch13 -p1 -b .ipnetns                         # Add this line
...

Build a private rpm and install it.

# rpmbuild -bb iproute.spec --target x86_64
# rpm -ivh ../RPMS/x86_64/iproute-3.6.0-5.fc18.x86_64.rpm --force