LXC iproute2

Overview

This page is under construction and isn't named too accurately. It will probably get at the very least a rename-move but for now it stays with the same misnomer because it turned out it isn't about iproute2 at all really. At the moment it's more where some information gleaned about using LXC containers with libvirt and OpenvSwitch is being constructed.

It seems that iproute2 has been reported to have some issue with LXC OpenvSwitch XML libvirt configuration on Debian. It was thought initially that that was the problem in this case, which turned out to be not the case. In this case the problem was pure and simple incomplete configuration of LXC config file for OpenvSwitch (OVS) connectivity. The details of the correct configuration which works are shown below in the update section.

The problem that was being observed as a result of the LXC config file incomplete specification for OVS is shown below.

gstanden@vmem1:~$ virsh -c lxc:/// start lxcora1

error: Failed to start domain lxcora1

error: internal error: Failed to allocate free veth pair after 10 attempts

There was a post that suggested that iproute2 was the culprit as described here which was the original genesis of this blog post. It turned out all the work getting different versions of the "/bin/ip" program compiled from source and installed were unnecessary. However, the red herring journey was a good review for me of using "diff -u" and "patch" to patch library "c" files so the blog post contains some good info about that, in addition to the main update, immediately below, explaining how LXC containers were successfully wrapped in libvirt XML and configured to use OVS networking.

This blog content on this page owes a great deal to the excellent and concise guides provided by Scott Lowe which were the unquestioned starting point for this work documented on this blog. Scott Lowe pages that were referenced include: Linux Containers via LXC and Libvirt and the companion blog Connecting LXC to Open vSwitch Using Libvirt. Other blogs by Scott Lowe that were consulted as well were A Brief Introduction to Linux Containers with LXC and Using VLANs with OVS and libvirt. Also, there is a good guide from libvirt.org itself covering the libvirt LXC container driver here. Ubuntu also has a useful page on LXC here.

Configure LXC Container for OpenvSwitch

BEGIN UPDATE 2014-09-07

It turned out that iproute2 was not the culprit at all. It turns out that the OpenvSwitch for LXC was not configured correctly in the LXC container configuration. The information below however on installing different versions of iproute2 on Ubuntu 14.04.1 desktop 64-bit was an interesting and valuable exercise, so that content below is being retained for a rainy day. However, the fix to get LXC containers working with virsh wrapper is described below.

First, read this post here on how to edit the config file for LXC containers to enable hookup to OpenvSwitch (OVS) to LXC containers. An example of my edited LXC config file for the LXC container "lxcora1" is shown below. The bolded lines are the changes needed for OpenvSwitch. Note that the solution in use for KVM guest networking with OVS uses a scheme where the OVS ports are pre-created and added to the switch at bootup time of the KVM host (the Lenovo W520 laptop) whereas here with the LXC containers, an OVS port "s8" which does not currently exist must be chosen. The port can be named anything such as give it the same name as the host which it connects to help with knowing which port goes to which server (which can be seen using "sudo ovs-vsctl show"). But the important thing is if you have alot of LXC containers, be sure to keep the ports chosen for those servers reserved and don't use them for something else later because the LXC containers won't start if the port is already created and attached to the OVS switch.

gstanden@vmem1:~$ sudo su -

[sudo] password for gstanden:

root@vmem1:~# cd /var/lib/lxc/lxcora1

root@vmem1:/var/lib/lxc/lxcora1# more config

# Template used to create this container: /usr/share/lxc/templates/lxc-oracle

# Parameters passed to the template:

# For additional config options, please look at lxc.container.conf(5)

lxc.network.type = veth

lxc.network.flags = up

# lxc.network.link = lxcbr0

lxc.network.script.up = /etc/network/if-up.d/lxc-ifup

lxc.network.script.down = /etc/network/if-down.d/lxc-ifdown

lxc.network.veth.pair = s8

lxc.network.hwaddr = 00:16:3e:27:24:2a

lxc.rootfs = /var/lib/lxc/lxcora1/rootfs

# Common configuration

lxc.include = /usr/share/lxc/config/oracle.common.conf

# Container configuration for Oracle Linux 6.5

lxc.arch = x86_64

lxc.utsname = lxcora1

lxc.cap.drop = sys_resource

# Networking

lxc.network.name = eth0

lxc.network.mtu = 1500

lxc.network.hwaddr = fe:6a:0e:fe:46:68

root@vmem1:/var/lib/lxc/lxcora1#

Once this config script is modified, it's also necessary to create and make executable the two scripts that are referenced in the config file. Those are the "lxc-ifup" and the "lxc-ifdown" scripts. Those are shown below. These scripts are necessary to add and remove the ports from the OVS switch during start and stop of the LXC container.

gstanden@vmem1:~$ cd /etc/network/if-up.d

gstanden@vmem1:/etc/network/if-up.d$ cat lxc-ifup

#!/bin/bash

ovsBr='sw1'

ovs-vsctl --may-exist add-br ${ovsBr}

ovs-vsctl --may-exist add-port ${ovsBr} $5

gstanden@vmem1:/etc/network/if-up.d$ cd ..

gstanden@vmem1:/etc/network$ cd if-down.d

gstanden@vmem1:/etc/network/if-down.d$ cat lxc-ifdown

#!/bin/bash

ovsBr='sw1'

ovs-vsctl --if-exists del-port ${ovsBr} $5

gstanden@vmem1:/etc/network/if-down.d$ ls -lrt lxc-ifdown

-rwxr-xr-x 1 root root 67 Sep 6 20:03 lxc-ifdown

gstanden@vmem1:/etc/network/if-down.d$ cd ..

gstanden@vmem1:/etc/network$ cd if-up.d

gstanden@vmem1:/etc/network/if-up.d$ ls -lrt lxc-ifup

-rwxr-xr-x 1 root root 107 Sep 6 20:02 lxc-ifup

gstanden@vmem1:/etc/network/if-up.d$

Configure LXC for libvirt Wrapper (OVS network)

Next is presented the details about the XML that is used in the KVM guest wrapper for the LXC container so that the LXC container can be run from libvirt (virsh). and so that when run using virsh commands the LXC container will use OVS for networking. Below is shown the libvirt XML example for LXC container "lxcora1". The below example shows how an LXC container "lxcora1" was successfully wrapped by libvirt and configured to use OVS switch "sw1" port "s8" for networking. This XML code for the OVS networking is identifical to what is used for the KVM guests, verbatim. It's clear then why the config for the LXC container has to have the port definition in it because otherwise the XML below finds no port "s8" and complains with the error referenced at the beginning of this blog post about the fail of the allocation of a "veth pair".

gstanden@vmem1:~$ virsh -c lxc:// dumpxml lxcora1

<domain type='lxc' id='5421'>

<name>lxcora1</name>

<uuid>6ced4628-a4d2-4edb-859d-9415f20d6fa6</uuid>

<memory unit='KiB'>10240</memory>

<currentMemory unit='KiB'>10240</currentMemory>

<vcpu placement='static'>1</vcpu>

<resource>

<partition>/machine</partition>

</resource>

<os>

<type arch='x86_64'>exe</type>

<init>/sbin/init</init>

</os>

<clock offset='utc'/>

<on_poweroff>destroy</on_poweroff>

<on_reboot>restart</on_reboot>

<on_crash>destroy</on_crash>

<devices>

<emulator>/usr/lib/libvirt/libvirt_lxc</emulator>

<filesystem type='mount' accessmode='passthrough'>

<source dir='/var/lib/lxc/lxcora1/rootfs'/>

<target dir='/'/>

</filesystem>

<interface type='bridge'>

<mac address='52:54:00:c7:a3:17'/>

<source bridge='sw1'/>

<virtualport type='openvswitch'>

<parameters interfaceid='aaaacfa7-af63-4d21-9aa7-398d4b16d499'/>

</virtualport>

<target dev='s8'/>

<model type='virtio'/>

</interface>

<console type='pty' tty='/dev/pts/0'>

<source path='/dev/pts/0'/>

<target type='lxc' port='0'/>

<alias name='console0'/>

</console>

</devices>

<seclabel type='none'/>

</domain>

gstanden@vmem1:~$

Note that when creating the openvswitch stanza in the libvirt XML wrapper, omit the "interfaceid" line because OVS will create that automatically by automation when the XML file is saved. So, for this example, the XML code prior to save and prior to first execution would be as shown below.

<interface type='bridge'>

<mac address='52:54:00:c7:a3:17'/>

<source bridge='sw1'/>

<virtualport type='openvswitch'/> <-- Note the trailing "/" that is needed!

<target dev='s8'/ <-- Note that the "target dev" MUST match the value from /var/lib/lxc/lxcora1/config

<model type='virtio'/>

</interface

END UPDATE 2014-09-07.

Ubuntu 14.04.1 iproute2 Version

The current version information for iproute2 in the default Ubuntu 14.04.1 Desktop 64-bit edition is shown below.

gstanden@vmem1:~$ apt-cache showpkg iproute2

Package: iproute2

Versions:

3.12.0-2 (/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_trusty_main_binary-amd64_Packages) (/var/lib/dpkg/status)

Description Language:

File: /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_trusty_main_binary-amd64_Packages

MD5: d10cc46ca4a9e5489b7d2c879fcfba17

Description Language: en

File: /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_trusty_main_i18n_Translation-en

MD5: d10cc46ca4a9e5489b7d2c879fcfba17

Reverse Depends:

ifupdown,iproute2

iproute2:i386,iproute2

snort,iproute2

iodine,iproute2

inxi,iproute2

ifupdown-extra,iproute2

gogoc,iproute2

ganeti,iproute2

firehol,iproute2

ctdb,iproute2

core-network-daemon,iproute2

vlan,iproute2

ubuntu-minimal,iproute2

strongswan-ike,iproute2

openvpn,iproute2

network-manager,iproute2

isc-dhcp-client,iproute2

iproute,iproute2

ifupdown,iproute2

ifenslave,iproute2

Dependencies:

3.12.0-2 - libc6 (2 2.14) libdb5.3 (0 (null)) iproute2-doc (0 (null)) libatm1 (2 2.4.1-17~) libxtables10 (0 (null)) arpd (0 (null)) arpd:i386 (0 (null)) iproute (3 20130000-1) iproute:i386 (3 20130000-1) iproute (0 (null)) iproute:i386 (0 (null)) iproute2:i386 (0 (null))

Provides:

3.12.0-2 - iproute2:i386 arpd:i386 arpd

Reverse Provides:

iproute2:i386 3.12.0-2

gstanden@vmem1:~

Source package for version 3.12.0-2 iproute2 source for Ubuntu 14.04.1 Trusty Tahr can be obtained here. Download the source as shown below.

gstanden@vmem1:~/Downloads$ wget http://archive.ubuntu.com/ubuntu/pool/main/i/iproute2/iproute2_3.12.0-2.debian.tar.xz

--2014-09-06 14:22:45-- http://archive.ubuntu.com/ubuntu/pool/main/i/iproute2/iproute2_3.12.0-2.debian.tar.xz

Resolving archive.ubuntu.com (archive.ubuntu.com)... 91.189.92.201, 91.189.91.15, 91.189.91.14, ...

Connecting to archive.ubuntu.com (archive.ubuntu.com)|91.189.92.201|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 26352 (26K) [application/x-tar]

Saving to: ‘iproute2_3.12.0-2.debian.tar.xz’

100%[================================================================================================================================>] 26,352 91.6KB/s in 0.3s

2014-09-06 14:22:45 (91.6 KB/s) - ‘iproute2_3.12.0-2.debian.tar.xz’ saved [26352/26352]

gstanden@vmem1:~/Downloads$

Patch the iplink.c file using the diff file as found here and shown below. We need to recompile with a patched iplink.c file. Not exactly sure how I will figure out the patch yet on Ubuntu, but we need to prepare to compile a package from source as described here.

As shown below.

gstanden@vmem1:~/Downloads$ mkdir ubuntu-iproute2

gstanden@vmem1:~/Downloads$ cd ubuntu-iproute2/

gstanden@vmem1:~/Downloads/ubuntu-iproute2$ sudo apt-get build-dep iproute2

[sudo] password for gstanden:

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following NEW packages will be installed:

iptables-dev libatm1-dev libdb-dev libdb5.3-dev libptexenc1 libsp1c2

linuxdoc-tools luatex lynx lynx-cur sp tex-common texlive-base

texlive-binaries texlive-fonts-recommended texlive-latex-base

texlive-latex-recommended

0 upgraded, 17 newly installed, 0 to remove and 0 not upgraded.

Need to get 40.9 MB of archives.

After this operation, 127 MB of additional disk space will be used.

Do you want to continue? [Y/n] Y

Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/main iptables-dev amd64 1.4.21-1ubuntu1 [55.3 kB]

Get:2 http://us.archive.ubuntu.com/ubuntu/ trusty/main libatm1-dev amd64 1:2.5.1-1.5 [45.1 kB]

Get:3 http://us.archive.ubuntu.com/ubuntu/ trusty/main libptexenc1 amd64 2013.20130729.30972-2build3 [33.9 kB]

Get:4 http://us.archive.ubuntu.com/ubuntu/ trusty/main libsp1c2 amd64 1.3.4-1.2.1-47.3ubuntu1 [1,026 kB]

Get:5 http://us.archive.ubuntu.com/ubuntu/ trusty/main sp amd64 1.3.4-1.2.1-47.3ubuntu1 [124 kB]

Get:6 http://us.archive.ubuntu.com/ubuntu/ trusty/main linuxdoc-tools amd64 0.9.69-2 [542 kB]

Get:7 http://us.archive.ubuntu.com/ubuntu/ trusty/main tex-common all 4.04 [621 kB]

Get:8 http://us.archive.ubuntu.com/ubuntu/ trusty/main luatex amd64 0.76.0-3ubuntu1 [2,776 kB]

Get:9 http://us.archive.ubuntu.com/ubuntu/ trusty/main texlive-binaries amd64 2013.20130729.30972-2build3 [4,059 kB]

Get:10 http://us.archive.ubuntu.com/ubuntu/ trusty/main texlive-base all 2013.20140215-1 [16.2 MB]

Get:11 http://us.archive.ubuntu.com/ubuntu/ trusty/main texlive-fonts-recommended all 2013.20140215-1 [5,715 kB]

Get:12 http://us.archive.ubuntu.com/ubuntu/ trusty/main texlive-latex-base all 2013.20140215-1 [828 kB]

Get:13 http://us.archive.ubuntu.com/ubuntu/ trusty/main texlive-latex-recommended all 2013.20140215-1 [7,268 kB]

Get:14 http://us.archive.ubuntu.com/ubuntu/ trusty/main libdb5.3-dev amd64 5.3.28-3ubuntu3 [716 kB]

Get:15 http://us.archive.ubuntu.com/ubuntu/ trusty/main libdb-dev amd64 1:5.3.21~exp1ubuntu1 [2,282 B]

Get:16 http://us.archive.ubuntu.com/ubuntu/ trusty/main lynx-cur amd64 2.8.8pre4-1 [956 kB]

Get:17 http://us.archive.ubuntu.com/ubuntu/ trusty/main lynx all 2.8.8pre4-1 [4,184 B]

Fetched 40.9 MB in 49s (825 kB/s)

Preconfiguring packages ...

Selecting previously unselected package iptables-dev.

(Reading database ... 268401 files and directories currently installed.)

Preparing to unpack .../iptables-dev_1.4.21-1ubuntu1_amd64.deb ...

Unpacking iptables-dev (1.4.21-1ubuntu1) ...

Selecting previously unselected package libatm1-dev.

Preparing to unpack .../libatm1-dev_1%3a2.5.1-1.5_amd64.deb ...

Unpacking libatm1-dev (1:2.5.1-1.5) ...

Selecting previously unselected package libptexenc1.

Preparing to unpack .../libptexenc1_2013.20130729.30972-2build3_amd64.deb ...

Unpacking libptexenc1 (2013.20130729.30972-2build3) ...

Selecting previously unselected package libsp1c2.

Preparing to unpack .../libsp1c2_1.3.4-1.2.1-47.3ubuntu1_amd64.deb ...

Unpacking libsp1c2 (1.3.4-1.2.1-47.3ubuntu1) ...

Selecting previously unselected package sp.

Preparing to unpack .../sp_1.3.4-1.2.1-47.3ubuntu1_amd64.deb ...

Unpacking sp (1.3.4-1.2.1-47.3ubuntu1) ...

Selecting previously unselected package linuxdoc-tools.

Preparing to unpack .../linuxdoc-tools_0.9.69-2_amd64.deb ...

Unpacking linuxdoc-tools (0.9.69-2) ...

Selecting previously unselected package tex-common.

Preparing to unpack .../tex-common_4.04_all.deb ...

Unpacking tex-common (4.04) ...

Selecting previously unselected package luatex.

Preparing to unpack .../luatex_0.76.0-3ubuntu1_amd64.deb ...

Unpacking luatex (0.76.0-3ubuntu1) ...

Selecting previously unselected package texlive-binaries.

Preparing to unpack .../texlive-binaries_2013.20130729.30972-2build3_amd64.deb ...

Unpacking texlive-binaries (2013.20130729.30972-2build3) ...

Selecting previously unselected package texlive-base.

Preparing to unpack .../texlive-base_2013.20140215-1_all.deb ...

Unpacking texlive-base (2013.20140215-1) ...

Selecting previously unselected package texlive-fonts-recommended.

Preparing to unpack .../texlive-fonts-recommended_2013.20140215-1_all.deb ...

Unpacking texlive-fonts-recommended (2013.20140215-1) ...

Selecting previously unselected package texlive-latex-base.

Preparing to unpack .../texlive-latex-base_2013.20140215-1_all.deb ...

Unpacking texlive-latex-base (2013.20140215-1) ...

Selecting previously unselected package texlive-latex-recommended.

Preparing to unpack .../texlive-latex-recommended_2013.20140215-1_all.deb ...

Unpacking texlive-latex-recommended (2013.20140215-1) ...

Selecting previously unselected package libdb5.3-dev.

Preparing to unpack .../libdb5.3-dev_5.3.28-3ubuntu3_amd64.deb ...

Unpacking libdb5.3-dev (5.3.28-3ubuntu3) ...

Selecting previously unselected package libdb-dev:amd64.

Preparing to unpack .../libdb-dev_1%3a5.3.21~exp1ubuntu1_amd64.deb ...

Unpacking libdb-dev:amd64 (1:5.3.21~exp1ubuntu1) ...

Selecting previously unselected package lynx-cur.

Preparing to unpack .../lynx-cur_2.8.8pre4-1_amd64.deb ...

Unpacking lynx-cur (2.8.8pre4-1) ...

Selecting previously unselected package lynx.

Preparing to unpack .../lynx_2.8.8pre4-1_all.deb ...

Unpacking lynx (2.8.8pre4-1) ...

Processing triggers for doc-base (0.10.5) ...

Processing 8 added doc-base files...

Registering documents with scrollkeeper...

Processing triggers for man-db (2.6.7.1-1) ...

Processing triggers for sgml-base (1.26+nmu4ubuntu1) ...

Processing triggers for install-info (5.2.0.dfsg.1-2) ...

Processing triggers for mime-support (3.54ubuntu1) ...

Processing triggers for fontconfig (2.11.0-0ubuntu4.1) ...

Setting up iptables-dev (1.4.21-1ubuntu1) ...

Setting up libatm1-dev (1:2.5.1-1.5) ...

Setting up libptexenc1 (2013.20130729.30972-2build3) ...

Setting up libsp1c2 (1.3.4-1.2.1-47.3ubuntu1) ...

Setting up sp (1.3.4-1.2.1-47.3ubuntu1) ...

Setting up linuxdoc-tools (0.9.69-2) ...

Setting up tex-common (4.04) ...

Running mktexlsr. This may take some time... done.

texlive-base is not ready, delaying updmap-sys call

texlive-base is not ready, skipping fmtutil-sys --all call

Setting up luatex (0.76.0-3ubuntu1) ...

texlive-base is not ready, cannot create formats

Setting up texlive-binaries (2013.20130729.30972-2build3) ...

update-alternatives: using /usr/bin/xdvi-xaw to provide /usr/bin/xdvi.bin (xdvi.bin) in auto mode

update-alternatives: using /usr/bin/bibtex.original to provide /usr/bin/bibtex (bibtex) in auto mode

mktexlsr: Updating /var/lib/texmf/ls-R-TEXLIVEDIST...

mktexlsr: Updating /var/lib/texmf/ls-R-TEXMFMAIN...

mktexlsr: Updating /var/lib/texmf/ls-R...

mktexlsr: Done.

Building format(s) --refresh.

This may take some time... done.

Setting up texlive-base (2013.20140215-1) ...

mktexlsr: Updating /var/lib/texmf/ls-R-TEXLIVEDIST...

mktexlsr: Updating /var/lib/texmf/ls-R-TEXMFMAIN...

mktexlsr: Updating /var/lib/texmf/ls-R...

mktexlsr: Done.

/usr/bin/tl-paper: setting paper size for dvips to a4.

/usr/bin/tl-paper: setting paper size for dvipdfmx to a4.

/usr/bin/tl-paper: setting paper size for xdvi to a4.

/usr/bin/tl-paper: setting paper size for pdftex to a4.

/usr/bin/tl-paper: setting paper size for dvipdfmx to letter.

/usr/bin/tl-paper: setting paper size for dvips to letter.

/usr/bin/tl-paper: setting paper size for pdftex to letter.

/usr/bin/tl-paper: setting paper size for xdvi to letter.

Running mktexlsr. This may take some time... done.

Building format(s) --refresh.

This may take some time... done.

Running mktexlsr. This may take some time... done.

Building format(s) --all.

This may take some time... done.

Setting up libdb5.3-dev (5.3.28-3ubuntu3) ...

Setting up libdb-dev:amd64 (1:5.3.21~exp1ubuntu1) ...

Setting up lynx-cur (2.8.8pre4-1) ...

update-alternatives: using /usr/bin/lynx to provide /usr/bin/www-browser (www-browser) in auto mode

Setting up lynx (2.8.8pre4-1) ...

Processing triggers for tex-common (4.04) ...

Running updmap-sys. This may take some time... done.

Running mktexlsr /var/lib/texmf ... done.

Setting up texlive-fonts-recommended (2013.20140215-1) ...

Setting up texlive-latex-base (2013.20140215-1) ...

Running mktexlsr. This may take some time... done.

Building format(s) --all --cnffile /etc/texmf/fmt.d/10texlive-latex-base.cnf.

This may take some time... done.

Processing triggers for tex-common (4.04) ...

Running mktexlsr. This may take some time... done.

Running updmap-sys. This may take some time... done.

Running mktexlsr /var/lib/texmf ... done.

Setting up texlive-latex-recommended (2013.20140215-1) ...

Processing triggers for libc-bin (2.19-0ubuntu6.3) ...

Processing triggers for sgml-base (1.26+nmu4ubuntu1) ...

Processing triggers for tex-common (4.04) ...

Running mktexlsr. This may take some time... done.

gstanden@vmem1:~/Downloads/ubuntu-iproute2$

Now get the source code for iproute2 as shown below.

gstanden@vmem1:~/Downloads/ubuntu-iproute2$ apt-get source iproute2

Reading package lists... Done

Building dependency tree

Reading state information... Done

NOTICE: 'iproute2' packaging is maintained in the 'Git' version control system at:

git://git.debian.org/git/collab-maint/pkg-iproute.git

Need to get 453 kB of source archives.

Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/main iproute2 3.12.0-2 (dsc) [1,626 B]

Get:2 http://us.archive.ubuntu.com/ubuntu/ trusty/main iproute2 3.12.0-2 (tar) [425 kB]

Get:3 http://us.archive.ubuntu.com/ubuntu/ trusty/main iproute2 3.12.0-2 (diff) [26.4 kB]

Fetched 453 kB in 1s (389 kB/s)

gpgv: Signature made Wed 12 Feb 2014 03:29:56 PM CST using DSA key ID BDE5F1EE

gpgv: Can't check signature: public key not found

dpkg-source: warning: failed to verify signature on ./iproute2_3.12.0-2.dsc

dpkg-source: info: extracting iproute2 in iproute2-3.12.0

dpkg-source: info: unpacking iproute2_3.12.0.orig.tar.xz

dpkg-source: info: unpacking iproute2_3.12.0-2.debian.tar.xz

dpkg-source: info: applying 0001-Add-moo-feature.patch

dpkg-source: info: applying 0002-txtdocs.patch

gstanden@vmem1:~/Downloads/ubuntu-iproute2$

Need to create the patch for Ubuntu because the source isn't matching exactly what was found here. Create the patch which hopefully will work as shown below.

gstanden@vmem1:~/Downloads/ubuntu-iproute2/iproute2-3.12.0/ip$ ls -l iplink.c*

-rw-rw-r-- 1 gstanden gstanden 25993 Nov 22 2013 iplink.c

-rw-rw-r-- 1 gstanden gstanden 25915 Sep 6 15:32 iplink.c.mods

-rw-rw-r-- 1 gstanden gstanden 25993 Nov 22 2013 iplink.c.orig

-rw-rw-r-- 1 gstanden gstanden 369 Sep 6 15:38 iplink.c.patch

gstanden@vmem1:~/Downloads/ubuntu-iproute2/iproute2-3.12.0/ip$ diff -u iplink.c iplink.c.mods > iplink.c.patch

gstanden@vmem1:~/Downloads/ubuntu-iproute2/iproute2-3.12.0/ip$ more iplink.c.patch

--- iplink.c 2013-11-22 19:10:33.000000000 -0600

+++ iplink.c.mods 2014-09-06 15:32:48.887778605 -0500

@@ -579,8 +579,6 @@

if (name) {

len = strlen(name) + 1;

- if (len == 1)

- invarg("\"\" is not a valid device identifier\n", "name");

if (len > IFNAMSIZ)

invarg("\"name\" too long\n", name);

addattr_l(&req.n, sizeof(req), IFLA_IFNAME, name, len);

gstanden@vmem1:~/Downloads/ubuntu-iproute2/iproute2-3.12.0/ip$ patch < iplink.c.patch

patching file iplink.c

gstanden@vmem1:~/Downloads/ubuntu-iproute2/iproute2-3.12.0/ip$ diff iplink.c iplink.c.orig

581a582,583

> if (len == 1)

> invarg("\"\" is not a valid device identifier\n", "name");

gstanden@vmem1:~/Downloads/ubuntu-iproute2/iproute2-3.12.0/ip$

Now compile a new iproute2 and hope that this edit was the correct translation of the issue from the post here. The entire output of the make is not shown, but the command and the last few lines of output from a successful make are shown below. Note you must be in the root directory of the source code as shown below before running this command.

gstanden@vmem1:~/Downloads/ubuntu-iproute2/iproute2-3.12.0$ pwd

/home/gstanden/Downloads/ubuntu-iproute2/iproute2-3.12.0

gstanden@vmem1:~/Downloads/ubuntu-iproute2/iproute2-3.12.0$ ls

bridge configure debian etc genl ip Makefile misc README README.devel README.iproute2+tc tc

Config COPYING doc examples include lib man netem README.decnet README.distribution README.lnstat testsuite

gstanden@vmem1:~/Downloads/ubuntu-iproute2/iproute2-3.12.0$

gstanden@vmem1:~/Downloads/ubuntu-iproute2/iproute2-3.12.0$ dpkg-buildpackage -rfakeroot -uc -b

(some output omitted for brevity)

.

.

.

dpkg-genchanges: binary-only upload - not including any source code

dpkg-source --after-build iproute2-3.12.0

dpkg-buildpackage: binary only upload (no source included)

gstanden@vmem1:~/Downloads/ubuntu-iproute2/iproute2-3.12.0$

Better Procedure for Updating iproute2

The procedure described here turned out to be the way to go when working with Ubuntu source code. Incidentally there was a good, concise, yet comprehensive guide on using "patch" and "diff -u" for patching iproute2 "c" files here.

Additional useful references below.

Example of Unified Patch Format