mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-26 14:17:26 -04:00
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> Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au> Signed-off-by: David S. Miller <davem@davemloft.net>
50 lines
962 B
C
50 lines
962 B
C
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
|
/*
|
|
* Management Component Transport Protocol (MCTP)
|
|
*
|
|
* Copyright (c) 2021 Code Construct
|
|
* Copyright (c) 2021 Google
|
|
*/
|
|
|
|
#ifndef __UAPI_MCTP_H
|
|
#define __UAPI_MCTP_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/socket.h>
|
|
#include <linux/netdevice.h>
|
|
|
|
typedef __u8 mctp_eid_t;
|
|
|
|
struct mctp_addr {
|
|
mctp_eid_t s_addr;
|
|
};
|
|
|
|
struct sockaddr_mctp {
|
|
__kernel_sa_family_t smctp_family;
|
|
__u16 __smctp_pad0;
|
|
unsigned int smctp_network;
|
|
struct mctp_addr smctp_addr;
|
|
__u8 smctp_type;
|
|
__u8 smctp_tag;
|
|
__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
|
|
#define MCTP_ADDR_ANY 0xff
|
|
|
|
#define MCTP_TAG_MASK 0x07
|
|
#define MCTP_TAG_OWNER 0x08
|
|
|
|
#define MCTP_OPT_ADDR_EXT 1
|
|
|
|
#endif /* __UAPI_MCTP_H */
|