From: Sage Weil Date: Thu, 17 May 2012 21:46:46 +0000 (-0700) Subject: mon: ignore election messages from outside monmap X-Git-Tag: v0.48argonaut~137^2~13^2~34 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cba3ca7b8d10892b970e185211ae127ff0b7c0d9;p=ceph.git mon: ignore election messages from outside monmap 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 --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index ca7facf11994..d8134d07eb0d 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -1667,10 +1667,17 @@ bool Monitor::_ms_dispatch(Message *m) 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: