summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorMasatake YAMATO2017-11-24 11:31:03 +0100
committerKarel Zak2017-11-27 15:54:49 +0100
commit4195756e032eb9c9be5ed8ab961ef4d72da7294c (patch)
treed4315d108ee9594858ef74c60c64a63d78a097c0 /configure.ac
parentrtcwake: fix sys vs. rtc time delta usage (diff)
downloadkernel-qcow2-util-linux-4195756e032eb9c9be5ed8ab961ef4d72da7294c.tar.gz
kernel-qcow2-util-linux-4195756e032eb9c9be5ed8ab961ef4d72da7294c.tar.xz
kernel-qcow2-util-linux-4195756e032eb9c9be5ed8ab961ef4d72da7294c.zip
lsns: add netnsid column
Linux network subsystem assigns an unique integer to a network namespace. term0# ip netns add UTIL-LINUX-LSNS-TEST-NS term0# ip netns list UTIL-LINUX-LSNS-TEST-NS term0# ip link add name lsns-vetha type veth peer name lsns-vethb term0 # ip link set lsns-vethb netns UTIL-LINUX-LSNS-TEST-NS term0# ip netns list UTIL-LINUX-LSNS-TEST-NS (id: 0) term0# ip link show dev lsns-vetha 230: lsns-vetha@if229: <BROADCAST,MULTICAST> mtu 1500 qdisc noop ... link/ether 3e:27:68:ba:b3:95 brd ff:ff:ff:ff:ff:ff link-netnsid 0 In this example 0 is assigned to UTIL-LINUX-LSNS-TEST-NS net namespace. The name, UTIL-LINUX-LSNS-TEST-NS, and it semantics is given and defined by iproute2 in userland; and nothing to do with util-linux. However, the id, 0, is managed in linux kernel. If lsns can show the ids, it helps users understand the state of network namespaces. This commit adds NETNSID column to the output. Here is an example of session: term0# ip netns exec UTIL-LINUX-LSNS-TEST-NS cat (Open another terminal) term1# ./lsns --type net NS TYPE NPROCS PID USER NETNSID COMMAND 4026531993 net 383 1 root unassigned /usr/lib/systemd/... 4026532433 net 1 1219 rtkit unassigned /usr/libexec/rtkit-daemon 4026532562 net 1 18201 root 0 cat 0 is shown as NETNSID for the cat process. For the initial name space, "unassigned" is printed. For the namespaces other type than net, "n/a" is printed. If an error occurred during getting the id, "n/a" is printed. Changes in V2: * Remove wrongly used & operators. * Make netnsid field empty if value for the column is not available. Suggested by Karel Zak. * Remove redundant condtion for checking the avaiablebility of netlink socket. Suggested by Karel Zak. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac1
1 files changed, 1 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 28fd7760c..79a1fd3b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -234,6 +234,7 @@ AC_CHECK_HEADERS([ \
linux/tiocl.h \
linux/version.h \
linux/securebits.h \
+ linux/net_namespace.h \
locale.h \
mntent.h \
net/if.h \