xref: /aosp_15_r20/external/ltp/testcases/kernel/containers/netns/netns_breakns.sh (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0-or-later
3# Copyright (c) 2022 Petr Vorel <[email protected]>
4# Copyright (c) Köry Maincent <[email protected]> 2020
5# Copyright (c) 2015 Red Hat, Inc.
6#
7# Tests communication with ip (uses netlink) and ifconfig (uses ioctl)
8# over a device which is not visible from the current network namespace.
9#
10# There are two test cases which are trying to set an ip address on the veth1
11# device which is not inside the network namespace referred to by NS_HANDLE0:
12# 1. using netlink (ip command).
13# 2. using ioctl (ifconfig command).
14
15TST_TESTFUNC="do_test"
16
17do_test()
18{
19	EXPECT_FAIL $NS_EXEC $NS_HANDLE0 $NS_TYPE ip address add $IP1/$NETMASK dev veth1
20
21	tst_require_cmds ifconfig
22	EXPECT_FAIL $NS_EXEC $NS_HANDLE0 $NS_TYPE ifconfig veth1 $IFCONF_IN6_ARG $IP1/$NETMASK
23}
24
25. netns_lib.sh
26tst_run
27