summaryrefslogtreecommitdiff
path: root/net-p2p/monero/files/monero-9999-net-bring-consistency-between-IPv4-port-and-IPv6-por.patch
blob: 79d21307bcc05b2aaa8852332564f92d2c962b65 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
From 95a435a9c9d5d0ebec91e7bec5d7d2762ae124ae Mon Sep 17 00:00:00 2001
From: Bertrand Jacquin <bertrand@jacquin.bzh>
Date: Thu, 4 Apr 2024 22:33:16 +0100
Subject: [PATCH] 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
---
 Dockerfile                                     | 2 +-
 src/p2p/net_node.cpp                           | 8 ++++----
 src/p2p/net_node.h                             | 4 ++--
 src/p2p/net_node.inl                           | 8 ++++----
 tests/functional_tests/functional_tests_rpc.py | 2 +-
 tests/trezor/daemon.cpp                        | 6 +++---
 tests/unit_tests/node_server.cpp               | 4 ++--
 utils/fish/monerod.fish                        | 4 ++--
 8 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 6058eabadc46..106d07a2bf4b 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 635ab41ea6b7..bb7965817dee 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 1b51c61fffc2..a373c80a3575 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 c8dc80cfe7f5..f50ac8ea22d5 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 8c8a8cfd0110..287c1009a618 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 308fa6fc0876..f35dc3d8e003 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 584ca3d63884..c06a4e67219d 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 e1b3551eec9b..9080d47b3636 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"