@@ -390,3 +390,65 @@ config interface "{{ key }}"
390
390
{% endif %}
391
391
{% endfor %}
392
392
{% endmacro %}
393
+
394
+
395
+ {% macro create_rules (rules , family ) %}
396
+ {% for key , value in rules .items () %}
397
+ {% if family == 4 %}
398
+ config rule '{{ key }}'
399
+ {% elif family == 6 %}
400
+ config rule6 '{{ key }}'
401
+ {% endif %}
402
+
403
+ {% if value ['in' ] is defined %}
404
+ option in "{{ value['in'] }}"
405
+ {% endif %}
406
+ {% if value ['out' ] is defined %}
407
+ option out "{{ value['out'] }}"
408
+ {% endif %}
409
+ {% if value ['src' ] is defined %}
410
+ option src "{{ value['src'] }}"
411
+ {% endif %}
412
+ {% if value ['dest' ] is defined %}
413
+ option dest "{{ value['dest'] }}"
414
+ {% endif %}
415
+ {% if value ['tos' ] is defined %}
416
+ option tos "{{ value['tos'] }}"
417
+ {% endif %}
418
+ {% if value ['mark' ] is defined %}
419
+ option mark "{{ value['mark'] }}"
420
+ {% endif %}
421
+ {% if value ['uidrange' ] is defined %}
422
+ option uidrange "{{ value['uidrange'] }}"
423
+ {% endif %}
424
+ {% if value ['suppress_prefixlength' ] is defined %}
425
+ option suppress_prefixlength "{{ value['suppress_prefixlength'] }}"
426
+ {% endif %}
427
+ {% if value ['invert' ] is defined %}
428
+ option invert "{{ value['invert'] }}"
429
+ {% endif %}
430
+ {% if value ['priority' ] is defined %}
431
+ option priority "{{ value['priority'] }}"
432
+ {% endif %}
433
+ {% if value ['lookup' ] is defined %}
434
+ option lookup "{{ value['lookup'] }}"
435
+ {% endif %}
436
+ {% if value ['goto' ] is defined %}
437
+ option goto "{{ value['goto'] }}"
438
+ {% endif %}
439
+ {% if value ['action' ] is defined %}
440
+ option action "{{ value['action'] }}"
441
+ {% endif %}
442
+ {% if value ['disabled' ] is defined %}
443
+ option disabled "{{ value['disabled'] }}"
444
+ {% endif %}
445
+ {% endfor %}
446
+ {% endmacro %}
447
+
448
+ {% macro create_rules 4(allrules 4) %}
449
+ {{ create_rules(allrules4, 4)}}
450
+ {% endmacro %}
451
+
452
+ {% macro create_rules 6(allrules 6) %}
453
+ {{ create_rules(allrules6, 6)}}
454
+ {% endmacro %}
0 commit comments