| 4680 | } |
| 4681 | |
| 4682 | void Monitor::dispatch_op(MonOpRequestRef op) |
| 4683 | { |
| 4684 | op->mark_event("mon:dispatch_op"); |
| 4685 | |
| 4686 | MonSession *s = op->get_session(); |
| 4687 | ceph_assert(s); |
| 4688 | if (s->closed) { |
| 4689 | dout(10) << " session closed, dropping " << op->get_req() << dendl; |
| 4690 | return; |
| 4691 | } |
| 4692 | |
| 4693 | /* we will consider the default type as being 'monitor' until proven wrong */ |
| 4694 | op->set_type_monitor(); |
| 4695 | /* deal with all messages that do not necessarily need caps */ |
| 4696 | switch (op->get_req()->get_type()) { |
| 4697 | // auth |
| 4698 | case MSG_MON_GLOBAL_ID: |
| 4699 | case MSG_MON_USED_PENDING_KEYS: |
| 4700 | case CEPH_MSG_AUTH: |
| 4701 | op->set_type_service(); |
| 4702 | /* no need to check caps here */ |
| 4703 | paxos_service[PAXOS_AUTH]->dispatch(op); |
| 4704 | return; |
| 4705 | |
| 4706 | case CEPH_MSG_PING: |
| 4707 | handle_ping(op); |
| 4708 | return; |
| 4709 | case MSG_COMMAND: |
| 4710 | op->set_type_command(); |
| 4711 | handle_tell_command(op); |
| 4712 | return; |
| 4713 | } |
| 4714 | |
| 4715 | if (!op->get_session()->authenticated) { |
| 4716 | dout(5) << __func__ << " " << op->get_req()->get_source_inst() |
| 4717 | << " is not authenticated, dropping " << *(op->get_req()) |
| 4718 | << dendl; |
| 4719 | return; |
| 4720 | } |
| 4721 | |
| 4722 | // global_id_status == NONE: all sessions for auth_none and krb, |
| 4723 | // mon <-> mon sessions (including proxied sessions) for cephx |
| 4724 | ceph_assert(s->global_id_status == global_id_status_t::NONE || |
| 4725 | s->global_id_status == global_id_status_t::NEW_OK || |
| 4726 | s->global_id_status == global_id_status_t::NEW_NOT_EXPOSED || |
| 4727 | s->global_id_status == global_id_status_t::RECLAIM_OK || |
| 4728 | s->global_id_status == global_id_status_t::RECLAIM_INSECURE); |
| 4729 | |
| 4730 | // let mon_getmap through for "ping" (which doesn't reconnect) |
| 4731 | // and "tell" (which reconnects but doesn't attempt to preserve |
| 4732 | // its global_id and stays in NEW_NOT_EXPOSED, retrying until |
| 4733 | // ->send_attempts reaches 0) |
| 4734 | if (cct->_conf->auth_expose_insecure_global_id_reclaim && |
| 4735 | s->global_id_status == global_id_status_t::NEW_NOT_EXPOSED && |
| 4736 | op->get_req()->get_type() != CEPH_MSG_MON_GET_MAP) { |
| 4737 | dout(5) << __func__ << " " << op->get_req()->get_source_inst() |
| 4738 | << " may omit old_ticket on reconnects, discarding " |
| 4739 | << *op->get_req() << " and forcing reconnect" << dendl; |
no test coverage detected