Content-based routing (CBR) provides a powerful and flexible foundation for distributed applications. Its communication model, based on implicit addressing, fosters decoupling among the communicating components, therefore meeting the needs of many dynamic scenarios, including mobile ad hoc networks (MANETs). Unfortunately, the characteristics of the CBR model are only rarely met by available systems, which typically assume that application-level routers are organized in a tree-shaped network with a fixed topology. In this paper we present COMAN, a protocol to organize the nodes of a MANET in a tree-shaped network able to i) selfrepair to tolerate the frequent topological reconfigurations typical of MANETs; ii) achieve this goal through repair strategies that minimize the changes that may impact the CBR layer exploiting the tree. COMAN is implemented and publicly available. Here we report about its performance in simulated scenarios as well as in real-world experiments. The results conf...