* an entity's network address.
* includes a random value that prevents it from being reused.
* thus identifies a particular process instance.
- * ipv4 for now.
+ *
+ * This also happens to work to support cidr ranges, in which
+ * case the nonce contains the netmask. It's great!
*/
struct entity_addr_t {
typedef enum {
TYPE_LEGACY = 1, ///< legacy msgr1 protocol (ceph jewel and older)
TYPE_MSGR2 = 2, ///< msgr2 protocol (new in ceph kraken)
TYPE_ANY = 3, ///< ambiguous
+ TYPE_CIDR = 4,
} type_t;
static const type_t TYPE_DEFAULT = TYPE_MSGR2;
static std::string_view get_type_name(int t) {
case TYPE_LEGACY: return "v1";
case TYPE_MSGR2: return "v2";
case TYPE_ANY: return "any";
+ case TYPE_CIDR: return "cidr";
default: return "???";
}
};
bool is_legacy() const { return type == TYPE_LEGACY; }
bool is_msgr2() const { return type == TYPE_MSGR2; }
bool is_any() const { return type == TYPE_ANY; }
+ // this isn't a guarantee; some client addrs will match it
+ bool maybe_cidr() const { return get_port() == 0 && nonce != 0; }
__u32 get_nonce() const { return nonce; }
void set_nonce(__u32 n) { nonce = n; }
}
std::string ip_only_to_str() const;
+ std::string ip_n_port_to_str() const;
std::string get_legacy_str() const {
std::ostringstream ss;