Permalink
Browse files

NAT setup: do not fail if local route is present

If the system running grml-terminalserver uses the gateway
IP address and it's a local route then the loopback device
is the matching device. This doesn't make any sense for the
NAT setup, therefore skip it.

Without this change the iptables code gets executed with
invalid arguments and is failing.
  • Loading branch information...
1 parent a1d4eea commit 00ee2943bfe06b976cd72b0c4572d00ff9abdbd2 @mika mika committed Sep 11, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 grml-terminalserver-config
@@ -194,8 +194,8 @@ for addresses from 192.168.0.101 to (and including) 192.168.0.200.
NAMESERVERS_=`netGetNameservers warn`
GW_=`netGetDefaultGateway warn`
- GW_DEV_=`/sbin/ip route get "$GW_" | awk '{ print $3; exit; }'`
- if [ "$GW_DEV_" != "$INTERFACE_" ] && [ "$GW_DEV_" != "" ]; then
+ GW_DEV_=`/sbin/ip route get "$GW_" | sed 's/^local //' | awk '{ print $3; exit; }'`
+ if [ "$GW_DEV_" != "$INTERFACE_" ] && [ "$GW_DEV_" != "" ] && [ "$GW_DEV_" != "lo" ]; then
# GW_DEV_ of server is not the same device as the one serviced by dhcpd
# so it doesn't make sense to provide the GW_ address to the clients
local do_nat_="YES"

0 comments on commit 00ee294

Please sign in to comment.