#!/bin/bash

rm -f /tmp/batch.nft
for ((i=0;i<100000;i++))
do
	RULESET="add chain inet osmo-upf tunmap-pre-$i;
add rule inet osmo-upf tunmap-pre-$i ip daddr set 3.3.3.3 meta mark set $i counter accept;
add chain inet osmo-upf tunmap-post-$i;
add rule inet osmo-upf tunmap-post-$i ip saddr set 2.2.2.3 @th,32,32 set 0x302 counter accept;
add element inet osmo-upf tunmap-pre { 2.2.2.3 . 0x$i : jump tunmap-pre-$i };
add element inet osmo-upf tunmap-post { $i : jump tunmap-post-$i };"
	echo $RULESET >> /tmp/batch.nft
done
time nft -f /tmp/batch.nft
