Project

General

Profile

Feature #6394 » upf-add-tunnels.sh

pablo, 03/19/2024 10:54 AM

 
1
#!/bin/bash
2

    
3
rm -f /tmp/batch.nft
4
for ((i=0;i<100000;i++))
5
do
6
	RULESET="add chain inet osmo-upf tunmap-pre-$i;
7
add rule inet osmo-upf tunmap-pre-$i ip daddr set 3.3.3.3 meta mark set $i counter accept;
8
add chain inet osmo-upf tunmap-post-$i;
9
add rule inet osmo-upf tunmap-post-$i ip saddr set 2.2.2.3 @th,32,32 set 0x302 counter accept;
10
add element inet osmo-upf tunmap-pre { 2.2.2.3 . 0x$i : jump tunmap-pre-$i };
11
add element inet osmo-upf tunmap-post { $i : jump tunmap-post-$i };"
12
	echo $RULESET >> /tmp/batch.nft
13
done
14
time nft -f /tmp/batch.nft
(1-1/3)
Add picture from clipboard (Maximum size: 48.8 MB)