From: Sage Weil Date: Wed, 31 Oct 2012 16:29:54 +0000 (-0700) Subject: msgr: make bind port range configurable X-Git-Tag: v0.55~130^2~16^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=623553d2b8eab2104baaac3972dd8910c92edb7e;p=ceph.git msgr: make bind port range configurable Signed-off-by: Sage Weil --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 06b3031d180..0e6f8bbd26b 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -98,6 +98,8 @@ OPTION(ms_nocrc, OPT_BOOL, false) OPTION(ms_die_on_bad_msg, OPT_BOOL, false) OPTION(ms_dispatch_throttle_bytes, OPT_U64, 100 << 20) OPTION(ms_bind_ipv6, OPT_BOOL, false) +OPTION(ms_bind_port_min, OPT_INT, 6800) +OPTION(ms_bind_port_max, OPT_INT, 6900) OPTION(ms_rwthread_stack_bytes, OPT_U64, 1024 << 10) OPTION(ms_tcp_read_timeout, OPT_U64, 900) OPTION(ms_inject_socket_failures, OPT_U64, 0) diff --git a/src/include/msgr.h b/src/include/msgr.h index 93f9e07b944..585468270dd 100644 --- a/src/include/msgr.h +++ b/src/include/msgr.h @@ -17,8 +17,6 @@ * that would like to identify the protocol. */ #define CEPH_PORT_FIRST 6789 -#define CEPH_PORT_START 6800 /* non-monitors start here */ -#define CEPH_PORT_LAST 6900 /* * tcp connection banner. include a protocol version. and adjust diff --git a/src/msg/Accepter.cc b/src/msg/Accepter.cc index f67dbd47a96..e29588846af 100644 --- a/src/msg/Accepter.cc +++ b/src/msg/Accepter.cc @@ -95,7 +95,7 @@ int Accepter::bind(const entity_addr_t &bind_addr, int avoid_port1, int avoid_po } } else { // try a range of ports - for (int port = CEPH_PORT_START; port <= CEPH_PORT_LAST; port++) { + for (int port = cct->_conf->ms_bind_port_min; port <= cct->_conf->ms_bind_port_max; port++) { if (port == avoid_port1 || port == avoid_port2) continue; listen_addr.set_port(port); @@ -106,10 +106,10 @@ int Accepter::bind(const entity_addr_t &bind_addr, int avoid_port1, int avoid_po if (rc < 0) { char buf[80]; ldout(msgr->cct,0) << "accepter.bind unable to bind to " << listen_addr.ss_addr() - << " on any port in range " << CEPH_PORT_START << "-" << CEPH_PORT_LAST + << " on any port in range " << cct->_conf->ms_bind_port_min << "-" << cct->_conf->ms_bind_port_max << ": " << strerror_r(errno, buf, sizeof(buf)) << dendl; cerr << "accepter.bind unable to bind to " << listen_addr.ss_addr() - << " on any port in range " << CEPH_PORT_START << "-" << CEPH_PORT_LAST + << " on any port in range " << cct->_conf->ms_bind_port_min << "-" << cct->_conf->ms_bind_port_max << ": " << strerror_r(errno, buf, sizeof(buf)) << std::endl; return -errno; }