Forum Discussion

Benjamin_Wong_1's avatar
Benjamin_Wong_1
Icon for Nimbostratus rankNimbostratus
Apr 01, 2006

How to make a binary UDP respond packet ?

Actually I am doing a project, it needs the F5 to respond a UDP packet with binary data.

 

 

but when i want to respond the UDP packet with UDP::respond , with binary data \x00, the packet it generated will become HEX C080. However, other binary data can be constructed correctly

 

 

How can I make a binary data for responding UDP request?

 

 

sample code:

 


when CLIENT_ACCEPTED {
   set packet \x00\x70\x00
   UDP::respond $packet
}
  • the typical create a binary format UDP packet is through binary format command:

     

    here a example:

     

     

    set ::header_without_id [binary format S5 {0x8180 0x0001 0x0001 0x0000 0x0000}]

     

     

    this mean format a binary format packet with 5 word. the follow in {} is the value of them. It's very simple, if you use "a5" replace "S5" that means format a packet with 5 char. but you should use value like 0x81 in the follow section. Also, an "a5S5" will be accepted option.

     

     

    so the sample about 0xC080 packet construction should be:

     

     

    when CLIENT_ACCEPTED {

     

    set packet [binary format S {0xC080}]

     

    UDP::response $packet

     

    }

     

     

    so BIGIP will reply 0xC080 for any UDP packet send to BIGIP.

     

     

    for detail information, you can find the book of TCL about binary format.
  • Actually i have tried to use the binary format command.

     

    see this code :

     

     

    
    when CLIENT_ACCEPTED {
    set packet [binary format S {0x0000}]
    UDP::response $packet
    }

     

     

    but when i get the ethereal trace on it, it still gives C080 C080 instead of 0000.

     

     

    what we want is to writing 0000 into the packet.

     

     

    I have found TCL manual, normally we will use fconfigure $fp -translation binary for writing binary data to file or channel. but how about the UDP::respond method? can it configure to accept binary data?
  • Sorry, it should be UDP::respond command to response the packets.

     

     

    I have test it on a 9.1.1 platform with rules:

     

     

    when CLIENT_ACCEPTED {

     

    set packet [binary format S {0x0000}]

     

    UDP::respond $packet

     

    }

     

     

    notice I write wrong command UDP::response should be UDP::respond

     

     

    I configure the VS listen on UDP port 53 and send a dns request to VS, there are no nodes behinde VS, then I got the return packet as attached file.

     

     

    BTW, do you have member in the VS pool? if you have, maybe you should add a UDP::drop after UDP::respond. that can prevent Server response.

     

     

     

  • I just look into the release note, As i am using 9.1.0, that is why i have that problem.

     

     

    I just make an update on the F5, I can now send the UDP message.

     

     

    Thank you very much.

     

     

    And do you know whether there is an issue on UDP::drop? as the release note on 9.1.0 said it is not always work.