mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-08-13 18:44:04 +00:00
ip netns: Fix rtnl error while print netns list
Observed on the Linux 3.18:
# ip netns
RTNETLINK answers: Operation not supported
net0
CC: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Fixes: d182ee1307
("ipnetns: allow to get and set netns ids")
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
This commit is contained in:
parent
f3a2ddc124
commit
d116ff3414
19
configure
vendored
19
configure
vendored
@ -218,6 +218,23 @@ EOF
|
|||||||
rm -f $TMPDIR/setnstest.c $TMPDIR/setnstest
|
rm -f $TMPDIR/setnstest.c $TMPDIR/setnstest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_netnsid()
|
||||||
|
{
|
||||||
|
cat >$TMPDIR/netnsid.c <<EOF
|
||||||
|
#include <linux/rtnetlink.h>
|
||||||
|
int test_def = RTM_GETNSID;
|
||||||
|
EOF
|
||||||
|
$CC -c $TMPDIR/netnsid.c >/dev/null 2>&1
|
||||||
|
if [ $? -eq 0 ]
|
||||||
|
then
|
||||||
|
echo "IP_CONFIG_NETNSID:=y" >> Config
|
||||||
|
echo "yes"
|
||||||
|
else
|
||||||
|
echo "no"
|
||||||
|
fi
|
||||||
|
rm -f $TMPDIR/netnsid.c $TMPDIR/netnsid.o
|
||||||
|
}
|
||||||
|
|
||||||
check_ipset()
|
check_ipset()
|
||||||
{
|
{
|
||||||
cat >$TMPDIR/ipsettest.c <<EOF
|
cat >$TMPDIR/ipsettest.c <<EOF
|
||||||
@ -283,6 +300,8 @@ check_ipt_lib_dir
|
|||||||
|
|
||||||
echo -n "libc has setns: "
|
echo -n "libc has setns: "
|
||||||
check_setns
|
check_setns
|
||||||
|
echo -n "netns has peer id suport: "
|
||||||
|
check_netnsid
|
||||||
|
|
||||||
echo -n "SELinux support: "
|
echo -n "SELinux support: "
|
||||||
check_selinux
|
check_selinux
|
||||||
|
@ -16,6 +16,10 @@ ifeq ($(IP_CONFIG_SETNS),y)
|
|||||||
CFLAGS += -DHAVE_SETNS
|
CFLAGS += -DHAVE_SETNS
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(IP_CONFIG_NETNSID),y)
|
||||||
|
CFLAGS += -DHAVE_NETNSID
|
||||||
|
endif
|
||||||
|
|
||||||
ALLOBJ=$(IPOBJ) $(RTMONOBJ)
|
ALLOBJ=$(IPOBJ) $(RTMONOBJ)
|
||||||
SCRIPTS=ifcfg rtpr routel routef
|
SCRIPTS=ifcfg rtpr routel routef
|
||||||
TARGETS=ip rtmon
|
TARGETS=ip rtmon
|
||||||
|
@ -34,6 +34,7 @@ static int usage(void)
|
|||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_NETNSID
|
||||||
static int get_netnsid_from_name(const char *name)
|
static int get_netnsid_from_name(const char *name)
|
||||||
{
|
{
|
||||||
struct {
|
struct {
|
||||||
@ -78,6 +79,12 @@ static int get_netnsid_from_name(const char *name)
|
|||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
static int get_netnsid_from_name(const char *name)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif /* HAVE_NETNSID */
|
||||||
|
|
||||||
static int netns_list(int argc, char **argv)
|
static int netns_list(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user