On 08/15/2012 09:57 PM, Alan Yaryzhenko wrote:
Hi all.

I  use router/firewall based on Centos 6.2 which connected to two ISPs
via eth and ppp interfaces. I use shorewall 4.5.4
When  i  try  to  enable  ISP  connected  to  ppp interface (which was
previously disabled by 'shorewall disable ...' command) shorewal shows
an error. The piece of trace is here:

---
++ echo ppp0
++ return
+ dev=ppp0
+ '[' -f /var/lib/shorewall/ppp0_weight ']'
++ cat /var/lib/shorewall/ppp0_weight
+ weight=4
+ route='dev ppp0 weight 4' ********
+ run_ip route replace default scope global table 254 dev ppp0 weight 4 nexthop 
via 81.23.192.113 dev eth1 weight 1
+ ip -4 route replace default scope global table 254 dev ppp0 weight 4 nexthop 
via 81.23.192.113 dev eth1 weight 1
Error: either "to" is duplicate, or "weight" is a garbage.
---

iproute needs 'nexthop' keyword before 'dev ppp0'.

I    wrote    a    little   patch,  which  works for my case. I hope, i
didn't mistake so much.

Hi Alan,

Thanks for the patch. While it works in the particular case that you tried, I don't think that it works correctly if you try 'shorewall disable eth1; shorewall enable eth1'.

Please try the attached alternative patch.

Thanks!
-Tom
--
Tom Eastep        \ When I die, I want to go like my Grandfather who
Shoreline,         \ died peacefully in his sleep. Not screaming like
Washington, USA     \ all of the passengers in his car
http://shorewall.net \________________________________________________


diff --git a/Shorewall/Perl/lib.core b/Shorewall/Perl/lib.core
index 3a3167d..ea554a6 100644
--- a/Shorewall/Perl/lib.core
+++ b/Shorewall/Perl/lib.core
@@ -916,7 +916,12 @@ add_gateway() # $1 = Delta $2 = Table Number
 	delta=$1
 
 	if ! echo $route | fgrep -q ' nexthop '; then
-	    route=`echo $route | sed 's/via/nexthop via/'`
+	    if echo $route | fgrep -q via; then
+		route=`echo $route | sed 's/via/nexthop via/'`
+	    else
+		route="nexthop $route"
+	    fi
+
 	    dev=$(find_device $route)
 	    if [ -f ${VARDIR}/${dev}_weight ]; then
 		weight=`cat ${VARDIR}/${dev}_weight`
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Shorewall-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/shorewall-users

Reply via email to