Validate rule Advanced Options numeric entries
Validate rule Advanced Options numeric entries

This makes sure the user puts in ordinary positive integers like "1" and "42" in these advanced options fields. It prevents everything else, including dodgy-looking possibilities like "007" which might actually work OK, but it is safer to allow just plain "7".
Note 1: The tests in function is_aoadv_used($rule_config) had to be changed back from using empty() to use $var != "" because if the user enters "0" in one of those fields and presses save, they get an error message, but the Advanced Options block on the GUI is closed (the "0" was considered empty()). That seemed rather confusing - the user would have had to click on the Advanced Options "Advanced" button again to open up that block and see the "0" they had entered.
Note 2: I have prohibited 2 things that "pf" allows into the ruleset without generating an error:
(max 0)
(tcp.established 0)
Both of these seem (IMHO) to have no valid use case. They would prevent states from ever happening, and so would effectively be block rules, which could be implemented easily as block rules.
NewEraCracker/pfsense,phil-davis/pfsense,pfsense/pfsense,phil-davis/pfsense,NewEraCracker/pfsense,NOYB/pfsense,jxmx/pfsense,jxmx/pfsense,ch1c4um/pfsense,dennypage/pfsense,brunostein/pfsense,BlackstarGroup/pfsense,jxmx/pfsense,NewEraCracker/pfsense,NOYB/pfsense,pfsense/pfsense,ch1c4um/pfsense,phil-davis/pfsense,ptorsten/pfsense,ptorsten/pfsense,ch1c4um/pfsense,BlackstarGroup/pfsense,NewEraCracker/pfsense,pfsense/pfsense,BlackstarGroup/pfsense,dennypage/pfsense,NOYB/pfsense,ptorsten/pfsense,ch1c4um/pfsense,brunostein/pfsense,brunostein/pfsense,dennypage/pfsense,phil-davis/pfsense,dennypage/pfsense,pfsense/pfsense,BlackstarGroup/pfsense