Книга: Linux Network Administrator Guide, Second Edition
A Simple Rule Pattern Example
A Simple Rule Pattern Example
To better see how the macro substitution patterns operate, consider the following rule lefthand side:
$* ‹ $+ ›
This rule matches "Zero or more tokens, followed by the ‹ character, followed by one or more tokens, followed by the › character."
If this rule were applied to [email protected] or Head Brewer ‹ ›, the rule would not match. The first string would not match because it does not include a ‹ character, and the second would fail because $+ matches one or more tokens and there are no tokens between the ‹› characters. In any case in which a rule does not match, the righthand side of the rule is not used.
If the rule were applied to Head Brewer ‹ [email protected] ›, the rule would match, and on the righthand side $1 would be substituted with Head Brewer and $2 would be substituted with [email protected].
If the rule were applied to ‹ [email protected] › the rule would match because $* matches zero or more tokens, and on the righthand side $1 would be substituted with the empty string.
- Some Useful Macro Definitions
- Beyond Simple Macros
- Листинг 10.1. (simpleid.c) Отображение идентификаторов пользователя и группы
- Chapter 8. Saving and restoring large rule-sets
- Chapter 9. How a rule is built
- Chapter 14. Example scripts
- Appendix J. Example scripts code-base
- Example NAT machine in theory
- example rc.firewall
- Displacement of rules to different chains
- Iptables-save ruleset
- Listing your active rule-set