]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msgr: make bind port range configurable
authorSage Weil <sage@inktank.com>
Wed, 31 Oct 2012 16:29:54 +0000 (09:29 -0700)
committerSage Weil <sage@inktank.com>
Sun, 4 Nov 2012 13:04:42 +0000 (05:04 -0800)
Signed-off-by: Sage Weil <sage@inktank.com>
src/common/config_opts.h
src/include/msgr.h
src/msg/Accepter.cc

index 06b3031d18032fe71836bbd6a371a10bce803289..0e6f8bbd26b70c69cdc5b28d7c588c4e339f3f8e 100644 (file)
@@ -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)
index 93f9e07b944a34daf3b835398bfad9fc354e3166..585468270ddcc90099255a35585ba2b3f237b8ad 100644 (file)
@@ -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
index f67dbd47a961c747fdab2e62f51a510b5d868701..e29588846af5b138721f4e7641f41086a7e22c14 100644 (file)
@@ -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;
     }