From b2b4b0e30799b564975e2dffb24b30bb530f33ce Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 23 May 2018 17:17:09 -0500 Subject: [PATCH] CEPH_MON_PORT -> CEPH_MON_PORT_LEGACY; define CEPH_MON_PORT_IANA Signed-off-by: Sage Weil --- src/ceph_mon.cc | 8 ++++---- src/include/msgr.h | 3 ++- src/mon/MonMap.cc | 6 +++--- src/mon/Monitor.cc | 4 ++-- src/mon/MonmapMonitor.cc | 4 ++-- src/tools/monmaptool.cc | 2 +- 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/ceph_mon.cc b/src/ceph_mon.cc index 025d0185824..bc3744c55b2 100644 --- a/src/ceph_mon.cc +++ b/src/ceph_mon.cc @@ -366,7 +366,7 @@ int main(int argc, const char **argv) } else if (!g_conf->public_addr.is_blank_ip()) { entity_addr_t a = g_conf->public_addr; if (a.get_port() == 0) - a.set_port(CEPH_MON_PORT); + a.set_port(CEPH_MON_PORT_LEGACY); if (monmap.contains(a)) { string name; monmap.get_addr_name(a, name); @@ -633,7 +633,7 @@ int main(int argc, const char **argv) mon_addr_str, true) == 0) { if (conf_addr.parse(mon_addr_str.c_str())) { if (conf_addr.get_port() == 0) - conf_addr.set_port(CEPH_MON_PORT); + conf_addr.set_port(CEPH_MON_PORT_LEGACY); if (ipaddr != conf_addr) { derr << "WARNING: 'mon addr' config option " << conf_addr << " does not match monmap file" << std::endl @@ -650,7 +650,7 @@ int main(int argc, const char **argv) if (!g_conf->public_addr.is_blank_ip()) { ipaddr = g_conf->public_addr; if (ipaddr.get_port() == 0) - ipaddr.set_port(CEPH_MON_PORT); + ipaddr.set_port(CEPH_MON_PORT_LEGACY); dout(0) << "using public_addr " << g_conf->public_addr << " -> " << ipaddr << dendl; } else { @@ -722,7 +722,7 @@ int main(int argc, const char **argv) // set the default port if not already set if (bind_addr.get_port() == 0) { - bind_addr.set_port(CEPH_MON_PORT); + bind_addr.set_port(CEPH_MON_PORT_LEGACY); } } diff --git a/src/include/msgr.h b/src/include/msgr.h index 1953eb28b40..2b8e6be46ff 100644 --- a/src/include/msgr.h +++ b/src/include/msgr.h @@ -11,7 +11,8 @@ * Data types for message passing layer used by Ceph. */ -#define CEPH_MON_PORT 6789 /* default monitor port */ +#define CEPH_MON_PORT_LEGACY 6789 /* legacy default monitor port */ +#define CEPH_MON_PORT_IANA 3300 /* IANA monitor port */ /* * client-side processes will try to bind to ports in this diff --git a/src/mon/MonMap.cc b/src/mon/MonMap.cc index 56d8926e28b..24b0db5cd03 100644 --- a/src/mon/MonMap.cc +++ b/src/mon/MonMap.cc @@ -329,7 +329,7 @@ int MonMap::build_from_host_list(std::string hostlist, const std::string &prefix n[0] = 'a' + i; n[1] = 0; if (addrs[i].get_port() == 0) - addrs[i].set_port(CEPH_MON_PORT); + addrs[i].set_port(CEPH_MON_PORT_LEGACY); string name = prefix; name += n; if (!contains(addrs[i])) @@ -355,7 +355,7 @@ int MonMap::build_from_host_list(std::string hostlist, const std::string &prefix n[0] = 'a' + i; n[1] = 0; if (addrs[i].get_port() == 0) - addrs[i].set_port(CEPH_MON_PORT); + addrs[i].set_port(CEPH_MON_PORT_LEGACY); string name = prefix; name += n; if (!contains(addrs[i]) && @@ -495,7 +495,7 @@ int MonMap::build_initial(CephContext *cct, ostream& errout) continue; } if (addr.get_port() == 0) - addr.set_port(CEPH_MON_PORT); + addr.set_port(CEPH_MON_PORT_LEGACY); uint16_t priority = 0; if (!conf->get_val_from_conf_file(sections, "mon priority", val, false)) { diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index a942b4cd597..45a8ea4a9a1 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -1090,7 +1090,7 @@ bool Monitor::_add_bootstrap_peer_hint(std::string_view cmd, } if (addr.get_port() == 0) - addr.set_port(CEPH_MON_PORT); + addr.set_port(CEPH_MON_PORT_LEGACY); extra_probe_peers.insert(addr); ss << "adding peer " << addr << " to list: " << extra_probe_peers; @@ -3344,7 +3344,7 @@ void Monitor::handle_command(MonOpRequestRef op) f->flush(rdata); ostringstream ss2; - ss2 << "report " << rdata.crc32c(CEPH_MON_PORT); + ss2 << "report " << rdata.crc32c(CEPH_MON_PORT_LEGACY); rs = ss2.str(); r = 0; } else if (prefix == "osd last-stat-seq") { diff --git a/src/mon/MonmapMonitor.cc b/src/mon/MonmapMonitor.cc index d9158485df9..aec6ec28de4 100644 --- a/src/mon/MonmapMonitor.cc +++ b/src/mon/MonmapMonitor.cc @@ -504,8 +504,8 @@ bool MonmapMonitor::prepare_command(MonOpRequestRef op) } if (addr.get_port() == 0) { - ss << "port defaulted to " << CEPH_MON_PORT; - addr.set_port(CEPH_MON_PORT); + ss << "port defaulted to " << CEPH_MON_PORT_LEGACY; + addr.set_port(CEPH_MON_PORT_LEGACY); } /** diff --git a/src/tools/monmaptool.cc b/src/tools/monmaptool.cc index 19030eba021..2a2163bc390 100644 --- a/src/tools/monmaptool.cc +++ b/src/tools/monmaptool.cc @@ -219,7 +219,7 @@ int main(int argc, const char **argv) return -1; } if (addr.get_port() == 0) - addr.set_port(CEPH_MON_PORT); + addr.set_port(CEPH_MON_PORT_LEGACY); add[name] = addr; modified = true; i = args.erase(i); -- 2.39.5