@@ -389,10 +389,15 @@ function nft(){
389389 forward-in)
390390 # Replace accept with return so packets get passed on to forward-out
391391 if [ " ${terminal_statement} " == " accept" ]; then
392- if [ ! -z " ${end_of_rule} " ]; then
393- FWD_IN+=(" ${start_of_rule} return ${end_of_rule} " )
392+ local return_action=" return"
393+ if [ " ${conf_counters} " == " true" ]; then
394+ return_action=" counter return"
395+ fi
396+
397+ if [ -n " ${end_of_rule} " ]; then
398+ FWD_IN+=(" ${start_of_rule}${return_action}${end_of_rule} " )
394399 else
395- FWD_IN+=(" ${start_of_rule} return " )
400+ FWD_IN+=(" ${start_of_rule}${return_action} " )
396401 fi
397402 else
398403 FWD_IN+=(" ${rule} " )
@@ -404,10 +409,15 @@ function nft(){
404409 forward)
405410 # Replace accept with return so packets get passed on to forward-out
406411 if [ " ${terminal_statement} " == " accept" ]; then
407- if [ ! -z " ${end_of_rule} " ]; then
408- FWD_IN+=(" ${start_of_rule} return ${end_of_rule} " )
412+ local return_action=" return"
413+ if [ " ${conf_counters} " == " true" ]; then
414+ return_action=" counter return"
415+ fi
416+
417+ if [ -n " ${end_of_rule} " ]; then
418+ FWD_IN+=(" ${start_of_rule}${return_action}${end_of_rule} " )
409419 else
410- FWD_IN+=(" ${start_of_rule} return " )
420+ FWD_IN+=(" ${start_of_rule}${return_action} " )
411421 fi
412422 else
413423 FWD_IN+=(" ${rule} " )
0 commit comments