Hi Tom

> Here is a lightly-tested patch against the current master branch.

Thanks for looking at this.  My timings to run your patched version drop 
from around 2 seconds to:

$ time /var/lib/shorewall/firewall enable ppp0
Device "wlan2" does not exist.
Cannot find device "wlan2"
Device "wlan3" does not exist.
Cannot find device "wlan3"
Device "lan4" does not exist.
Cannot find device "lan4"
Device "lan3" does not exist.
Cannot find device "lan3"
real    0m 0.99s
user    0m 0.21s
sys    0m 0.50s

This is a big improvement, but I wonder if you would be willing to also 
wrap the other parts of the detect_configuration tests with a conditional?

I realise now I didn't provide enough information. My interfaces all 
have "detect" on the gateway.  So this seems to make my 
detect_configuration look as below, I hadn't realised, but from the 
code, I think these extra "find_first_interface_address" calls, etc 
aren't there in all possible situations For me they are around 70% of 
the remaining runtime?


detect_configuration()
{
     SW_LAN4_ADDRESS=$(find_first_interface_address_if_any lan4)

     SW_LAN3_ADDRESS=$(find_first_interface_address_if_any lan3)

     SW_LAN2_ADDRESS=$(find_first_interface_address_if_any lan2)

     SW_LAN1_ADDRESS=$(find_first_interface_address_if_any lan1)

     SW_WLAN1_ADDRESS=$(find_first_interface_address_if_any wlan1)

     SW_WLAN2_ADDRESS=$(find_first_interface_address_if_any wlan2)

     SW_WLAN3_ADDRESS=$(find_first_interface_address_if_any wlan3)

     [ -n "$SW_WLAN2_GATEWAY" ] || SW_WLAN2_GATEWAY=$(detect_gateway wlan2)

     [ -n "$SW_WLAN3_GATEWAY" ] || SW_WLAN3_GATEWAY=$(detect_gateway wlan3)

     [ -n "$SW_WLAN1_GATEWAY" ] || SW_WLAN1_GATEWAY=$(detect_gateway wlan1)

     [ -n "$SW_LAN1_GATEWAY" ] || SW_LAN1_GATEWAY=$(detect_gateway lan1)

     [ -n "$SW_LAN2_GATEWAY" ] || SW_LAN2_GATEWAY=$(detect_gateway lan2)

     [ -n "$SW_LAN4_GATEWAY" ] || SW_LAN4_GATEWAY=$(detect_gateway lan4)

     [ -n "$SW_LAN3_GATEWAY" ] || SW_LAN3_GATEWAY=$(detect_gateway lan3)

     SW_LAN1_IS_USABLE=
     SW_LAN2_IS_USABLE=
     SW_LAN3_IS_USABLE=
     SW_LAN4_IS_USABLE=
     SW_WLAN1_IS_USABLE=
     SW_WLAN2_IS_USABLE=
     SW_WLAN3_IS_USABLE=
     SW_PPP0_IS_USABLE=
     SW_PPP1_IS_USABLE=
     SW_PPP2_IS_USABLE=
     SW_PPP3_IS_USABLE=
     SW_PPP10_IS_USABLE=
     SW_PPP11_IS_USABLE=
     SW_PPP12_IS_USABLE=
     SW_PPP13_IS_USABLE=

     if [ -z "$1" -o "$1" = "lan1" -o "$1" = "plan1" ]; then
         if interface_is_usable lan1 && [ -n "$SW_LAN1_GATEWAY" ]; then
             SW_LAN1_IS_USABLE=Yes
         fi
     fi
     if [ -z "$1" -o "$1" = "lan2" -o "$1" = "plan2" ]; then
         if interface_is_usable lan2 && [ -n "$SW_LAN2_GATEWAY" ]; then
             SW_LAN2_IS_USABLE=Yes
         fi
     fi
     if [ -z "$1" -o "$1" = "lan3" -o "$1" = "plan3" ]; then
         if interface_is_usable lan3 && [ -n "$SW_LAN3_GATEWAY" ]; then
             SW_LAN3_IS_USABLE=Yes
         fi
     fi
     if [ -z "$1" -o "$1" = "lan4" -o "$1" = "plan4" ]; then
         if interface_is_usable lan4 && [ -n "$SW_LAN4_GATEWAY" ]; then
             SW_LAN4_IS_USABLE=Yes
         fi
     fi
     if [ -z "$1" -o "$1" = "wlan1" -o "$1" = "pwlan1" ]; then
         if interface_is_usable wlan1 && [ -n "$SW_WLAN1_GATEWAY" ]; then
             SW_WLAN1_IS_USABLE=Yes
         fi
     fi
     if [ -z "$1" -o "$1" = "wlan2" -o "$1" = "pwlan2" ]; then
         if interface_is_usable wlan2 && [ -n "$SW_WLAN2_GATEWAY" ]; then
             SW_WLAN2_IS_USABLE=Yes
         fi
     fi
     if [ -z "$1" -o "$1" = "wlan3" -o "$1" = "pwlan3" ]; then
         if interface_is_usable wlan3 && [ -n "$SW_WLAN3_GATEWAY" ]; then
             SW_WLAN3_IS_USABLE=Yes
         fi
     fi
     if [ -z "$1" -o "$1" = "ppp0" -o "$1" = "pppp0" ]; then
         if interface_is_usable ppp0; then
             SW_PPP0_IS_USABLE=Yes
         fi
     fi
     if [ -z "$1" -o "$1" = "ppp1" -o "$1" = "pppp1" ]; then
         if interface_is_usable ppp1; then
             SW_PPP1_IS_USABLE=Yes
         fi
     fi
     if [ -z "$1" -o "$1" = "ppp2" -o "$1" = "pppp2" ]; then
         if interface_is_usable ppp2; then
             SW_PPP2_IS_USABLE=Yes
         fi
     fi
     if [ -z "$1" -o "$1" = "ppp3" -o "$1" = "pppp3" ]; then
         if interface_is_usable ppp3; then
             SW_PPP3_IS_USABLE=Yes
         fi
     fi
     if [ -z "$1" -o "$1" = "ppp10" -o "$1" = "pppp10" ]; then
         if interface_is_usable ppp10; then
             SW_PPP10_IS_USABLE=Yes
         fi
     fi
     if [ -z "$1" -o "$1" = "ppp11" -o "$1" = "pppp11" ]; then
         if interface_is_usable ppp11; then
             SW_PPP11_IS_USABLE=Yes
         fi
     fi
     if [ -z "$1" -o "$1" = "ppp12" -o "$1" = "pppp12" ]; then
         if interface_is_usable ppp12; then
             SW_PPP12_IS_USABLE=Yes
         fi
     fi
     if [ -z "$1" -o "$1" = "ppp13" -o "$1" = "pppp13" ]; then
         if interface_is_usable ppp13; then
             SW_PPP13_IS_USABLE=Yes
         fi
     fi

}


Thanks!

Ed W

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Shorewall-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/shorewall-devel

Reply via email to