]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/msg/msg_types.h
import ceph quincy 17.2.1
[ceph.git] / ceph / src / msg / msg_types.h
index 0d931a7afc11d0a4d040880dc05630f6a6a182fe..6e0ee1261de4d8917a04b3b76121d22b2787bbc0 100644 (file)
@@ -197,7 +197,9 @@ static inline void decode(sockaddr_storage& a,
  * 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 {
@@ -205,6 +207,7 @@ struct entity_addr_t {
     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) {
@@ -213,6 +216,7 @@ struct entity_addr_t {
     case TYPE_LEGACY: return "v1";
     case TYPE_MSGR2: return "v2";
     case TYPE_ANY: return "any";
+    case TYPE_CIDR: return "cidr";
     default: return "???";
     }
   };
@@ -245,6 +249,8 @@ struct entity_addr_t {
   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; }
@@ -400,6 +406,7 @@ struct entity_addr_t {
   }
 
   std::string ip_only_to_str() const;
+  std::string ip_n_port_to_str() const;
 
   std::string get_legacy_str() const {
     std::ostringstream ss;