mirror of
https://github.com/ceph/ceph
synced 2025-03-31 16:25:56 +00:00
Merge branch 'wip-msgr-ports'
Reviewed-by: Greg Farnum <greg@inktank.com>
This commit is contained in:
commit
92604ce4af
@ -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, 7100)
|
||||
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)
|
||||
|
@ -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
|
||||
|
@ -59,10 +59,8 @@ int Accepter::bind(const entity_addr_t &bind_addr, int avoid_port1, int avoid_po
|
||||
listen_sd = ::socket(family, SOCK_STREAM, 0);
|
||||
if (listen_sd < 0) {
|
||||
char buf[80];
|
||||
ldout(msgr->cct,0) << "accepter.bind unable to create socket: "
|
||||
<< strerror_r(errno, buf, sizeof(buf)) << dendl;
|
||||
cerr << "accepter.bind unable to create socket: "
|
||||
<< strerror_r(errno, buf, sizeof(buf)) << std::endl;
|
||||
lderr(msgr->cct) << "accepter.bind unable to create socket: "
|
||||
<< strerror_r(errno, buf, sizeof(buf)) << dendl;
|
||||
return -errno;
|
||||
}
|
||||
|
||||
@ -87,15 +85,13 @@ int Accepter::bind(const entity_addr_t &bind_addr, int avoid_port1, int avoid_po
|
||||
rc = ::bind(listen_sd, (struct sockaddr *) &listen_addr.ss_addr(), listen_addr.addr_size());
|
||||
if (rc < 0) {
|
||||
char buf[80];
|
||||
ldout(msgr->cct,0) << "accepter.bind unable to bind to " << listen_addr.ss_addr()
|
||||
<< ": " << strerror_r(errno, buf, sizeof(buf)) << dendl;
|
||||
cerr << "accepter.bind unable to bind to " << listen_addr.ss_addr()
|
||||
<< ": " << strerror_r(errno, buf, sizeof(buf)) << std::endl;
|
||||
lderr(msgr->cct) << "accepter.bind unable to bind to " << listen_addr.ss_addr()
|
||||
<< ": " << strerror_r(errno, buf, sizeof(buf)) << dendl;
|
||||
return -errno;
|
||||
}
|
||||
} else {
|
||||
// try a range of ports
|
||||
for (int port = CEPH_PORT_START; port <= CEPH_PORT_LAST; port++) {
|
||||
for (int port = msgr->cct->_conf->ms_bind_port_min; port <= msgr->cct->_conf->ms_bind_port_max; port++) {
|
||||
if (port == avoid_port1 || port == avoid_port2)
|
||||
continue;
|
||||
listen_addr.set_port(port);
|
||||
@ -105,12 +101,11 @@ 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
|
||||
<< ": " << 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
|
||||
<< ": " << strerror_r(errno, buf, sizeof(buf)) << std::endl;
|
||||
lderr(msgr->cct) << "accepter.bind unable to bind to " << listen_addr.ss_addr()
|
||||
<< " on any port in range " << msgr->cct->_conf->ms_bind_port_min
|
||||
<< "-" << msgr->cct->_conf->ms_bind_port_max
|
||||
<< ": " << strerror_r(errno, buf, sizeof(buf))
|
||||
<< dendl;
|
||||
return -errno;
|
||||
}
|
||||
ldout(msgr->cct,10) << "accepter.bind bound on random port " << listen_addr << dendl;
|
||||
|
Loading…
Reference in New Issue
Block a user