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
11 11
12#include <linux/types.h>12#include <linux/types.h>
13#include <linux/socket.h>13#include <linux/socket.h>
14#include <linux/netdevice.h>
14 15
15typedef __u8 mctp_eid_t;16typedef __u8 mctp_eid_t;
16 17
@@ -28,6 +29,14 @@ struct sockaddr_mctp { · 11 unmodified lines
28 __u8 __smctp_pad1;29 __u8 __smctp_pad1;
29};30};
30 31
32struct 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
31#define MCTP_NET_ANY 0x040#define MCTP_NET_ANY 0x0
32 41
33#define MCTP_ADDR_NULL 0x0042#define MCTP_ADDR_NULL 0x00
@@ -36,4 +45,6 @@ struct sockaddr_mctp { · 2 unmodified lines
36#define MCTP_TAG_MASK 0x0745#define MCTP_TAG_MASK 0x07
37#define MCTP_TAG_OWNER 0x0846#define MCTP_TAG_OWNER 0x08
38 47
48#define MCTP_OPT_ADDR_EXT 1
49
39#endif /* __UAPI_MCTP_H */50#endif /* __UAPI_MCTP_H */