diff options
author | Carl Byington <carl@five-ten-sg.com> | 2015-05-08 09:39:54 -0700 |
---|---|---|
committer | Alex Harpin <development@landsofshadow.co.uk> | 2015-11-09 21:36:27 +0000 |
commit | 6284929fb9b7714a0da1098575422da56a1519a8 (patch) | |
tree | caf493cf31863c52d450b1434be2fedac8c62e35 /templates | |
parent | c1befdd98a8f2cc3245f6423828cf18f2ba2c07b (diff) | |
download | vyatta-cfg-quagga-6284929fb9b7714a0da1098575422da56a1519a8.tar.gz vyatta-cfg-quagga-6284929fb9b7714a0da1098575422da56a1519a8.zip |
avoid routing thru 127.0.0.1
Signed-off-by: Alex Harpin <development@landsofshadow.co.uk>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/protocols/static/route/node.tag/dhcp-interface/node.def | 12 | ||||
-rw-r--r-- | templates/protocols/static/table/node.tag/route/node.tag/dhcp-interface/node.def | 24 |
2 files changed, 24 insertions, 12 deletions
diff --git a/templates/protocols/static/route/node.tag/dhcp-interface/node.def b/templates/protocols/static/route/node.tag/dhcp-interface/node.def index 4942bf5f..3952233d 100644 --- a/templates/protocols/static/route/node.tag/dhcp-interface/node.def +++ b/templates/protocols/static/route/node.tag/dhcp-interface/node.def @@ -7,13 +7,17 @@ allowed: create: sudo /opt/vyatta/sbin/vyatta-update-static-route.pl --interface=$VAR(@) --route=$VAR(../@) --table=main --option=create RIP=$(/opt/vyatta/sbin/vyatta-dhcp-helper.pl --interface=$VAR(@) --want=router) - vtysh -c "configure terminal" \ - -c "ip route $VAR(../@) $RIP" + if [ "$RIP" != "127.0.0.1" ]; then + vtysh -c "configure terminal" \ + -c "ip route $VAR(../@) $RIP" + fi update: sudo /opt/vyatta/sbin/vyatta-update-static-route.pl --interface=$VAR(@) --route=$VAR(../@) --table=main --option=create RIP=$(/opt/vyatta/sbin/vyatta-dhcp-helper.pl --interface=$VAR(@) --want=router) - vtysh -c "configure terminal" \ - -c "ip route $VAR(../@) $RIP" + if [ "$RIP" != "127.0.0.1" ]; then + vtysh -c "configure terminal" \ + -c "ip route $VAR(../@) $RIP" + fi delete: sudo /opt/vyatta/sbin/vyatta-update-static-route.pl --interface=$VAR(@) --route=$VAR(../@) --table=main --option=delete RIP=$(/opt/vyatta/sbin/vyatta-dhcp-helper.pl --interface=$VAR(@) --want=router) diff --git a/templates/protocols/static/table/node.tag/route/node.tag/dhcp-interface/node.def b/templates/protocols/static/table/node.tag/route/node.tag/dhcp-interface/node.def index a1b1d08c..cef919eb 100644 --- a/templates/protocols/static/table/node.tag/route/node.tag/dhcp-interface/node.def +++ b/templates/protocols/static/table/node.tag/route/node.tag/dhcp-interface/node.def @@ -10,12 +10,16 @@ create: table="$VAR(../../@)" sudo /opt/vyatta/sbin/vyatta-update-static-route.pl --interface=$ifc --route=$route --table=$table --option=create RIP=$(/opt/vyatta/sbin/vyatta-dhcp-helper.pl --interface=$ifc --want=router) - vtysh -c "configure terminal" \ - -c "ip route $route $RIP table $table" + if [ "$RIP" != "127.0.0.1" ]; then + vtysh -c "configure terminal" \ + -c "ip route $route $RIP table $table" + fi if [ "$route" == "0.0.0.0/0" ]; then LIP=$(/opt/vyatta/sbin/vyatta-dhcp-helper.pl --interface=$ifc --want=local) - MARK=$(dc 0x7fffffff $table + p) - sudo /sbin/iptables -t mangle -A OUTPUT -s $LIP/32 -j MARK --set-mark $MARK + if [ "$LIP" != "127.0.0.1" ]; then + MARK=$(dc 0x7fffffff $table + p) + sudo /sbin/iptables -t mangle -I OUTPUT -s $LIP/32 -j MARK --set-mark $MARK + fi fi update: ifc="$VAR(@)" @@ -23,12 +27,16 @@ update: table="$VAR(../../@)" sudo /opt/vyatta/sbin/vyatta-update-static-route.pl --interface=$ifc --route=$route --table=$table --option=create RIP=$(/opt/vyatta/sbin/vyatta-dhcp-helper.pl --interface=$ifc --want=router) - vtysh -c "configure terminal" \ - -c "ip route $route $RIP table $table" + if [ "$RIP" != "127.0.0.1" ]; then + vtysh -c "configure terminal" \ + -c "ip route $route $RIP table $table" + fi if [ "$route" == "0.0.0.0/0" ]; then LIP=$(/opt/vyatta/sbin/vyatta-dhcp-helper.pl --interface=$ifc --want=local) - MARK=$(dc 0x7fffffff $table + p) - sudo /sbin/iptables -t mangle -A OUTPUT -s $LIP/32 -j MARK --set-mark $MARK + if [ "$LIP" != "127.0.0.1" ]; then + MARK=$(dc 0x7fffffff $table + p) + sudo /sbin/iptables -t mangle -I OUTPUT -s $LIP/32 -j MARK --set-mark $MARK + fi fi delete: ifc="$VAR(@)" |