Forum Discussion

Ibrahim_Kadiri's avatar
Ibrahim_Kadiri
Icon for Nimbostratus rankNimbostratus
Jun 12, 2017

Irule for TCP DATA verification

Hi Experts,

I have created the below iRule, Kindly can you please suggest to tune it.

I am looking for three conditions to match in a connection to allow the user. For Eg: The Client ID (TID) should be Equal to Serial Number (TSN) and its MAC (MAC)

when CLIENT_ACCEPTED {    
    TCP::collect 
} 

when CLIENT_DATA {          
set payload [TCP::payload] 
regexp {} payload TID
regexp {} payload TSN
set TSN "$TSN,"
set MAC LINK::lasthop
concatenate the two variables
set total "$TSN$MAC" 
set value [class match -name $TID equals string_Data_group ]

if {$value ne $total}{
    reject
    }

}


Thanks,
Ibrahim
  • Hi,

     

    The main problem in your irule is the regexp command twice of all payload data for any TCP .

     

    What is the regexp pattern? this seems empty. can you search pattern without regex (string with fixed length, encoded string length in headers, ...)?