From: Jon Maloy <jma...@redhat.com>

TIPC 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/linux/socket.h     |  5 ++-
 include/uapi/linux/tipc3.h | 79 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 82 insertions(+), 2 deletions(-)
 create mode 100644 include/uapi/linux/tipc3.h

diff --git a/include/linux/socket.h b/include/linux/socket.h
index 54338fac45cb..ff2268ceedaf 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -209,8 +209,8 @@ struct ucred {
                                 * reuses AF_INET address family
                                 */
 #define AF_XDP         44      /* XDP sockets                  */
-
-#define AF_MAX         45      /* For now.. */
+#define AF_TIPC3       45      /* TIPC version 3 sockets       */
+#define AF_MAX         46      /* For now.. */
 
 /* Protocol families, same as address families. */
 #define PF_UNSPEC      AF_UNSPEC
@@ -260,6 +260,7 @@ struct ucred {
 #define PF_QIPCRTR     AF_QIPCRTR
 #define PF_SMC         AF_SMC
 #define PF_XDP         AF_XDP
+#define PF_TIPC3       AF_TIPC3
 #define PF_MAX         AF_MAX
 
 /* Maximum queue length specifiable by listen.  */
diff --git a/include/uapi/linux/tipc3.h b/include/uapi/linux/tipc3.h
new file mode 100644
index 000000000000..0d385bc41b66
--- /dev/null
+++ b/include/uapi/linux/tipc3.h
@@ -0,0 +1,79 @@
+/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR 
BSD-3-Clause) */
+/*
+ * include/uapi/linux/tipc3.h: Header for TIPC v3 socket interface
+ *
+ * Copyright (c) 2020 Red Hat Inc
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _LINUX_TIPC3_H_
+#define _LINUX_TIPC3_H_
+
+#include <linux/types.h>
+#include <linux/sockios.h>
+#include <linux/tipc.h>
+
+struct tipc3_addr {
+       __u8[16] type;      /* zero if socket address */
+       __u8[16] instance;  /* port if socket address */
+       __u8[16] node;      /* zero if whole cluster */
+};
+
+struct tipc3_subscr {
+       __u8[16] type;
+       __u8[16] lower;
+       __u8[16] upper;
+       __u8[16] node;
+       __u32 timeout;                  /* subscription duration (in ms) */
+       __u32 filter;                   /* bitmask of filter options */
+       __u8 usr_handle[16];            /* available for subscriber use */
+};
+
+struct tipc3_event {
+       __u8[16] lower;                 /* matching range */
+       __u8[16] upper;                 /*    "      "    */
+       struct tipc3_addr socket;       /* associated socket */
+       struct tipc2_subscr sub;        /* associated subscription */
+       __u32 event;                    /* event type */
+};
+
+struct sockaddr_tipc3 {
+       unsigned short family;
+       bool mcast;
+       struct tipc3_addr addr;
+};
+
+struct tipc3_group_req {
+       struct tipc3_addr addr;
+       __u32 flags;
+};
+
+#endif
-- 
2.25.1



_______________________________________________
tipc-discussion mailing list
tipc-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tipc-discussion

Reply via email to