+ # NB: if MASQUERADING for IPv6 becomes available we'll need a family check here
+ local msrc mdst
+ for msrc in ${masq_src:-0.0.0.0/0}; do
+ [ "${msrc#!}" != "$msrc" ] && msrc="! -s ${msrc#!}" || msrc="-s $msrc"
+ for mdst in ${subnet:-${masq_dest:-0.0.0.0/0}}; do
+ [ "${mdst#!}" != "$mdst" ] && mdst="! -d ${mdst#!}" || mdst="-d $mdst"
+ fw $action $mode n ${chain}_nat MASQUERADE $ { -o "$ifname" $msrc $mdst }
+ done
+ done
+