Skip to content

Commit

Permalink
ceph_mon: warn on invalid port configuration
Browse files Browse the repository at this point in the history
It checks the validty of monitor port configuration
in ceph.conf, and warns if necessary.

Signed-off-by: Li Wang <[email protected]>
  • Loading branch information
dragonylffly committed Oct 3, 2017
1 parent 3892d1b commit 6e66bcb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/ceph_mon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,9 @@ int main(int argc, const char **argv)
<< " does not match monmap file" << std::endl
<< " continuing with monmap configuration" << dendl;
}
}
} else
derr << "WARNING: invalid 'mon addr' config option" << std::endl
<< " continuing with monmap configuration" << dendl;
}
} else {
dout(0) << g_conf->name << " does not exist in monmap, will attempt to join an existing cluster" << dendl;
Expand Down
3 changes: 3 additions & 0 deletions src/msg/msg_types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ bool entity_addr_t::parse(const char *s, const char **end)
// parse a port, too!
p++;
int port = atoi(p);
if (port > MAX_PORT_NUMBER) {
return false;
}
set_port(port);
while (*p && *p >= '0' && *p <= '9')
p++;
Expand Down
2 changes: 2 additions & 0 deletions src/msg/msg_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "include/blobhash.h"
#include "include/encoding.h"

#define MAX_PORT_NUMBER 65535

namespace ceph {
class Formatter;
}
Expand Down

0 comments on commit 6e66bcb

Please sign in to comment.