$sameAddr
Check whether the specified IP addresses are same
Syntax:
$sameAddr( "IP1", "IP2" )$sameAddr( "IP1" )
Parameters:
IP1 – IP address
IP2 – IP address. If the IP2 is omitted, the source IP address of SIP packet is used.Returns:
true – if the addresses are the same.
false – otherwise
Version Since:
3.13
Where the function can be used:
- Preliminary rules
- Regular rules
Example:
$sameAddr("fe80::1","fe80:0:0:0:0:0:0:1") = ^true
*) It is possible to compare between IPv4 addresses, but this method is for comparing IPv6 addresses as described above.
The result is true because fe80::1 is shorthand for fe80:0:0:0:0:0:0:1.
For IPv6, the return value of $addr will be an abbreviated IPv6 address.
So $addr = ^fe80::1$ cannot be written as $addr = ^fe80::001$ or $addr=^fe80:00:00::1$.
In such case, you can compare addresses in any notation by using $sameAddr.
For example, $sameAddr(“fe80::1”) , $sameAddr(“fe80::001”) , $sameAddr(“ffe80:0:0::1”) , $sameAddr(“ffe80:0:0:0: 0:0:0:1”) are the same.