aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrand Jacquin <bertrand@jacquin.bzh>2024-04-04 22:33:16 +0100
committerBertrand Jacquin <bertrand@jacquin.bzh>2024-04-06 14:50:40 +0100
commit95a435a9c9d5d0ebec91e7bec5d7d2762ae124ae (patch)
tree268dc536d48c901f159d19449e33acaea81ce60f
parentnet: define IPv4 object explicitly (diff)
downloadmonero-95a435a9c9d5d0ebec91e7bec5d7d2762ae124ae.tar.xz
net: bring consistency between IPv4 port and IPv6 port
* --p2p-bind-port-ipv4 is replaced with --p2p-bind-ipv4-port * --p2p-bind-port-ipv6 is replaced with --p2p-bind-ipv6-port
-rw-r--r--Dockerfile2
-rw-r--r--src/p2p/net_node.cpp8
-rw-r--r--src/p2p/net_node.h4
-rw-r--r--src/p2p/net_node.inl8
-rwxr-xr-xtests/functional_tests/functional_tests_rpc.py2
-rw-r--r--tests/trezor/daemon.cpp6
-rw-r--r--tests/unit_tests/node_server.cpp4
-rw-r--r--utils/fish/monerod.fish4
8 files changed, 19 insertions, 19 deletions
diff --git a/Dockerfile b/Dockerfile
index 6058eabad..106d07a2b 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -62,5 +62,5 @@ EXPOSE 18081
USER monero
ENTRYPOINT ["monerod"]
-CMD ["--p2p-bind-ipv4-address=0.0.0.0", "--p2p-bind-port-ipv4=18080", "--rpc-bind-ipv4-address=0.0.0.0", "--rpc-bind-port=18081", "--non-interactive", "--confirm-external-bind"]
+CMD ["--p2p-bind-ipv4-address=0.0.0.0", "--p2p-bind-ipv4-port=18080", "--rpc-bind-ipv4-address=0.0.0.0", "--rpc-bind-port=18081", "--non-interactive", "--confirm-external-bind"]
diff --git a/src/p2p/net_node.cpp b/src/p2p/net_node.cpp
index 635ab41ea..bb7965817 100644
--- a/src/p2p/net_node.cpp
+++ b/src/p2p/net_node.cpp
@@ -113,8 +113,8 @@ namespace nodetool
{
const command_line::arg_descriptor<std::string> arg_p2p_bind_ipv4_address = {"p2p-bind-ipv4-address", "Interface for p2p network protocol (IPv4)", "0.0.0.0"};
const command_line::arg_descriptor<std::string> arg_p2p_bind_ipv6_address = {"p2p-bind-ipv6-address", "Interface for p2p network protocol (IPv6)", "::"};
- const command_line::arg_descriptor<std::string, false, true, 2> arg_p2p_bind_port_ipv4 = {
- "p2p-bind-port-ipv4"
+ const command_line::arg_descriptor<std::string, false, true, 2> arg_p2p_bind_ipv4_port = {
+ "p2p-bind-ipv4-port"
, "Port for p2p network protocol (IPv4)"
, std::to_string(config::P2P_DEFAULT_PORT)
, {{ &cryptonote::arg_testnet_on, &cryptonote::arg_stagenet_on }}
@@ -126,8 +126,8 @@ namespace nodetool
return val;
}
};
- const command_line::arg_descriptor<std::string, false, true, 2> arg_p2p_bind_port_ipv6 = {
- "p2p-bind-port-ipv6"
+ const command_line::arg_descriptor<std::string, false, true, 2> arg_p2p_bind_ipv6_port = {
+ "p2p-bind-ipv6-port"
, "Port for p2p network protocol (IPv6)"
, std::to_string(config::P2P_DEFAULT_PORT)
, {{ &cryptonote::arg_testnet_on, &cryptonote::arg_stagenet_on }}
diff --git a/src/p2p/net_node.h b/src/p2p/net_node.h
index 1b51c61ff..a373c80a3 100644
--- a/src/p2p/net_node.h
+++ b/src/p2p/net_node.h
@@ -522,8 +522,8 @@ namespace nodetool
const int64_t default_limit_down = P2P_DEFAULT_LIMIT_RATE_DOWN; // kB/s
extern const command_line::arg_descriptor<std::string> arg_p2p_bind_ipv4_address;
extern const command_line::arg_descriptor<std::string> arg_p2p_bind_ipv6_address;
- extern const command_line::arg_descriptor<std::string, false, true, 2> arg_p2p_bind_port_ipv4;
- extern const command_line::arg_descriptor<std::string, false, true, 2> arg_p2p_bind_port_ipv6;
+ extern const command_line::arg_descriptor<std::string, false, true, 2> arg_p2p_bind_ipv4_port;
+ extern const command_line::arg_descriptor<std::string, false, true, 2> arg_p2p_bind_ipv6_port;
extern const command_line::arg_descriptor<bool> arg_p2p_use_ipv6;
extern const command_line::arg_descriptor<bool> arg_p2p_ignore_ipv4;
extern const command_line::arg_descriptor<uint32_t> arg_p2p_external_port;
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index c8dc80cfe..f50ac8ea2 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -101,8 +101,8 @@ namespace nodetool
{
command_line::add_arg(desc, arg_p2p_bind_ipv4_address);
command_line::add_arg(desc, arg_p2p_bind_ipv6_address);
- command_line::add_arg(desc, arg_p2p_bind_port_ipv4, false);
- command_line::add_arg(desc, arg_p2p_bind_port_ipv6, false);
+ command_line::add_arg(desc, arg_p2p_bind_ipv4_port, false);
+ command_line::add_arg(desc, arg_p2p_bind_ipv6_port, false);
command_line::add_arg(desc, arg_p2p_use_ipv6);
command_line::add_arg(desc, arg_p2p_ignore_ipv4);
command_line::add_arg(desc, arg_p2p_external_port);
@@ -414,8 +414,8 @@ namespace nodetool
public_zone.m_connect = &public_connect;
public_zone.m_bind_ipv4_address = command_line::get_arg(vm, arg_p2p_bind_ipv4_address);
public_zone.m_bind_ipv6_address = command_line::get_arg(vm, arg_p2p_bind_ipv6_address);
- public_zone.m_port_ipv4 = command_line::get_arg(vm, arg_p2p_bind_port_ipv4);
- public_zone.m_port_ipv6 = command_line::get_arg(vm, arg_p2p_bind_port_ipv6);
+ public_zone.m_port_ipv4 = command_line::get_arg(vm, arg_p2p_bind_ipv4_port);
+ public_zone.m_port_ipv6 = command_line::get_arg(vm, arg_p2p_bind_ipv6_port);
public_zone.m_can_pingback = true;
m_external_port = command_line::get_arg(vm, arg_p2p_external_port);
m_allow_local_ip = command_line::get_arg(vm, arg_p2p_allow_local_ip);
diff --git a/tests/functional_tests/functional_tests_rpc.py b/tests/functional_tests/functional_tests_rpc.py
index 8c8a8cfd0..287c1009a 100755
--- a/tests/functional_tests/functional_tests_rpc.py
+++ b/tests/functional_tests/functional_tests_rpc.py
@@ -52,7 +52,7 @@ WALLET_DIRECTORY = builddir + "/functional-tests-directory"
FUNCTIONAL_TESTS_DIRECTORY = builddir + "/tests/functional_tests"
DIFFICULTY = 10
-monerod_base = [builddir + "/bin/monerod", "--regtest", "--fixed-difficulty", str(DIFFICULTY), "--no-igd", "--p2p-bind-port-ipv4", "monerod_p2p_port", "--rpc-bind-port", "monerod_rpc_port", "--zmq-rpc-bind-port", "monerod_zmq_port", "--zmq-pub", "monerod_zmq_pub", "--non-interactive", "--disable-dns-checkpoints", "--check-updates", "disabled", "--rpc-ssl", "disabled", "--data-dir", "monerod_data_dir", "--log-level", "1"]
+monerod_base = [builddir + "/bin/monerod", "--regtest", "--fixed-difficulty", str(DIFFICULTY), "--no-igd", "--p2p-bind-ipv4-port", "monerod_p2p_port", "--rpc-bind-port", "monerod_rpc_port", "--zmq-rpc-bind-port", "monerod_zmq_port", "--zmq-pub", "monerod_zmq_pub", "--non-interactive", "--disable-dns-checkpoints", "--check-updates", "disabled", "--rpc-ssl", "disabled", "--data-dir", "monerod_data_dir", "--log-level", "1"]
monerod_extra = [
["--offline"],
["--rpc-payment-address", "44SKxxLQw929wRF6BA9paQ1EWFshNnKhXM3qz6Mo3JGDE2YG3xyzVutMStEicxbQGRfrYvAAYxH6Fe8rnD56EaNwUiqhcwR", "--rpc-payment-difficulty", str(DIFFICULTY), "--rpc-payment-credits", "5000", "--offline"],
diff --git a/tests/trezor/daemon.cpp b/tests/trezor/daemon.cpp
index 308fa6fc0..f35dc3d8e 100644
--- a/tests/trezor/daemon.cpp
+++ b/tests/trezor/daemon.cpp
@@ -69,7 +69,7 @@ void mock_daemon::default_options(boost::program_options::variables_map & vm)
// By default pick non-standard ports to avoid confusion with possibly locally running daemons (mainnet/testnet)
const char *test_p2p_port = getenv("TEST_P2P_PORT");
auto p2p_port = std::string(test_p2p_port && strlen(test_p2p_port) > 0 ? test_p2p_port : "61340");
- tools::options::set_option(vm, nodetool::arg_p2p_bind_port_ipv4, po::variable_value(p2p_port, false));
+ tools::options::set_option(vm, nodetool::arg_p2p_bind_ipv4_port, po::variable_value(p2p_port, false));
const char *test_rpc_port = getenv("TEST_RPC_PORT");
auto rpc_port = std::string(test_rpc_port && strlen(test_rpc_port) > 0 ? test_rpc_port : "61341");
@@ -85,7 +85,7 @@ void mock_daemon::default_options(boost::program_options::variables_map & vm)
void mock_daemon::set_ports(boost::program_options::variables_map & vm, unsigned initial_port)
{
CHECK_AND_ASSERT_THROW_MES(initial_port < 65535-2, "Invalid port number");
- tools::options::set_option(vm, nodetool::arg_p2p_bind_port_ipv4, po::variable_value(std::to_string(initial_port), false));
+ tools::options::set_option(vm, nodetool::arg_p2p_bind_ipv4_port, po::variable_value(std::to_string(initial_port), false));
tools::options::set_option(vm, cryptonote::core_rpc_server::arg_rpc_bind_port, po::variable_value(std::to_string(initial_port + 1), false));
tools::options::set_option(vm, daemon_args::arg_zmq_rpc_bind_port, po::variable_value(std::to_string(initial_port + 2), false));
po::notify(vm);
@@ -93,7 +93,7 @@ void mock_daemon::set_ports(boost::program_options::variables_map & vm, unsigned
void mock_daemon::load_params(boost::program_options::variables_map const & vm)
{
- m_p2p_bind_port = command_line::get_arg(vm, nodetool::arg_p2p_bind_port_ipv4);
+ m_p2p_bind_port = command_line::get_arg(vm, nodetool::arg_p2p_bind_ipv4_port);
m_rpc_bind_port = command_line::get_arg(vm, cryptonote::core_rpc_server::arg_rpc_bind_port);
m_zmq_bind_port = command_line::get_arg(vm, daemon_args::arg_zmq_rpc_bind_port);
m_network_type = command_line::get_arg(vm, cryptonote::arg_testnet_on) ? cryptonote::TESTNET : cryptonote::MAINNET;
diff --git a/tests/unit_tests/node_server.cpp b/tests/unit_tests/node_server.cpp
index 584ca3d63..c06a4e672 100644
--- a/tests/unit_tests/node_server.cpp
+++ b/tests/unit_tests/node_server.cpp
@@ -310,7 +310,7 @@ TEST(node_server, bind_same_p2p_port)
ifconfig lo0 alias 127.0.0.2
*/
vm.find(nodetool::arg_p2p_bind_ipv4_address.name)->second = boost::program_options::variable_value(std::string("127.0.0.2"), false);
- vm.find(nodetool::arg_p2p_bind_port_ipv4.name)->second = boost::program_options::variable_value(std::string(port), false);
+ vm.find(nodetool::arg_p2p_bind_ipv4_port.name)->second = boost::program_options::variable_value(std::string(port), false);
boost::program_options::notify(vm);
@@ -1141,7 +1141,7 @@ TEST(node_server, race_condition)
boost::program_options::store(
boost::program_options::command_line_parser({
"--p2p-bind-ipv4-address=127.0.0.1",
- "--p2p-bind-port-ipv4=48080",
+ "--p2p-bind-ipv4-port=48080",
"--out-peers=0",
"--data-dir",
dir.string(),
diff --git a/utils/fish/monerod.fish b/utils/fish/monerod.fish
index e1b3551ee..9080d47b3 100644
--- a/utils/fish/monerod.fish
+++ b/utils/fish/monerod.fish
@@ -56,8 +56,8 @@ complete -c monerod -l db-sync-mode -r -d "Specify sync option, using format [sa
complete -c monerod -l db-salvage -d "Try to salvage a blockchain database if it seems corrupted"
complete -c monerod -l p2p-bind-ipv4-address -r -d "Interface for p2p network protocol (IPv4). Default: 0.0.0.0"
complete -c monerod -l p2p-bind-ipv6-address -r -d "Interface for p2p network protocol (IPv6). Default: ::"
-complete -c monerod -l p2p-bind-port-ipv4 -r -d "Port for p2p network protocol (IPv4). Default: 18080, 28080 if 'testnet', 38080 if 'stagenet'"
-complete -c monerod -l p2p-bind-port-ipv6 -d "Port for p2p network protocol (IPv6). Default: 18080, 28080 if 'testnet', 38080 if 'stagenet'"
+complete -c monerod -l p2p-bind-ipv4-port -r -d "Port for p2p network protocol (IPv4). Default: 18080, 28080 if 'testnet', 38080 if 'stagenet'"
+complete -c monerod -l p2p-bind-ipv6-port -d "Port for p2p network protocol (IPv6). Default: 18080, 28080 if 'testnet', 38080 if 'stagenet'"
complete -c monerod -l p2p-use-ipv6 -d "Enable IPv6 for p2p"
complete -c monerod -l p2p-ignore-ipv4 -d "Ignore unsuccessful IPv4 bind for p2p"
complete -c monerod -l p2p-external-port -r -d "External port for p2p network protocol (if port forwarding used with NAT). Default: 0"