@@ -158,7 +158,7 @@ String *Item_func_inet6_aton::val_str(String *buffer)
158
158
return buffer;
159
159
}
160
160
161
- Inet6_null ipv6 (*tmp.string ());
161
+ Inet6Bundle::Fbt_null ipv6 (*tmp.string ());
162
162
if (!ipv6.is_null ())
163
163
{
164
164
ipv6.to_binary (buffer);
@@ -197,7 +197,7 @@ String *Item_func_inet6_ntoa::val_str_ascii(String *buffer)
197
197
return buffer;
198
198
}
199
199
200
- Inet6_null ipv6 (static_cast <const Binary_string&>(*tmp.string ()));
200
+ Inet6Bundle::Fbt_null ipv6 (static_cast <const Binary_string&>(*tmp.string ()));
201
201
if (!ipv6.is_null ())
202
202
{
203
203
ipv6.to_string (buffer);
@@ -221,6 +221,22 @@ longlong Item_func_is_ipv4::val_int()
221
221
return !tmp.is_null () && !Inet4_null (*tmp.string ()).is_null ();
222
222
}
223
223
224
+ class IP6 : public Inet6Bundle ::Fbt_null
225
+ {
226
+ public:
227
+ IP6 (Item* arg) : Inet6Bundle::Fbt_null(arg) {}
228
+ bool is_v4compat () const
229
+ {
230
+ static_assert (sizeof (in6_addr) == IN6_ADDR_SIZE, " unexpected in6_addr size" );
231
+ return IN6_IS_ADDR_V4COMPAT ((struct in6_addr *) m_buffer);
232
+ }
233
+ bool is_v4mapped () const
234
+ {
235
+ static_assert (sizeof (in6_addr) == IN6_ADDR_SIZE, " unexpected in6_addr size" );
236
+ return IN6_IS_ADDR_V4MAPPED ((struct in6_addr *) m_buffer);
237
+ }
238
+ };
239
+
224
240
225
241
/* *
226
242
Checks if the passed string represents an IPv6-address.
@@ -230,17 +246,16 @@ longlong Item_func_is_ipv6::val_int()
230
246
{
231
247
DBUG_ASSERT (fixed ());
232
248
String_ptr_and_buffer<STRING_BUFFER_USUAL_SIZE> tmp (args[0 ]);
233
- return !tmp.is_null () && !Inet6_null (*tmp.string ()).is_null ();
249
+ return !tmp.is_null () && !Inet6Bundle::Fbt_null (*tmp.string ()).is_null ();
234
250
}
235
251
236
-
237
252
/* *
238
253
Checks if the passed IPv6-address is an IPv4-compat IPv6-address.
239
254
*/
240
255
241
256
longlong Item_func_is_ipv4_compat::val_int ()
242
257
{
243
- Inet6_null ip6 (args[0 ]);
258
+ IP6 ip6 (args[0 ]);
244
259
return !ip6.is_null () && ip6.is_v4compat ();
245
260
}
246
261
@@ -251,6 +266,6 @@ longlong Item_func_is_ipv4_compat::val_int()
251
266
252
267
longlong Item_func_is_ipv4_mapped::val_int ()
253
268
{
254
- Inet6_null ip6 (args[0 ]);
269
+ IP6 ip6 (args[0 ]);
255
270
return !ip6.is_null () && ip6.is_v4mapped ();
256
271
}
0 commit comments