| 1 |
##################################################################### |
| 2 |
# # |
| 3 |
# The aim of this test is verify that network namespaces work with # |
| 4 |
# IPv6 addresses as well as IPv4 mapped IPv6 addresses. # |
| 5 |
# # |
| 6 |
# The test requires following conditions to be met in order for # |
| 7 |
# it to run :- # |
| 8 |
# 1. mysqld has been granted the capability to switch network # |
| 9 |
# namespaces. # |
| 10 |
# 2. A network namespace named 'red' having localhost interface # |
| 11 |
# with IPv6 i.e., '::1' # |
| 12 |
# 3. Another network namespace named 'blue' with a network # |
| 13 |
# interface having an IPv4 address '10.0.1.1'. # |
| 14 |
# # |
| 15 |
# Creation Date: 2019-02-20 # |
| 16 |
# Author: Srikanth B R # |
| 17 |
# # |
| 18 |
##################################################################### |
| 19 |
|
| 20 |
# Network namespaces is a feature of Linux. |
| 21 |
# So, ignore this test on any platform except Linux. |
| 22 |
--source include/linux.inc |
| 23 |
--source include/have_ipv6.inc |
| 24 |
--source include/have_ipv4_mapped.inc |
| 25 |
|
| 26 |
--source ../include/have_network_namespaces.inc |
| 27 |
|
| 28 |
--let $restart_parameters = restart: --skip-name-resolve --bind-address=::1/red,::ffff:10.0.1.1/blue |
| 29 |
--source include/restart_mysqld.inc |
| 30 |
|
| 31 |
CREATE USER root@'::1'; |
| 32 |
CREATE USER root@'10.0.1.1'; |
| 33 |
|
| 34 |
--let $MYSQL_PORT= `SELECT @@port` |
| 35 |
|
| 36 |
--echo # Check that client can establish connection to the address ::1 from the network namespace 'red' |
| 37 |
--exec $EXE_MYSQL --no-defaults -u root --port $MYSQL_PORT --host ::1 --network-namespace=red -e "SELECT USER()" |
| 38 |
|
| 39 |
--echo # Check that client can establish connection to the address ::ffff:10.0.1.1 from the network namespace 'blue' |
| 40 |
--exec $EXE_MYSQL --no-defaults -u root --port $MYSQL_PORT --host ::ffff:10.0.1.1 --network-namespace=blue -e "SELECT USER()" |
| 41 |
|
| 42 |
--echo # Use network namespaces with an IPv6 admin address and admin port |
| 43 |
|
| 44 |
--disable_query_log |
| 45 |
CALL mtr.add_suppression("Failed to initialize TLS for channel: mysql_admin"); |
| 46 |
CALL mtr.add_suppression("Failed to set up SSL because of the following SSL library error"); |
| 47 |
--enable_query_log |
| 48 |
|
| 49 |
# Restart with an IPv6 address from the 'red' namespace |
| 50 |
--let $restart_parameters=restart: --skip-name-resolve --admin-address=::1/red --admin-port=$MASTER_ADMINPORT |
| 51 |
--replace_result $MASTER_ADMINPORT ADMIN_PORT |
| 52 |
--source include/restart_mysqld.inc |
| 53 |
|
| 54 |
GRANT SERVICE_CONNECTION_ADMIN ON *.* TO root@'::1'; |
| 55 |
GRANT SERVICE_CONNECTION_ADMIN ON *.* TO root@'10.0.1.1'; |
| 56 |
|
| 57 |
--exec $EXE_MYSQL --no-defaults -u root --host ::1 --port $MASTER_ADMINPORT --network-namespace=red -e "SELECT USER()" |
| 58 |
|
| 59 |
# Restart with an IPv4 mapped IPv6 address |
| 60 |
--let $restart_parameters=restart: --skip-name-resolve --admin-address=::ffff:10.0.1.1/blue --admin-port=$MASTER_ADMINPORT --create-admin-listener-thread=true |
| 61 |
--replace_result $MASTER_ADMINPORT ADMIN_PORT |
| 62 |
--source include/restart_mysqld.inc |
| 63 |
|
| 64 |
--exec $EXE_MYSQL --no-defaults -u root --host ::ffff:10.0.1.1 --port $MASTER_ADMINPORT --network-namespace=blue -e "SELECT USER()" |
| 65 |
|
| 66 |
# Restart with an IPv6 admin address in the 'red' namespace with a dedicated listener thread for admin connections |
| 67 |
--let $restart_parameters=restart: --skip-name-resolve --admin-address=::1/red --admin-port=$MASTER_ADMINPORT --create-admin-listener-thread=true |
| 68 |
--replace_result $MASTER_ADMINPORT ADMIN_PORT |
| 69 |
--source include/restart_mysqld.inc |
| 70 |
|
| 71 |
--exec $EXE_MYSQL --no-defaults -u root --host ::1 --port $MASTER_ADMINPORT --network-namespace=red -e "SELECT USER()" |
| 72 |
|
| 73 |
REVOKE SERVICE_CONNECTION_ADMIN ON *.* FROM root@'::1'; |
| 74 |
REVOKE SERVICE_CONNECTION_ADMIN ON *.* FROM root@'10.0.1.1'; |
| 75 |
|
| 76 |
--let $restart_parameters=restart: |
| 77 |
--source include/restart_mysqld.inc |
| 78 |
|
| 79 |
--connection default |
| 80 |
DROP USER root@'::1'; |
| 81 |
DROP USER root@'10.0.1.1'; |