aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/hyperv/netvsc
diff options
context:
space:
mode:
authorSepherosa Ziehau <sephe@FreeBSD.org>2016-10-10 06:14:38 +0000
committerSepherosa Ziehau <sephe@FreeBSD.org>2016-10-10 06:14:38 +0000
commit5d67f6752bf999de1507bf9895766eb92d85c73d (patch)
tree7fc4496f20752720fbbae5fc10b03a37b67d55aa /sys/dev/hyperv/netvsc
parent43147058fd4d353d7a36a2fd460869dd1e1d456e (diff)
Notes
Diffstat (limited to 'sys/dev/hyperv/netvsc')
-rw-r--r--sys/dev/hyperv/netvsc/hv_rndis_filter.c12
-rw-r--r--sys/dev/hyperv/netvsc/ndis.h4
2 files changed, 9 insertions, 7 deletions
diff --git a/sys/dev/hyperv/netvsc/hv_rndis_filter.c b/sys/dev/hyperv/netvsc/hv_rndis_filter.c
index 59f2082977bd..4af6e9930d23 100644
--- a/sys/dev/hyperv/netvsc/hv_rndis_filter.c
+++ b/sys/dev/hyperv/netvsc/hv_rndis_filter.c
@@ -1179,16 +1179,16 @@ hn_rndis_query_hwcaps(struct hn_softc *sc, struct ndis_offload *caps)
size = NDIS_OFFLOAD_SIZE;
} else if (sc->hn_ndis_ver >= HN_NDIS_VERSION_6_1) {
in.ndis_hdr.ndis_rev = NDIS_OFFLOAD_REV_2;
- size = NDIS_OFFLOAD_SIZE_2;
+ size = NDIS_OFFLOAD_SIZE_6_1;
} else {
in.ndis_hdr.ndis_rev = NDIS_OFFLOAD_REV_1;
- size = NDIS_OFFLOAD_SIZE_1;
+ size = NDIS_OFFLOAD_SIZE_6_0;
}
in.ndis_hdr.ndis_size = size;
caps_len = NDIS_OFFLOAD_SIZE;
error = hn_rndis_query2(sc, OID_TCP_OFFLOAD_HARDWARE_CAPABILITIES,
- &in, size, caps, &caps_len, NDIS_OFFLOAD_SIZE_1);
+ &in, size, caps, &caps_len, NDIS_OFFLOAD_SIZE_6_0);
if (error)
return (error);
@@ -1209,7 +1209,7 @@ hn_rndis_query_hwcaps(struct hn_softc *sc, struct ndis_offload *caps)
if_printf(sc->hn_ifp, "invalid NDIS objsize %u, "
"data size %zu\n", caps->ndis_hdr.ndis_size, caps_len);
return (EINVAL);
- } else if (caps->ndis_hdr.ndis_size < NDIS_OFFLOAD_SIZE_1) {
+ } else if (caps->ndis_hdr.ndis_size < NDIS_OFFLOAD_SIZE_6_0) {
if_printf(sc->hn_ifp, "invalid NDIS objsize %u\n",
caps->ndis_hdr.ndis_size);
return (EINVAL);
@@ -1217,7 +1217,9 @@ hn_rndis_query_hwcaps(struct hn_softc *sc, struct ndis_offload *caps)
if (bootverbose) {
/*
- * Fields for NDIS 6.0 are accessable.
+ * NOTE:
+ * caps->ndis_hdr.ndis_size MUST be checked before accessing
+ * NDIS 6.1+ specific fields.
*/
if_printf(sc->hn_ifp, "hwcaps rev %u\n",
caps->ndis_hdr.ndis_rev);
diff --git a/sys/dev/hyperv/netvsc/ndis.h b/sys/dev/hyperv/netvsc/ndis.h
index 235cb8e4b038..fed262dddf67 100644
--- a/sys/dev/hyperv/netvsc/ndis.h
+++ b/sys/dev/hyperv/netvsc/ndis.h
@@ -319,9 +319,9 @@ struct ndis_offload {
};
#define NDIS_OFFLOAD_SIZE sizeof(struct ndis_offload)
-#define NDIS_OFFLOAD_SIZE_1 \
+#define NDIS_OFFLOAD_SIZE_6_0 \
__offsetof(struct ndis_offload, ndis_ipsecv2)
-#define NDIS_OFFLOAD_SIZE_2 \
+#define NDIS_OFFLOAD_SIZE_6_1 \
__offsetof(struct ndis_offload, ndis_rsc)
#define NDIS_OFFLOAD_REV_1 1 /* NDIS 6.0 */