tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: urndis



diff --git a/sys/dev/usb/if_urndis.c b/sys/dev/usb/if_urndis.c
index 73b403598222..b3c06fd26007 100644
--- a/sys/dev/usb/if_urndis.c
+++ b/sys/dev/usb/if_urndis.c
@@ -289,7 +289,18 @@ urndis_ctrl_handle_init(struct urndis_softc *sc,
		return RNDIS_STATUS_FAILURE;
	}

-	sc->sc_lim_pktsz = le32toh(msg->rm_pktmaxsz);
+	if (le32toh(msg->rm_ver_major) != RNDIS_MAJOR_VERSION &&

Shouldn't this be || and not && ? ----------------------------^^

+	    le32toh(msg->rm_ver_minor) != RNDIS_MINOR_VERSION) {
+		printf("%s: version not %u.%u (current version: %u.%u)\n",
+		    DEVNAME(sc), RNDIS_MAJOR_VERSION, RNDIS_MINOR_VERSION,
+		    le32toh(msg->rm_ver_major), le32toh(msg->rm_ver_minor));
+
+		return RNDIS_STATUS_FAILURE;
+	}
+
+	sc->sc_maxppt = le32toh(msg->rm_pktmaxcnt);
+	sc->sc_maxtsz = le32toh(msg->rm_pktmaxsz);
+	sc->sc_palign = 1U << le32toh(msg->rm_align);

	return le32toh(msg->rm_status);
}
@@ -402,8 +413,8 @@ urndis_ctrl_init(struct urndis_softc *sc)
	msg->rm_type = htole32(REMOTE_NDIS_INITIALIZE_MSG);
	msg->rm_len = htole32(sizeof(*msg));
	msg->rm_rid = htole32(0);
-	msg->rm_ver_major = htole32(1);
-	msg->rm_ver_minor = htole32(1);
+	msg->rm_ver_major = htole32(RNDIS_MAJOR_VERSION);
+	msg->rm_ver_minor = htole32(RNDIS_MINOR_VERSION);
	msg->rm_max_xfersz = htole32(RNDIS_BUFSZ);

	DPRINTF(("%s: urndis_ctrl_init send: type %u len %u rid %u ver_major %u "
@@ -743,7 +754,7 @@ urndis_decap(struct urndis_softc *sc, struct urndis_chain *c, uint32_t len)
	ifp = GET_IFP(sc);
	offset = 0;

-	while (len > 0) {
+	while (len > 1) {
		msg = (struct urndis_packet_msg *)((char*)c->sc_buf + offset);
		m = c->sc_mbuf;

diff --git a/sys/dev/usb/if_urndisreg.h b/sys/dev/usb/if_urndisreg.h
index 78415e61f6a2..fad80d7e3f98 100644
--- a/sys/dev/usb/if_urndisreg.h
+++ b/sys/dev/usb/if_urndisreg.h
@@ -47,8 +47,10 @@ struct urndis_softc {
	struct ethercom			sc_ec;

	/* RNDIS device info */
-	uint32_t			sc_lim_pktsz;
	uint32_t			sc_filter;
+	uint32_t			sc_maxppt;
+	uint32_t			sc_maxtsz;
+	uint32_t			sc_palign;

	/* USB goo */
	struct usbd_device *		sc_udev;
@@ -122,6 +124,9 @@ struct urndis_softc {

#define RNDIS_MEDIUM_802_3		0x00000000

+#define RNDIS_MAJOR_VERSION		0x00000001U
+#define RNDIS_MINOR_VERSION		0x00000000U
+
/* Device flags */
#define RNDIS_DF_CONNECTIONLESS		0x00000001
#define RNDIS_DF_CONNECTION_ORIENTED	0x00000002



+------------------+--------------------------+----------------------------+
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:          |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
+------------------+--------------------------+----------------------------+


Home | Main Index | Thread Index | Old Index