Forum Discussion

kenhuang_89481's avatar
kenhuang_89481
Icon for Nimbostratus rankNimbostratus
Jul 12, 2010

about binary format/scan

 

The following paragraph is about "irules

 

". It's easy and there's no problem.

 

 

look this rules...

 

 

when CLIENT_ACCEPTED {

 

TCP::collect 1

 

}

 

when CLIENT_DATA {

 

if { [TCP::payload 1] equals "0" } {

 

pool pool0

 

} elseif {[TCP::payload 1] equals "1"}{

 

TCP::payload replace 0 1 ""

 

pool pool1

 

} else { pool game_pool3 }

 

TCP::release

 

}

 

 

 

interpret:

 

When the client send ASCII '0', IRULES will send this requirement directly to pool0.

 

When the client send ASCII '1', IRULES will delete the first byte of the package and also send the byte to pool1. So far, all is Ok.

 

 

But now in case that the client send the 3 of the binary and also do the matching, VS will send the requirement of the client to pool3 when they match well.

 

 

thanks

 

5 Replies

  • Hi Ken,

     

     

    Can you clarify what your question is? Have you tried testing this iRule? If so, what results do you see? If you want to get more info on what the iRule is doing, you can add debug logging. See the log wiki page for more info:

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/log

     

     

    And here are a few links to the commands you have in the iRule

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/tcp__collect

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/tcp__payload

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/tcp__release

     

     

    Aaron
  • i'm try this problem

     

     

    new irules is

     

     

     

    when CLIENT_ACCEPTED {

     

    }

     

    when CLIENT_DATA {

     

    set payload [TCP::payload]

     

    binary scan c $payload jieguo

     

    if { $jieguo equals "6" } {

     

    TCP::payload replace 0 1 ""

     

    pool test-socket }

     

    TCP::release

     

    }

     

     

     

    it's right ,but what i delete the first byte of the package and also send the byte to pool1.
  • I think you need to call TCP::collect in order to have LTM buffer the TCP payload. Can you elaborate on what exactly you're trying to accomplish and the issue(s) you're seeing with the rule?

     

     

    Aaron
  • when CLIENT_ACCEPTED {

     

    TCP::collect 1

     

    }

     

    when CLIENT_DATA {

     

    set payload [TCP::payload ]

     

    binary scan c $payload jieguo

     

    if { $jieguo equals "6" } {

     

    TCP::payload replace 0 1 ""

     

    pool test-socket }

     

    TCP::release

     

    }