Hi all,
I couldn't quite let go of this old idea, but the "tipc v3" proposal
from my first
patch back in May was clearly too intrusive both to protocol and code.
This one looks more promising, although it would still have a significant
impact on the binding table and the topology server. It might actually
be best
to just implement another binding table and another topology server besides
the existing ones just to avoid risk of breaking anything.
Anyway, take a look at this new suggestion and give feedback whether you
think
it is good or bad.
Note that the new 'range' field will work like a inverted IP netmask, in
the sense
that it denotes how many bits of 'instance', counted from the end,
should be
regarded as not set.
Example 1:
---------------
I bind a socket to {my_service, my_multicast_instance, 8}
A call to {my_service, my_multicast_instan[0000,...ffff], 0} is
a unicast and will reach that socket.
Example 2:
---------------
I bind a socket to {my_service, my_multicast_instanAA, 0}
and another one to {my_service, my_multicast_instanBB, 0}
A call to {my_service, my_multicast_instan, 8} is a multicast and
will reach both sockets.
The reason for this, instead of using the {lower,upper} semantics
we have currently is that I want to avoid having to invent and implement
my own 128-bit arithmetic, which is guaranteed to be wrong on one
architecture or another. And, the 'instance' field are not meant
to be interpreted as number in the first place, and by using this
method we avoid that.
Give your thoughts about this.
///jon
On 9/4/20 2:32 PM, jma...@redhat.com wrote:
From: Jon Maloy <jma...@redhat.com>
The existing 32-bit based address types in TIPC have a value space
that is perceived as too limited in some environments. It would
be more attractive in a modern user environment such as Kubernetes
if it could provide a larger address range.
Advantages:
- Users could directly use UUIDs, strings or other values as service
instances types and instances.
- No more risk of collisions between randomly selected service types
The effect on the TIPC implementation and protocol would be significant,
but this is still worth considering.
---
include/uapi/linux/tipc.h | 56 ++++++++++++++++++++++++++++++++++-----
1 file changed, 50 insertions(+), 6 deletions(-)
diff --git a/include/uapi/linux/tipc.h b/include/uapi/linux/tipc.h
index add01db1daef..c0c46742ffbd 100644
--- a/include/uapi/linux/tipc.h
+++ b/include/uapi/linux/tipc.h
@@ -42,9 +42,22 @@
#include <linux/sockios.h>
/*
- * TIPC addressing primitives
+ * Unified address type
+ * node: destination node id or binding scope. Zero if whole cluster.
+ * type: service type. Must be unique for service.
+ * instance: service instance. Can be bound to by multiple sockets.
+ * range: binding, subscription or multicast range.
*/
+struct tipc_addr {
+ __u8 node[16]; /* zero if whole cluster */
+ __u8 type[16]; /* zero if socket address */
+ __u8 instance[16]; /* port number if socket address */
+ __u8 range; /* number of trailing bits in 'instance' */
+};
+/*
+ * Legacy address types
+ */
struct tipc_socket_addr {
__u32 ref;
__u32 node;
@@ -74,7 +87,7 @@ struct tipc_service_range {
* Publication scopes when binding service / service range
*/
enum tipc_scope {
- TIPC_CLUSTER_SCOPE = 2, /* 0 can also be used */
+ TIPC_GLOBAL_SCOPE = 0,
TIPC_NODE_SCOPE = 3
};
@@ -114,8 +127,18 @@ enum tipc_scope {
#define TIPC_WAIT_FOREVER (~0) /* timeout for permanent subscription */
+struct tipc_topsub {
+ struct tipc_addr service; /* subscribed service */
+ __u32 timeout; /* subscription duration [ms] */
+ __u32 filter; /* subscription option bits */
+ __u8 handle[16]; /* user handle */
+};
+
+/*
+ * Legacy subscription structure
+ */
struct tipc_subscr {
- struct tipc_service_range seq; /* range of interest */
+ struct tipc_service_range seq; /* range of interest */
__u32 timeout; /* subscription duration (in ms) */
__u32 filter; /* bitmask of filter options */
char usr_handle[8]; /* available for subscriber use */
@@ -125,6 +148,16 @@ struct tipc_subscr {
#define TIPC_WITHDRAWN 2 /* withdrawal event */
#define TIPC_SUBSCR_TIMEOUT 3 /* subscription timeout event */
+struct tipc_topevt {
+ struct tipc_topsub sub; /* original subscription */
+ struct tipc_addr socket; /* associated socket */
+ struct tipc_addr service; /* matching address */
+ __u32 event; /* publ/withdraw/timeout */
+};
+
+/*
+ * Legacy event structure
+ */
struct tipc_event {
__u32 event; /* event type */
__u32 found_lower; /* matching range */
@@ -153,18 +186,21 @@ struct tipc_event {
#define TIPC_SERVICE_RANGE 1
#define TIPC_SERVICE_ADDR 2
#define TIPC_SOCKET_ADDR 3
+#define TIPC_ADDR 4
struct sockaddr_tipc {
unsigned short family;
unsigned char addrtype;
signed char scope;
union {
+
struct tipc_socket_addr id;
struct tipc_service_range nameseq;
struct {
struct tipc_service_addr name;
__u32 domain;
} name;
+ struct tipc_addr a;
} addr;
};
@@ -188,17 +224,25 @@ struct sockaddr_tipc {
#define TIPC_SOCK_RECVQ_DEPTH 132 /* Default: none (read only) */
#define TIPC_MCAST_BROADCAST 133 /* Default: TIPC selects. No arg */
#define TIPC_MCAST_REPLICAST 134 /* Default: TIPC selects. No arg */
-#define TIPC_GROUP_JOIN 135 /* Takes struct tipc_group_req* */
+#define TIPC_GROUP_JOIN 135 /* Takes struct tipc_group_join */
#define TIPC_GROUP_LEAVE 136 /* No argument */
#define TIPC_SOCK_RECVQ_USED 137 /* Default: none (read only) */
#define TIPC_NODELAY 138 /* Default: false */
/*
- * Flag values
+ * Group join flag values
*/
#define TIPC_GROUP_LOOPBACK 0x1 /* Receive copy of sent msg when match */
#define TIPC_GROUP_MEMBER_EVTS 0x2 /* Receive membership events in socket */
+struct tipc_group_join {
+ struct tipc_addr addr;
+ __u32 flags;
+};
+
+/*
+ * Legacy structure
+ */
struct tipc_group_req {
__u32 type; /* group id */
__u32 instance; /* member id */
@@ -259,7 +303,7 @@ static inline int tipc_aead_key_size(struct tipc_aead_key
*key)
#define TIPC_CFG_SRV 0
#define TIPC_ZONE_SCOPE 1
-
+#define TIPC_CLUSTER_SCOPE 2
#define TIPC_ADDR_NAMESEQ 1
#define TIPC_ADDR_NAME 2
#define TIPC_ADDR_ID 3
_______________________________________________
tipc-discussion mailing list
tipc-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tipc-discussion