mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-23 18:10:39 +00:00
Fixes #3187 Requires seastar "inet_address: Add constructor and conversion function from/to IPv4" Implements support IPv6 for CQL inet data. The actual data stored will now vary between 4 and 16 bytes. gms::inet_address has been augumented to interop with seastar::inet_address, though of course actually trying to use an Ipv6 address there or in any of its tables with throw badly. Tests assuming ipv4 changed. Storing a ipv4_address should be transparent, as it now "widens". However, since all ipv4 is inet_address, but not vice versa, there is no implicit overloading on the read paths. I.e. tests and system_keyspace (where we read ip addresses from tables explicitly) are modified to use the proper type. Message-Id: <20180424161817.26316-1-calle@scylladb.com>
55 lines
2.0 KiB
C++
55 lines
2.0 KiB
C++
/*
|
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
* or more contributor license agreements. See the NOTICE file
|
|
* distributed with this work for additional information
|
|
* regarding copyright ownership. The ASF licenses this file
|
|
* to you under the Apache License, Version 2.0 (the
|
|
* "License"); you may not use this file except in compliance
|
|
* with the License. You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*
|
|
* Modified by ScyllaDB
|
|
* Copyright (C) 2016 ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* This file is part of Scylla.
|
|
*
|
|
* Scylla is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* Scylla is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with Scylla. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include <seastar/net/inet_address.hh>
|
|
#include <seastar/core/print.hh>
|
|
#include <seastar/core/future.hh>
|
|
#include "inet_address.hh"
|
|
|
|
using namespace seastar;
|
|
|
|
gms::inet_address::inet_address(const net::inet_address& in)
|
|
: inet_address(in.as_ipv4_address())
|
|
{}
|
|
|
|
future<gms::inet_address> gms::inet_address::lookup(sstring name) {
|
|
return seastar::net::inet_address::find(name, seastar::net::inet_address::family::INET).then([](seastar::net::inet_address&& a) {
|
|
return make_ready_future<gms::inet_address>(a);
|
|
});
|
|
}
|