History

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>

Jeremy Kerr committed 5 years ago

Commit 99ce45d1 parent 971f5c45 files · +170 −39Browse files

Showing the changes to include/uapi (1 of 5 files). Show all

Unified · Split

include/uapi/linux/mctp.h+11−0
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111
1212 #include <linux/types.h>
1313 #include <linux/socket.h>
14+#include <linux/netdevice.h>
1415
1516 typedef __u8 mctp_eid_t;
1617
@@ -28,6 +29,14 @@ struct sockaddr_mctp { · 11 unmodified lines
2829 __u8 __smctp_pad1;
2930 };
3031
32+struct sockaddr_mctp_ext {
33+ struct sockaddr_mctp smctp_base;
34+ int smctp_ifindex;
35+ __u8 smctp_halen;
36+ __u8 __smctp_pad0[3];
37+ __u8 smctp_haddr[MAX_ADDR_LEN];
38+};
39+
3140 #define MCTP_NET_ANY 0x0
3241
3342 #define MCTP_ADDR_NULL 0x00
@@ -36,4 +45,6 @@ struct sockaddr_mctp { · 2 unmodified lines
3645 #define MCTP_TAG_MASK 0x07
3746 #define MCTP_TAG_OWNER 0x08
3847
48+#define MCTP_OPT_ADDR_EXT 1
49+
3950 #endif /* __UAPI_MCTP_H */