From: Sage Weil Date: Thu, 5 Jul 2018 17:59:13 +0000 (-0500) Subject: mon: adapt MonCap network checks to addrvecs X-Git-Tag: v14.0.1~601^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=759a902ace9769c4ece224d458576e50edd3fb30;p=ceph.git mon: adapt MonCap network checks to addrvecs Breaking this out in a separate commit to make the backport a bit easier. Signed-off-by: Sage Weil --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index a184381c459..bf93a756602 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -2864,7 +2864,7 @@ bool Monitor::_allowed_command(MonSession *s, const string &module, s->entity_name, module, prefix, param_str_map, cmd_r, cmd_w, cmd_x, - s->get_peer_addr()); + s->get_peer_socket_addr()); dout(10) << __func__ << " " << (capable ? "" : "not ") << "capable" << dendl; return capable; diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 6a7bf623499..812143cd35c 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -3344,7 +3344,7 @@ bool OSDMonitor::preprocess_remove_snaps(MonOpRequestRef op) CEPH_ENTITY_TYPE_MON, session->entity_name, "osd", "osd pool rmsnap", {}, true, true, false, - session->get_peer_addr())) { + session->get_peer_socket_addr())) { dout(0) << "got preprocess_remove_snaps from entity with insufficient caps " << session->caps << dendl; goto ignore; @@ -11897,7 +11897,7 @@ bool OSDMonitor::enforce_pool_op_caps(MonOpRequestRef op) if (!is_unmanaged_snap_op_permitted(cct, mon->key_server, session->entity_name, session->caps, - session->get_peer_addr(), + session->get_peer_socket_addr(), pool_name)) { dout(0) << "got unmanaged-snap pool op from entity with insufficient " << "privileges. message: " << *m << std::endl diff --git a/src/mon/Session.h b/src/mon/Session.h index 957dd5041de..ca7013ebf49 100644 --- a/src/mon/Session.h +++ b/src/mon/Session.h @@ -44,6 +44,7 @@ struct MonSession : public RefCountedObject { uint64_t con_features = 0; // zero if AnonConnection entity_name_t name; entity_addrvec_t addrs; + entity_addr_t socket_addr; utime_t session_timeout; bool closed = false; xlist::item item; @@ -73,6 +74,7 @@ struct MonSession : public RefCountedObject { con_type(c->get_peer_type()), name(n), addrs(av), + socket_addr(c->get_peer_socket_addr()), item(this) { if (c->get_messenger()) { // only fill in features if this is a non-anonymous connection @@ -95,11 +97,11 @@ struct MonSession : public RefCountedObject { entity_name, service, "", args, mask & MON_CAP_R, mask & MON_CAP_W, mask & MON_CAP_X, - get_peer_addr()); + get_peer_socket_addr()); } - const entity_addr_t& get_peer_addr() { - return inst.addr; + const entity_addr_t& get_peer_socket_addr() { + return socket_addr; } };