Forum Discussion
Arie
Nov 04, 2011Altostratus
IP::client_addr / netmask addresses in Class (Data Group) - syntax problem
I have a class that contains a list of IP addresses with a netmask (/x). Initially I tried:
if { !( [ class match [IP::client_addr] equals class_CampusIPaddresses ] ) } {
However, that seems to work for 'straight' addresses only (i.e. without netmasks).
Assuming that I'd need to use IP::addr for the netmask match, I tried this:
if { !( [ class match [IP::addr [IP::client_addr]] equals class_CampusIPaddresses ] ) } {
The problem with that is that the editor complains "wrong args" when I try to save it.
Ideas?
- nitassEmployee
this is mine.
[root@iris:Active] config b class test list class test { { host 1.1.1.1 network 2.2.2.0/24 } } [root@iris:Active] config b rule myrule list rule myrule { when RULE_INIT { log local0. "\[class match -- 1.1.1.1 equals test\]: [class match -- 1.1.1.1 equals test]" log local0. "\[class match -- 2.2.2.2 equals test\]: [class match -- 2.2.2.2 equals test]" log local0. "\[class match -- 3.3.3.3 equals test\]: [class match -- 3.3.3.3 equals test]" if {![class match -- 1.1.1.1 equals test]} { log local0. "!\[class match -- 1.1.1.1 equals test\]: 1" } else { log local0. "!\[class match -- 1.1.1.1 equals test\]: 0" } if {![class match -- 2.2.2.2 equals test]} { log local0. "!\[class match -- 2.2.2.2 equals test\]: 1" } else { log local0. "!\[class match -- 2.2.2.2 equals test\]: 0" } if {![class match -- 3.3.3.3 equals test]} { log local0. "!\[class match -- 3.3.3.3 equals test\]: 1" } else { log local0. "!\[class match -- 3.3.3.3 equals test\]: 0" } } } [root@iris:Active] config cat /var/log/ltm Nov 5 08:58:43 local/iris err mcpd[32723]: 01020066:3: The requested rule (myrule) already exists in partition Common. Nov 5 08:58:43 local/tmm info tmm[1609]: Rule myrule : [class match -- 1.1.1.1 equals test]: 1 Nov 5 08:58:43 local/tmm info tmm[1609]: Rule myrule : [class match -- 2.2.2.2 equals test]: 1 Nov 5 08:58:43 local/tmm info tmm[1609]: Rule myrule : [class match -- 3.3.3.3 equals test]: 0 Nov 5 08:58:43 local/tmm info tmm[1609]: Rule myrule : ![class match -- 1.1.1.1 equals test]: 0 Nov 5 08:58:43 local/tmm info tmm[1609]: Rule myrule : ![class match -- 2.2.2.2 equals test]: 0 Nov 5 08:58:43 local/tmm info tmm[1609]: Rule myrule : ![class match -- 3.3.3.3 equals test]: 1
- ArieAltostratusAre you saying that it is possible to simply use
as long as the value in the Class has the prefix "network"?[class match ...]
- Michael_YatesNimbostratusHi Arie,
- nitassEmployeeAre you saying that it is possible to simply use
- nitassEmployeecan you put some log command in the irule and post the irule along with log here?
- hooleylistCirrostratusAs Nitass said the class commands will do a bitwise comparison of a host or network against a datagroup. You just need to specify a type of "address" for the datagroup.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects