diff --git a/Shorewall-common/diff-3.4-lib.base b/Shorewall-common/diff-3.4-lib.base index b0312c579..34f44638f 100644 --- a/Shorewall-common/diff-3.4-lib.base +++ b/Shorewall-common/diff-3.4-lib.base @@ -1,7 +1,33 @@ ---- /home/teastep/shorewall/branches/3.4/Shorewall/lib.base 2007-06-17 14:36:04.000000000 -0700 -+++ lib.base 2007-06-18 13:22:05.000000000 -0700 -@@ -28,13 +28,13 @@ - # and /usr/share/shorewall-lite/shorecap. +--- /home/teastep/shorewall/branches/3.4/Shorewall/lib.base 2007-06-17 14:30:30.000000000 -0700 ++++ lib.base 2007-07-22 06:29:50.000000000 -0700 +@@ -1,6 +1,6 @@ + #!/bin/sh + # +-# Shorewall 3.4 -- /usr/share/shorewall/lib.base ++# Shorewall 4.0 -- /usr/share/shorewall/lib.base + # + # This program is under GPL [http://www.gnu.org/copyleft/gpl.htm] + # +@@ -21,20 +21,26 @@ + # along with this program; if not, write to the Free Software + # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA + # +-# This library contains the code common to all Shorewall components. It is copied into +-# the compiled script with the -e compiler flag is specified and is loaded by +-# /sbin/shorewall, /usr/share/shorewall/compiler and /usr/share/shorewall/firewall. It +-# is also released as part of Shorewall Lite where it is used by /sbin/shorewall-lite +-# and /usr/share/shorewall-lite/shorecap. ++# This library contains the code common to all Shorewall components. ++# ++# - It is copied into the compiled script with the -e compiler flag is specified to ++# shorewall-shell. ++# - It is loaded by /sbin/shorewall. ++# - It is loaded by /usr/share/shorewall/firewall. ++# - It is loaded by /usr/share/shorewall-shell/compiler. ++# - It is released as part of Shorewall Lite where it is used by /sbin/shorewall-lite ++# and /usr/share/shorewall-lite/shorecap. ++# - It is released as part of Shorewall Perl where it is copied into the compiled script ++# by the compiler. # -SHOREWALL_LIBVERSION=30404 @@ -16,7 +42,7 @@ PERLSHAREDIR=/usr/share/shorewall-perl # -@@ -360,6 +360,8 @@ +@@ -360,6 +366,8 @@ eval loaded=\$LIB_${1}_LOADED if [ -z "$loaded" ]; then @@ -25,3 +51,97 @@ if [ -f $lib ]; then progress_message "Loading library $lib..." . $lib +@@ -380,7 +388,7 @@ + + # + # Note: The following set of IP address manipulation functions have anomalous +-# behavior when the shell only supports 32-bit signed arithmatic and ++# behavior when the shell only supports 32-bit signed arithmetic and + # the IP address is 128.0.0.0 or 128.0.0.1. + # + +@@ -692,7 +700,7 @@ + # + + find_rt_interface() { +- ip route ls | while read addr rest; do ++ ip route list | while read addr rest; do + case $addr in + */*) + in_network ${1%/*} $addr && echo $(find_device $rest) +@@ -713,14 +721,14 @@ + + find_nexthop() # $1 = interface + { +- echo $(find_gateway `ip route ls | grep "[[:space:]]nexthop.* $1"`) ++ echo $(find_gateway `ip route list | grep "[[:space:]]nexthop.* $1"`) + } + + # + # Find the default route's interface + # + find_default_interface() { +- ip route ls | while read first rest; do ++ ip route list | while read first rest; do + [ "$first" = default ] && echo $(find_device $rest) && return + done + } +@@ -746,7 +754,7 @@ + find_interface_by_mac() { + local mac=$1 first second rest dev + +- ip link ls | while read first second rest; do ++ ip link list | while read first second rest; do + case $first in + *:) + dev=$second +@@ -764,7 +772,7 @@ + # Determine if Interface is up + # + interface_is_up() { +- [ -n "$(ip link ls dev $1 2> /dev/null | grep -e '[<,]UP[,>]')" ] ++ [ -n "$(ip link list dev $1 2> /dev/null | grep -e '[<,]UP[,>]')" ] + } + + # +@@ -1232,11 +1240,11 @@ + # + # First assume that this is some sort of point-to-point interface + # +- gateway=$( find_peer $(ip addr ls $interface ) ) ++ gateway=$( find_peer $(ip addr list $interface ) ) + # + # Maybe there's a default route through this gateway already + # +- [ -n "$gateway" ] || gateway=$(find_gateway $(ip route ls dev $interface)) ++ [ -n "$gateway" ] || gateway=$(find_gateway $(ip route list dev $interface)) + # + # Last hope -- is there a load-balancing route through the interface? + # +@@ -1251,7 +1259,7 @@ + # Disable IPV6 + # + disable_ipv6() { +- local foo="$(ip -f inet6 addr ls 2> /dev/null)" ++ local foo="$(ip -f inet6 addr list 2> /dev/null)" + + if [ -n "$foo" ]; then + if qt mywhich ip6tables; then +@@ -1381,7 +1389,7 @@ + # + get_device_mtu() # $1 = device + { +- local output="$(ip link ls dev $1 2> /dev/null)" # quotes required for /bin/ash ++ local output="$(ip link list dev $1 2> /dev/null)" # quotes required for /bin/ash + + if [ -n "$output" ]; then + echo $(find_mtu $output) +@@ -1396,7 +1404,7 @@ + # + get_device_mtu1() # $1 = device + { +- local output="$(ip link ls dev $1 2> /dev/null)" # quotes required for /bin/ash ++ local output="$(ip link list dev $1 2> /dev/null)" # quotes required for /bin/ash + local mtu + + if [ -n "$output" ]; then diff --git a/Shorewall-common/diff-3.4-lib.cli b/Shorewall-common/diff-3.4-lib.cli new file mode 100644 index 000000000..001565c42 --- /dev/null +++ b/Shorewall-common/diff-3.4-lib.cli @@ -0,0 +1,65 @@ +--- /home/teastep/shorewall/branches/3.4/Shorewall/lib.cli 2007-06-28 17:05:43.000000000 -0700 ++++ lib.cli 2007-07-22 06:29:50.000000000 -0700 +@@ -1,6 +1,6 @@ + #!/bin/sh + # +-# Shorewall 3.4 -- /usr/share/shorewall/lib.cli. ++# Shorewall 4.0 -- /usr/share/shorewall/lib.cli. + # + # This program is under GPL [http://www.gnu.org/copyleft/gpl.htm] + # +@@ -363,18 +363,18 @@ + # Show routing configuration + # + show_routing() { +- if [ -n "$(ip rule ls)" ]; then ++ if [ -n "$(ip rule list)" ]; then + heading "Routing Rules" +- ip rule ls +- ip rule ls | while read rule; do ++ ip rule list ++ ip rule list | while read rule; do + echo ${rule##* } + done | sort -u | while read table; do + heading "Table $table:" +- ip route ls table $table ++ ip route list table $table + done + else + heading "Routing Table" +- ip route ls ++ ip route list + fi + } + +@@ -530,7 +530,7 @@ + [ $# -gt 1 ] && usage 1 + echo "$PRODUCT $version IP at $HOSTNAME - $(date)" + echo +- ip addr ls ++ ip addr list + ;; + routing) + [ $# -gt 1 ] && usage 1 +@@ -541,7 +541,7 @@ + config) + . ${SHAREDIR}/configpath + echo "Default CONFIG_PATH is $CONFIG_PATH" +- echo "LITEDIR is $LITEDIR" ++ [ -n "$LITEDIR" ] && echo "LITEDIR is $LITEDIR" + ;; + chain) + shift +@@ -697,10 +697,10 @@ + [ -f /proc/net/ip_conntrack ] && cat /proc/net/ip_conntrack || cat /proc/net/nf_conntrack + + heading "IP Configuration" +- ip addr ls ++ ip addr list + + heading "IP Stats" +- ip -stat link ls ++ ip -stat link list + + if qt mywhich brctl; then + heading "Bridges" diff --git a/Shorewall-common/lib.base b/Shorewall-common/lib.base index de6f37ec6..6bf92ae83 100644 --- a/Shorewall-common/lib.base +++ b/Shorewall-common/lib.base @@ -700,7 +700,7 @@ find_peer() { # find_rt_interface() { - ip route ls | while read addr rest; do + ip route list | while read addr rest; do case $addr in */*) in_network ${1%/*} $addr && echo $(find_device $rest) @@ -721,14 +721,14 @@ find_rt_interface() { find_nexthop() # $1 = interface { - echo $(find_gateway `ip route ls | grep "[[:space:]]nexthop.* $1"`) + echo $(find_gateway `ip route list | grep "[[:space:]]nexthop.* $1"`) } # # Find the default route's interface # find_default_interface() { - ip route ls | while read first rest; do + ip route list | while read first rest; do [ "$first" = default ] && echo $(find_device $rest) && return done } @@ -754,7 +754,7 @@ find_interface_by_address() { find_interface_by_mac() { local mac=$1 first second rest dev - ip link ls | while read first second rest; do + ip link list | while read first second rest; do case $first in *:) dev=$second @@ -772,7 +772,7 @@ find_interface_by_mac() { # Determine if Interface is up # interface_is_up() { - [ -n "$(ip link ls dev $1 2> /dev/null | grep -e '[<,]UP[,>]')" ] + [ -n "$(ip link list dev $1 2> /dev/null | grep -e '[<,]UP[,>]')" ] } # @@ -1240,11 +1240,11 @@ detect_gateway() # $1 = interface # # First assume that this is some sort of point-to-point interface # - gateway=$( find_peer $(ip addr ls $interface ) ) + gateway=$( find_peer $(ip addr list $interface ) ) # # Maybe there's a default route through this gateway already # - [ -n "$gateway" ] || gateway=$(find_gateway $(ip route ls dev $interface)) + [ -n "$gateway" ] || gateway=$(find_gateway $(ip route list dev $interface)) # # Last hope -- is there a load-balancing route through the interface? # @@ -1259,7 +1259,7 @@ detect_gateway() # $1 = interface # Disable IPV6 # disable_ipv6() { - local foo="$(ip -f inet6 addr ls 2> /dev/null)" + local foo="$(ip -f inet6 addr list 2> /dev/null)" if [ -n "$foo" ]; then if qt mywhich ip6tables; then @@ -1389,7 +1389,7 @@ delete_tc1() # get_device_mtu() # $1 = device { - local output="$(ip link ls dev $1 2> /dev/null)" # quotes required for /bin/ash + local output="$(ip link list dev $1 2> /dev/null)" # quotes required for /bin/ash if [ -n "$output" ]; then echo $(find_mtu $output) @@ -1404,7 +1404,7 @@ get_device_mtu() # $1 = device # get_device_mtu1() # $1 = device { - local output="$(ip link ls dev $1 2> /dev/null)" # quotes required for /bin/ash + local output="$(ip link list dev $1 2> /dev/null)" # quotes required for /bin/ash local mtu if [ -n "$output" ]; then diff --git a/Shorewall-common/lib.cli b/Shorewall-common/lib.cli index bc92a508b..f8add9542 100644 --- a/Shorewall-common/lib.cli +++ b/Shorewall-common/lib.cli @@ -363,18 +363,18 @@ save_config() { # Show routing configuration # show_routing() { - if [ -n "$(ip rule ls)" ]; then + if [ -n "$(ip rule list)" ]; then heading "Routing Rules" - ip rule ls - ip rule ls | while read rule; do + ip rule list + ip rule list | while read rule; do echo ${rule##* } done | sort -u | while read table; do heading "Table $table:" - ip route ls table $table + ip route list table $table done else heading "Routing Table" - ip route ls + ip route list fi } @@ -530,7 +530,7 @@ show_command() { [ $# -gt 1 ] && usage 1 echo "$PRODUCT $version IP at $HOSTNAME - $(date)" echo - ip addr ls + ip addr list ;; routing) [ $# -gt 1 ] && usage 1 @@ -697,10 +697,10 @@ dump_command() { [ -f /proc/net/ip_conntrack ] && cat /proc/net/ip_conntrack || cat /proc/net/nf_conntrack heading "IP Configuration" - ip addr ls + ip addr list heading "IP Stats" - ip -stat link ls + ip -stat link list if qt mywhich brctl; then heading "Bridges" diff --git a/Shorewall-perl/Shorewall/Providers.pm b/Shorewall-perl/Shorewall/Providers.pm index 6279171eb..31f0141a7 100644 --- a/Shorewall-perl/Shorewall/Providers.pm +++ b/Shorewall-perl/Shorewall/Providers.pm @@ -375,7 +375,7 @@ sub setup_providers() { '#', '# Capture the default route(s) if we don\'t have it (them) already.', '#', - '[ -f ${VARDIR}/default_route ] || ip route ls | grep -E \'^\s*(default |nexthop )\' > ${VARDIR}/default_route', + '[ -f ${VARDIR}/default_route ] || ip route list | grep -E \'^\s*(default |nexthop )\' > ${VARDIR}/default_route', '#', '# Initialize the file that holds \'undo\' commands', '#', diff --git a/Shorewall-perl/diff-4.0-lib.base b/Shorewall-perl/diff-4.0-lib.base index 48b475bb8..323aaf235 100644 --- a/Shorewall-perl/diff-4.0-lib.base +++ b/Shorewall-perl/diff-4.0-lib.base @@ -1,5 +1,5 @@ ---- ../Shorewall-common/lib.base 2007-07-02 15:50:32.000000000 -0700 -+++ prog.header 2007-07-04 09:32:31.000000000 -0700 +--- ../Shorewall-common/lib.base 2007-07-22 06:29:50.000000000 -0700 ++++ prog.header 2007-07-22 06:29:50.000000000 -0700 @@ -1,48 +1,27 @@ -#!/bin/sh -# @@ -171,7 +171,7 @@ - -# # Note: The following set of IP address manipulation functions have anomalous - # behavior when the shell only supports 32-bit signed arithmatic and + # behavior when the shell only supports 32-bit signed arithmetic and # the IP address is 128.0.0.0 or 128.0.0.1. @@ -395,32 +283,6 @@ LEFTSHIFT='<<' diff --git a/Shorewall-perl/prog.header b/Shorewall-perl/prog.header index 6eb294357..c64148b91 100644 --- a/Shorewall-perl/prog.header +++ b/Shorewall-perl/prog.header @@ -426,7 +426,7 @@ find_peer() { # find_rt_interface() { - ip route ls | while read addr rest; do + ip route list | while read addr rest; do case $addr in */*) in_network ${1%/*} $addr && echo $(find_device $rest) @@ -447,14 +447,14 @@ find_rt_interface() { find_nexthop() # $1 = interface { - echo $(find_gateway `ip route ls | grep "[[:space:]]nexthop.* $1"`) + echo $(find_gateway `ip route list | grep "[[:space:]]nexthop.* $1"`) } # # Find the default route's interface # find_default_interface() { - ip route ls | while read first rest; do + ip route list | while read first rest; do [ "$first" = default ] && echo $(find_device $rest) && return done } @@ -480,7 +480,7 @@ find_interface_by_address() { find_interface_by_mac() { local mac=$1 first second rest dev - ip link ls | while read first second rest; do + ip link list | while read first second rest; do case $first in *:) dev=$second @@ -498,7 +498,7 @@ find_interface_by_mac() { # Determine if Interface is up # interface_is_up() { - [ -n "$(ip link ls dev $1 2> /dev/null | grep -e '[<,]UP[,>]')" ] + [ -n "$(ip link list dev $1 2> /dev/null | grep -e '[<,]UP[,>]')" ] } # @@ -709,11 +709,11 @@ detect_gateway() # $1 = interface # # First assume that this is some sort of point-to-point interface # - gateway=$( find_peer $(ip addr ls $interface ) ) + gateway=$( find_peer $(ip addr list $interface ) ) # # Maybe there's a default route through this gateway already # - [ -n "$gateway" ] || gateway=$(find_gateway $(ip route ls dev $interface)) + [ -n "$gateway" ] || gateway=$(find_gateway $(ip route list dev $interface)) # # Last hope -- is there a load-balancing route through the interface? # @@ -728,7 +728,7 @@ detect_gateway() # $1 = interface # Disable IPV6 # disable_ipv6() { - local foo="$(ip -f inet6 addr ls 2> /dev/null)" + local foo="$(ip -f inet6 addr list 2> /dev/null)" if [ -n "$foo" ]; then if qt mywhich ip6tables; then @@ -782,7 +782,7 @@ delete_tc1() # get_device_mtu() # $1 = device { - local output="$(ip link ls dev $1 2> /dev/null)" # quotes required for /bin/ash + local output="$(ip link list dev $1 2> /dev/null)" # quotes required for /bin/ash if [ -n "$output" ]; then echo $(find_mtu $output) @@ -797,7 +797,7 @@ get_device_mtu() # $1 = device # get_device_mtu1() # $1 = device { - local output="$(ip link ls dev $1 2> /dev/null)" # quotes required for /bin/ash + local output="$(ip link list dev $1 2> /dev/null)" # quotes required for /bin/ash local mtu if [ -n "$output" ]; then diff --git a/Shorewall-shell/lib.providers b/Shorewall-shell/lib.providers index 0e6bd5a87..ddf0dc741 100644 --- a/Shorewall-shell/lib.providers +++ b/Shorewall-shell/lib.providers @@ -339,7 +339,7 @@ cp /etc/iproute2/rt_tables \${VARDIR}/ # # Capture the default route(s) if we don't have it (them) already. # -[ -f \${VARDIR}/default_route ] || ip route ls | grep -E '^\s*(default |nexthop )' > \${VARDIR}/default_route +[ -f \${VARDIR}/default_route ] || ip route list | grep -E '^\s*(default |nexthop )' > \${VARDIR}/default_route # # Initialize the file that holds 'undo' commands #