MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
socket_ipv6.inc
1 #==============================================================================
2 # Set IP address defaults with respect to IPV6 support
3 #
4 # This file determines the level of support for IPV4, IPV4 mapped or IPV6, then
5 # sets the appropriate localhost IP format to use for 'connect()' commands.
6 #
7 # Input: $my_socket_debug - Print results of IP version check (optional)
8 # Output: $my_localhost - Default localhost IP
9 #==============================================================================
10 
11 let $check_ipv6_just_check= 1;
12 #--source include/check_ipv6.inc
13 
14 #==============================================================================
15 # Determine if IPV6 supported
16 #
17 # Parameters:
18 # $check_ipv6_just_check - Don't skip the test if IPv6 is unsupported,
19 # just set the variable $check_ipv6_supported
20 #==============================================================================
21 --disable_query_log
22 --disable_result_log
23 --disable_abort_on_error
24 
25 let $check_ipv6_supported= 1;
26 
27 connect (checkcon123456789,::1,root,,test);
28 
29 if($mysql_errno)
30 {
31  let $check_ipv6_supported=0;
32  if(!$check_ipv6_just_check)
33  {
34  skip No IPv6 support;
35  }
36 }
37 
38 if(!$mysql_errno)
39 {
40  disconnect checkcon123456789;
41  --source include/wait_until_disconnected.inc
42 }
43 
44 connection default;
45 
46 --enable_abort_on_error
47 --enable_result_log
48 --enable_query_log
49 
50 #==============================================================================
51 #
52 # Determine if IPV4 mapped to IPV6 supported
53 #
54 let $check_ipv4_mapped_just_check= 1;
55 #--source include/check_ipv4_mapped.inc
56 #==============================================================================
57 # Check if ipv4 mapped to ipv6 is available.
58 #
59 # Parameters:
60 # $check_ipv4_mapped_just_check - Don't skip the test if IPv4 mapped is unsupported,
61 # just set the variable $check_ipv4_mapped_supported
62 #==============================================================================
63 --disable_query_log
64 --disable_result_log
65 --disable_abort_on_error
66 
67 let $check_ipv4_mapped_supported= 1;
68 
69 connect (checkcon123456789a,::FFFF:127.0.0.1,root,,test);
70 
71 if($mysql_errno)
72 {
73  let $check_ipv4_mapped_supported=0;
74  if(!$check_ipv4_mapped_just_check)
75  {
76  skip No mapped IPv4 support;
77  }
78 }
79 
80 if(!$mysql_errno)
81 {
82  disconnect checkcon123456789a;
83  --source include/wait_until_disconnected.inc
84 }
85 
86 connection default;
87 
88 --enable_abort_on_error
89 --enable_result_log
90 --enable_query_log
91 
92 #==============================================================================
93 # Set the localhost IP default to use when establishing connections
94 #
95 #==============================================================================
96 let $my_localhost=127.0.0.1;
97 
98 if($check_ipv6_supported)
99 {
100  let $my_localhost=::1;
101 }
102 
103 if($check_ipv4_mapped_supported)
104 {
105  let $my_localhost=::ffff:127.0.0.1;
106 }
107 
108 if($my_socket_debug)
109 {
110  --echo IPV6=$check_ipv6_supported, IPV4_MAPPED=$check_ipv4_mapped_supported, LOCALHOST=$my_localhost
111 }
112 #==============================================================================
113