# Except for dates, which can be humanly readable!
# This one is be an expansion, so it's left as-is.
condition &Event-Timestamp == "January 1, 2012 %{blah}"
-match (&Event-Timestamp == %cast(string, "January 1, 2012 %{blah}"))
+match (&Event-Timestamp == "January 1, 2012 %{blah}")
# This one is NOT an expansion, so it's parsed into normal form
condition &Event-Timestamp == 'January 1, 2012'
match true
condition (ipaddr)127.0.0.1 == "%md4(' 127.0.0.1')"
-match (127.0.0.1 == %cast(string, "%md4(' 127.0.0.1')"))
+match (127.0.0.1 == "%md4(' 127.0.0.1')")
#
# Bare %{...} is allowed.
match true
condition (ether) 00:11:22:33:44:55 == "%md4('00:11:22:33:44:55')"
-match (00:11:22:33:44:55 == %cast(string, "%md4('00:11:22:33:44:55')"))
+match (00:11:22:33:44:55 == "%md4('00:11:22:33:44:55')")
condition (ether) 00:XX:22:33:44:55 == 00:11:22:33:44:55
match ERROR offset 12: Missing separator, expected ':'
match true
condition ("foo" == "%md4(' foo')")
-match ("foo" == %cast(string, "%md4(' foo')"))
+match ("foo" == "%md4(' foo')")
condition ("foo bar" == "%md4(' foo')")
-match ("foo bar" == %cast(string, "%md4(' foo')"))
+match ("foo bar" == "%md4(' foo')")
condition ("foo" == "bar")
match false
match (&User-Name == "bob")
condition (&User-Name == "%md4(' blah')")
-match (&User-Name == %cast(string, "%md4(' blah')"))
+match (&User-Name == "%md4(' blah')")
condition (ipaddr)127.0.0.1 == 2130706433
match true
# This used to be expr, but expr isn't a builtin, so it failed...
condition (integer)"%md4(' 1 + 1')" < &NAS-Port
-match (%cast(uint32, "%md4(' 1 + 1')") < &NAS-Port)
+match ((uint32)"%md4(' 1 + 1')" < &NAS-Port)
#
# The string gets parsed as an IP address.
# but these are allowed
condition (ether)&Acct-Input-Octets64 == "%interpreter('foo')"
-match ((ether)&Acct-Input-Octets64 == %cast(string, "%interpreter('foo')"))
+match ((ether)&Acct-Input-Octets64 == "%interpreter('foo')")
condition (ipaddr)&Filter-Id == &Framed-IP-Address
match ((ipaddr)&Filter-Id == &Framed-IP-Address)
# data &Acct-Input-Octets > &Session-Timeout
#
condition &Acct-Input-Octets > "%{Session-Timeout}"
-match (&Acct-Input-Octets > %cast(string, "%{Session-Timeout}"))
+match (&Acct-Input-Octets > "%{Session-Timeout}")
# Separate types aren't optimized
condition &Acct-Input-Octets-64 > "%{Session-Timeout}"
-match (&Acct-Input-Octets-64 > %cast(string, "%{Session-Timeout}"))
+match (&Acct-Input-Octets-64 > "%{Session-Timeout}")
#
# Parse OIDs into known attributes, where possible.
# This one is be an expansion, so it's left as-is.
#
xlat_purify &Event-Timestamp == "January 1, 2012 %{User-Name}"
-match (&Event-Timestamp == %cast(string, "January 1, 2012 %{User-Name}"))
+match (&Event-Timestamp == "January 1, 2012 %{User-Name}")
# This one is NOT an expansion, so it's parsed into normal form
xlat_purify &Event-Timestamp == 'January 1 2012'
# LHS is IPaddr, RHS is string (malformed IP address).
# We can only fail this at run-time.
xlat_purify (ipaddr)127.0.0.1 == "%md4(' 127.0.0.1')"
-match (127.0.0.1 == %cast(string, "%md4(' 127.0.0.1')"))
+match (127.0.0.1 == "%md4(' 127.0.0.1')")
#
# Bare %{...} is allowed.
# Invalid cast from octets to ether.
xlat_purify (ether)00:11:22:33:44:55 == "%md4('00:11:22:33:44:55')"
-match (00:11:22:33:44:55 == %cast(string, "%md4('00:11:22:33:44:55')"))
+match (00:11:22:33:44:55 == "%md4('00:11:22:33:44:55')")
xlat_purify (ether) 00:XX:22:33:44:55 == 00:11:22:33:44:55
match ERROR offset 12: Missing separator, expected ':'
# ERROR: Failed casting 0x002ade8665c69219ca16bd108d92c8d5 to data type uint32: Invalid cast from octets to uint32. Source length 16 is greater than destination type size 4
#
xlat_purify (integer)"%md4(' 1 + 1')" < &NAS-Port
-match (%cast(uint32, "%md4(' 1 + 1')") < &NAS-Port)
+match ((uint32)"0x002ade8665c69219ca16bd108d92c8d5" < &NAS-Port)
#
# The string gets parsed as an IP address.
# but these are allowed
xlat_purify (ether)&Acct-Input-Octets64 == "%interpreter('foo')"
-match ((ether)&Acct-Input-Octets64 == %cast(string, "%interpreter('foo')"))
+match ((ether)&Acct-Input-Octets64 == "%interpreter('foo')")
xlat_purify (ipaddr)&Filter-Id == &Framed-IP-Address
match ((ipaddr)&Filter-Id == &Framed-IP-Address)
#match &Foo-Bar
xlat_purify &Acct-Input-Octets > "%{Session-Timeout}"
-match (&Acct-Input-Octets > %cast(string, "%{Session-Timeout}"))
+match (&Acct-Input-Octets > "%{Session-Timeout}")
xlat_purify &Acct-Input-Octets > &Session-Timeout
match (&Acct-Input-Octets > &Session-Timeout)