Skip to content

Commit

Permalink
Use flowtables to accelerate forwarding
Browse files Browse the repository at this point in the history
This accelerates IP forwarding and NAT using flowtables.
  • Loading branch information
DemiMarie committed Apr 9, 2023
1 parent 562bc80 commit 71d2fb8
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions network/vif-route-qubes
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,31 @@ case "$command" in
nftables_cmd=add
cmdprefix=''
ipv6_disabled=$(cat "/proc/sys/net/ipv6/conf/$vif/disable_ipv6" || echo 1)
interfaces=''
separator=''

for i in /proc/sys/net/ipv4/conf/*; do
i=${i:24}
case $i in (all|default|*[!A-Za-z0-9._]*) continue;; esac
interfaces+="$separator$i"
separator=', '
done
if [[ -n "$separator" ]]; then
nft "
add table inet qubes-nat-accel
delete table inet qubes-nat-accel
table inet qubes-nat-accel {
flowtable qubes-accel {
hook ingress priority filter
devices = { $interfaces }
}
chain qubes-accel {
type filter hook forward priority filter; policy accept;
flow add @qubes-accel
counter
}
}"
fi
;;
offline)
do_without_error ifdown "${vif}"
Expand Down

0 comments on commit 71d2fb8

Please sign in to comment.