summaryrefslogtreecommitdiff
path: root/include/uapi
diff options
context:
space:
mode:
authorJeremy Kerr <jk@codeconstruct.com.au>2021-10-26 04:57:28 +0300
committerJoel Stanley <joel@jms.id.au>2022-03-18 03:37:16 +0300
commitf00785cbf91a3ef807270f2297d6c691a2201a6c (patch)
treeae965101ea2388dad20b1a6e13feb85ebb82bef3 /include/uapi
parentb11452c34c3487e456cff70c051787a7d70dcf12 (diff)
downloadlinux-f00785cbf91a3ef807270f2297d6c691a2201a6c.tar.xz
mctp: Implement extended addressing
This change allows an extended address struct - struct sockaddr_mctp_ext - to be passed to sendmsg/recvmsg. This allows userspace to specify output ifindex and physical address information (for sendmsg) or receive the input ifindex/physaddr for incoming messages (for recvmsg). This is typically used by userspace for MCTP address discovery and assignment operations. The extended addressing facility is conditional on a new sockopt: MCTP_OPT_ADDR_EXT; userspace must explicitly enable addressing before the kernel will consume/populate the extended address data. Includes a fix for an uninitialised var: Reported-by: kernel test robot <lkp@intel.com> Backport: exclude SOL_MPTCP OpenBMC-Staging-Count: 1 Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au> Signed-off-by: David S. Miller <davem@davemloft.net> (cherry picked from commit 99ce45d5e7dbde399997a630f45ac9f654fa4bcc) Signed-off-by: Joel Stanley <joel@jms.id.au>
Diffstat (limited to 'include/uapi')
-rw-r--r--include/uapi/linux/mctp.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/uapi/linux/mctp.h b/include/uapi/linux/mctp.h
index 6acd4ccafbf7..07b0318716fc 100644
--- a/include/uapi/linux/mctp.h
+++ b/include/uapi/linux/mctp.h
@@ -11,6 +11,7 @@
#include <linux/types.h>
#include <linux/socket.h>
+#include <linux/netdevice.h>
typedef __u8 mctp_eid_t;
@@ -28,6 +29,14 @@ struct sockaddr_mctp {
__u8 __smctp_pad1;
};
+struct sockaddr_mctp_ext {
+ struct sockaddr_mctp smctp_base;
+ int smctp_ifindex;
+ __u8 smctp_halen;
+ __u8 __smctp_pad0[3];
+ __u8 smctp_haddr[MAX_ADDR_LEN];
+};
+
#define MCTP_NET_ANY 0x0
#define MCTP_ADDR_NULL 0x00
@@ -36,4 +45,6 @@ struct sockaddr_mctp {
#define MCTP_TAG_MASK 0x07
#define MCTP_TAG_OWNER 0x08
+#define MCTP_OPT_ADDR_EXT 1
+
#endif /* __UAPI_MCTP_H */