changing regex from extended to perl

This commit is contained in:
ghe0 2025-01-11 23:03:31 +02:00
parent 65126fcdac
commit d8488476c5
Signed by: ghe0
GPG Key ID: 451028EE56A0FBB4

@ -30,8 +30,8 @@ add_nft_rules() {
# TODO: This will handle only one IP per VM. If you add multiple IPs, fix this.
# Also, we wish you good luck. We know this code is complicated. We tried, ok?
ipv4_addr=$(echo $PARAMS | grep -m 1 -oE "detee_net_eth${nic_index}=[0-9]{1,3}\.[0-9a-f\.]+" | cut -d "=" -f2 )
ipv6_addr=$(echo $PARAMS | grep -m 1 -oE "detee_net_eth${nic_index}=[0-9a-f]{1,4}\:[0-9a-f\:]+" | cut -d "=" -f2 )
ipv4_addr=$(echo $PARAMS | grep -m 1 -oP "detee_net_eth${nic_index}=[0-9]{1,3}\.[0-9a-f\.]+" | cut -d "=" -f2 )
ipv6_addr=$(echo $PARAMS | grep -m 1 -oP "detee_net_eth${nic_index}=[0-9a-f]{1,4}\:[0-9a-f\:]+" | cut -d "=" -f2 )
[[ -n "$ipv4_addr" ]] && {
nft add rule netdev deteemacvtap ${ifname}_in ip daddr != $ipv4_addr drop