how to set TCP_SOCKET_OOBINLINE using IOCTL_TCP_SET_INFORMATION_EX

Hello. I am trying to disable Out Of Bounds InLine by creating an IOCTL_TCP_SET_INFORMATION_EX IRP (which I assume is the same as an app calling setsockopt(a0, SOL_SOCKET, SO_OOBINLINE,…)).
My code builds and runs but IoCallDriver returns an invalid parameter status. Here is my code below. Does anyone see which parameter is invalid? I would appreciate any comments. I really need expedited data to come in via an receive expedited call back. If I have the app call setsockopt then expedited data indeed comes in on my expedited receive event callback, but calling that from the app is not acceptabel in the end product. Needs to be done from my driver.

PTCP_REQUEST_SET_INFORMATION_EX pSetInformation;
KEVENT TdiCompletionContext;
PIO_STACK_LOCATION StackLocation;
IO_STATUS_BLOCK IoStatusBlock = {0};

KeInitializeEvent(&TdiCompletionContext, NotificationEvent, FALSE);

pSetInformation = (PTCP_REQUEST_SET_INFORMATION_EX) ExAllocatePool(NonPagedPool, sizeof(TCP_REQUEST_SET_INFORMATION_EX) + size);
if (pSetInformation == NULL) {
return STATUS_INSUFFICIENT_RESOURCES;
}

RtlZeroMemory ( pSetInformation, sizeof(TCP_REQUEST_SET_INFORMATION_EX) + size);

// set tdi obj struct
pSetInformation->ID.toi_entity.tei_entity = CO_TL_ENTITY;
pSetInformation->ID.toi_entity.tei_instance = 0;
pSetInformation->ID.toi_class = INFO_CLASS_PROTOCOL;
pSetInformation->ID.toi_type = INFO_TYPE_CONNECTION;
pSetInformation->ID.toi_id = TCP_SOCKET_OOBINLINE;

RtlMoveMemory(pSetInformation->Buffer, pBuf, size);
pSetInformation->BufferSize = size;

irp = IoBuildDeviceIoControlRequest(IOCTL_TCP_SET_INFORMATION_EX,
DeviceObject, // TDI device
(PVOID)pSetInformation,
sizeof(TCP_REQUEST_SET_INFORMATION_EX) + size,
NULL,
0,
FALSE,
&TdiCompletionContext,
&IoStatusBlock);

if (!irp) {
return STATUS_INSUFFICIENT_RESOURCES;
}

StackLocation = IoGetNextIrpStackLocation(irp);

StackLocation->DeviceObject = DeviceObject; // TDI device
StackLocation->FileObject = fileObject; // Connect file object

NtStatus = IoCallDriver(DeviceObject, irp);

To state my issue more clearly, I just need to know how to in effect do the same thing in a device driver as calling setsockopt from an application, specifially to disable SO_OOBINLINE. Does anyone know how to do that?
BOOL optval = FALSE;
setsockopt(a0, SOL_SOCKET, SO_OOBINLINE, (char *)&optval, sizeof(optval));

Hi again. Seems like I am having a dialog with myself :slight_smile:
But anyhow, I figured out that the above code was actually working once I changed to pass in the FileObject representing the client connecting to the server. I had tried that earlier but the app I was filtering was issuing a setsockopt itself to turn OOBINLINE back on so I thought it was not working. Now that I know that I’m all set! I continually find it amazing at how gosh-and-by-golly, seat-of-the-pants and undocumented device driver work can be.

Glad you found this fix.

Your note made pause and think. Lately I have been updating my info on LinkedIn (Don’t actually know what LinkedIn is good for, but I’ll find out…). This process involved looking at my past work for the last 30 years or so.

Yep, the foundation of my experience is mostly “experimental” or “research” and that penchant continues to be of help to me today.

In college I was a research assistant that spent literally years counting electrons (femto-ampere currents) in experiments for the Atomic Energy Commission. Then off to work at the Georgia Tech Engineering Experiment Station inventing tools to measure radar delectability (stealth) and passive electronic surveillance (range/position probabilities based on one-way RF measurements).

Eventually microcomputers and PC’s entered the picture and I became involved in software development.

Looking at my activities today I see that even though I am now writing Windows device drivers for a living, my experimental background has been helpful.

Although the DDK/WDK documentation is better than it used to be, development of a working product is often as you said: “seat-of-the-pants”.

Read the documentation, but don’t accept it blindly because it could be wrong or misinterpreted. Read behind the lines and think like the developer who was coding the method or structure. Run experiments to determine the actual behavior and do so under the widest possible testing (i.e., “experimental”) conditions.

Regards,

Thomas F. Divine

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:bounce-292995-
xxxxx@lists.osr.com] On Behalf Of xxxxx@swbell.net
Sent: Monday, July 09, 2007 10:45 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] how to set TCP_SOCKET_OOBINLINE using
IOCTL_TCP_SET_INFORMATION_EX

Hi again. Seems like I am having a dialog with myself :slight_smile:
But anyhow, I figured out that the above code was actually working once
I changed to pass in the FileObject representing the client connecting
to the server. I had tried that earlier but the app I was filtering was
issuing a setsockopt itself to turn OOBINLINE back on so I thought it
was not working. Now that I know that I’m all set! I continually find
it amazing at how gosh-and-by-golly, seat-of-the-pants and undocumented
device driver work can be.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer