Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

iRule TCL: if 'something' in 'list' then, syntax/parser error

Cypher
Altocumulus
Altocumulus

Hi,

 

I'm really breaking my head here.

 

Basicly i need to check if an IP is in a list. If it is not, connection is rejected.

With logging commands i was able to determine that the variables are populated correctly.

 

if { not ($client_ip in $ipwhitelist) } {
		reject
   } 

This code is not working with error iRULE 9: error: [parse error: PARSE syntax 363 {syntax error in expression " not ($client_ip in $ipwhitelist) ": looking for close parenthesis}][{ not ($client_ip in $ipwhitelist) }]. Is there another way?

 

Thanks! & Happy holidays!

1 ACCEPTED SOLUTION

Cypher
Altocumulus
Altocumulus

I got it to work. I don't think the F5 tcl supports the 'in' operator. So, instead using a of list, I used a string with the contains operator. End result is the same for me :).

if { not ($ipwhiteliststring contains $client_ip) } {
	reject
   } 

View solution in original post

2 REPLIES 2

Cypher
Altocumulus
Altocumulus

I got it to work. I don't think the F5 tcl supports the 'in' operator. So, instead using a of list, I used a string with the contains operator. End result is the same for me :).

if { not ($ipwhiteliststring contains $client_ip) } {
	reject
   } 

Please mark your answer as solution provided.