These shouldn't(tm) happen with new code, but with old code they do. And
if we get them, elector can try to monmap->get_inst() on them and crash.
Throw them out here; they're nonsense from our perspective anyway if the
peer isn't part of our monmap.
Signed-off-by: Sage Weil <sage@inktank.com>
dout(0) << "MMonElection received from entity without enough caps!"
<< s->caps << dendl;
}
- if (!is_probing() && !is_slurping())
- elector.dispatch(m);
- else
+ if (!is_probing() && !is_slurping()) {
+ if (monmap->contains(m->get_source_addr())) {
+ elector.dispatch(m);
+ } else {
+ dout(1) << "discarding election message: " << m->get_source_addr() << " not in my monmap "
+ << *monmap << dendl;
+ m->put();
+ }
+ } else {
m->put();
+ }
break;
case MSG_FORWARD: