"Fossies" - the Fresh Open Source Software Archive

Member "ipfire-2.x-2.27-core174/src/initscripts/networking/red.up/01-conntrack-cleanup" (7 Apr 2023, 727 Bytes) of package /linux/misc/ipfire-2.x-2.27-core174.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    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