Rule variable names can be modified in several ways. You can define meta-variables using the $ operator. These can be used with the variable modifier operators ? and -, as described in the following table:
| Variable Syntax | Description |
|---|---|
| var | Defines a meta-variable. |
| $(var) or $var | Replaces with the contents of variable var. |
| $(var:-default) | Replaces the contents of the variable var with ``default'' if var is undefined. |
| $(var:?message) | Replaces with the contents of variable var or prints out the error message and exits. |
Here is an example of advanced variable usage in action:
ipvar MY_NET 192.168.1.0/24
log tcp any any -> $(MY_NET:?MY_NET is undefined!) 23