diff options
author | sephe <sephe@FreeBSD.org> | 2016-10-17 08:10:24 +0000 |
---|---|---|
committer | sephe <sephe@FreeBSD.org> | 2016-10-17 08:10:24 +0000 |
commit | 5cf0f3e767aac9766c02d9c38b81639379363ab4 (patch) | |
tree | 5994d2db16471b05740db3cb285d5ca6e499fa98 /sys/net | |
parent | 6ad606978e241ac0094ef977e32ae5c68e915eb3 (diff) | |
download | FreeBSD-src-5cf0f3e767aac9766c02d9c38b81639379363ab4.zip FreeBSD-src-5cf0f3e767aac9766c02d9c38b81639379363ab4.tar.gz |
MFC 305405,305407,305408,305410,305411,305453
305405
hyperv/vmbus: Stringent header length and total length check.
While I'm here, minor style changes.
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7752
305407
hyperv/hn: Stringent NVS notification length check.
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7753
305408
hyperv/hn: Stringent NVS RNDIS packets length checks.
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7755
305410
net/rndis: Define RNDIS status message, which could be sent by device.
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7757
305411
hyperv/hn: Stringent RNDIS control message length check.
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7758
305453
hyperv/hn: Stringent RNDIS packet message length/offset check.
While I'm here, use definition in net/rndis.h
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7782
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/rndis.h | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/sys/net/rndis.h b/sys/net/rndis.h index 0477a65..2cd1a0d 100644 --- a/sys/net/rndis.h +++ b/sys/net/rndis.h @@ -127,6 +127,14 @@ struct rndis_packet_msg { (sizeof(struct rndis_packet_msg) - \ __offsetof(struct rndis_packet_msg, rm_dataoffset)) +/* Offset from the beginning of rndis_packet_msg. */ +#define RNDIS_PACKET_MSG_OFFSET_ABS(ofs) \ + ((ofs) + __offsetof(struct rndis_packet_msg, rm_dataoffset)) + +#define RNDIS_PACKET_MSG_OFFSET_ALIGN 4 +#define RNDIS_PACKET_MSG_OFFSET_ALIGNMASK \ + (RNDIS_PACKET_MSG_OFFSET_ALIGN - 1) + /* Per-packet-info for RNDIS data message */ struct rndis_pktinfo { uint32_t rm_size; @@ -137,7 +145,8 @@ struct rndis_pktinfo { #define RNDIS_PKTINFO_OFFSET \ __offsetof(struct rndis_pktinfo, rm_data[0]) -#define RNDIS_PKTINFO_ALIGN 4 +#define RNDIS_PKTINFO_SIZE_ALIGN 4 +#define RNDIS_PKTINFO_SIZE_ALIGNMASK (RNDIS_PKTINFO_SIZE_ALIGN - 1) #define NDIS_PKTINFO_TYPE_CSUM 0 #define NDIS_PKTINFO_TYPE_IPSEC 1 @@ -236,7 +245,8 @@ struct rndis_query_comp { uint32_t rm_infobufoffset; }; -#define RNDIS_QUERY_COMP_INFOBUFABS(ofs) \ +/* infobuf offset from the beginning of rndis_query_comp. */ +#define RNDIS_QUERY_COMP_INFOBUFOFFSET_ABS(ofs) \ ((ofs) + __offsetof(struct rndis_query_req, rm_rid)) /* Send a set object request. */ @@ -295,9 +305,28 @@ struct rndis_reset_comp { uint32_t rm_adrreset; }; -/* 802.3 link-state or undefined message error. */ +/* 802.3 link-state or undefined message error. Sent by device. */ #define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007 +struct rndis_status_msg { + uint32_t rm_type; + uint32_t rm_len; + uint32_t rm_status; + uint32_t rm_stbuflen; + uint32_t rm_stbufoffset; + /* rndis_diag_info */ +}; + +/* + * Immediately after rndis_status_msg.rm_stbufoffset, if a control + * message is malformatted, or a packet message contains inappropriate + * content. + */ +struct rndis_diag_info { + uint32_t rm_diagstatus; + uint32_t rm_erroffset; +}; + /* Keepalive messsage. May be sent by device. */ #define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008 #define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008 |