UDP::payload replace

Anyone know if “replace” is supported in UDP::payload?

The documentation does not list it.

If not, does anyone know of a way to manipulate some data (generically) in UDP packets?

Yes, UDP::payload supports “replace”, same format as for TCP::payload.

Thanks!

What is the argument list?

For TCP it is TCP::payload replace

If I use that with UDP, I get a “wrong of args” error. Stripping out and/or also returns the same error.

The arguments are the same as for TCP. When do you get the error? What version are you running? The following command works fine for me:

bigpipe rule udp_rule '{ when CLIENT_DATA { UDP::payload replace 0 4 "test" } }'

We’re running 9.0.4.

Error appears when saving the rule through the GUI.

Here’s the code:

when CLIENT_DATA {  
 set payload [UDP::payload [UDP::payload length]]  
 set blank “\n”  
  
  Find the data to replace  
 regsub -all "Replace me\n" $payload $blank new_response  
  
  Replace the content if there was a match  
 if {$new_response != 0} {  
 UDP::payload replace 0 [UDP::payload length] $new_response  
 }  
 }

Result is wrong of arguments, line 10.

The above rule seems to be accepted on 9.0.5. However, I don’t recall any fixes for UDP::payload. Check your rule for any trailing or otherwise unexpected whitespace.

Upgrading to 9.0.5 solved the problem!

Thanks!