Sending array of ip adresses from json file as ioctl to driver and block the ip's

Hii,
I want to send ip adresses stored in json file to wfp driver and block those ip’s. But I am not getting how can I pass the buffer from
buffer = Irp->AssociatedIrp.SystemBuffer; to the clasifyfn or Addfilter function to match the ips.

Global variable? Or am I missing something?

are you asking how to parse JSON in KM? or how to make a copy of the memory passed in an IRP that you can then use in another context?

My fault, I was trying to parse the json (using user mode libraries) in kernel mode.
I did it by parsing json in user application and then send the data.

1 Like

It should be noted that parsing JSON in KM is also doable. Just like any other string format, the key is to understand the bounding conditions and create a state machine for the expected format. The central problem is always what to do when the data supplied is not in the expected format. UM implementations usually have features based on runtime type information, and usually fail by throwing exceptions, but a KM version has to expect specific elements and fail in a structured way. Once those requirements are certain, it is usually as simple as a while(i < len) loop with some state variables. Some prefer for loops, but I hate that idiom