]> git.ipfire.org Git - ipfire-2.x.git/blame - src/initscripts/networking/red.up/01-conntrack-cleanup
Merge branch 'next' into initscripts-cleanup
[ipfire-2.x.git] / src / initscripts / networking / red.up / 01-conntrack-cleanup
CommitLineData
f224c3f2
AF
1#!/bin/bash
2############################################################################
3# conntrack-cleanup - remove conntrack entries with the last red ipaddress #
4############################################################################
5#
6
7curr_ip=`cat /var/ipfire/red/local-ipaddress 2>/dev/null`
8last_ip=`cat /var/lock/last-ipaddress 2>/dev/null`
9
10if [ "$curr_ip" == "$last_ip" ]; then
11 exit 0
12fi
13
14if [ -z "$curr_ip" ]; then
15 echo ERROR: cannot read current IP.
16 exit 1
17fi
18
19if [ ! -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
24fi
25echo $curr_ip > /var/lock/last-ipaddress