]> git.ipfire.org Git - ipfire-2.x.git/blob - src/initscripts/networking/red.up/01-conntrack-cleanup
kernel: update to 4.14.110
[ipfire-2.x.git] / src / initscripts / networking / red.up / 01-conntrack-cleanup
1 #!/bin/bash
2 ############################################################################
3 # conntrack-cleanup - remove conntrack entries with the last red ipaddress #
4 ############################################################################
5 #
6
7 curr_ip=`cat /var/ipfire/red/local-ipaddress 2>/dev/null`
8 last_ip=`cat /var/lock/last-ipaddress 2>/dev/null`
9
10 if [ "$curr_ip" == "$last_ip" ]; then
11 exit 0
12 fi
13
14 if [ -z "$curr_ip" ]; then
15 echo ERROR: cannot read current IP.
16 exit 1
17 fi
18
19 if [ ! -z "$last_ip" ]; then
20 conntrack -D -s $last_ip 2>&1 > /dev/null
21 conntrack -D -d $last_ip 2>&1 > /dev/null
22 conntrack -D -r $last_ip 2>&1 > /dev/null
23 conntrack -D -q $last_ip 2>&1 > /dev/null
24 fi
25 echo $curr_ip > /var/lock/last-ipaddress