Package: ipmasq
Version: 4.0.2
Severity: minor
Tags: patch

Osaimu,

The examples/routing/* rules don't appear to be working.

This appears to of been introduced with your rewrite of the routing
rules :-(

My routing table looks like:

$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
212.74.111.220  0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
192.168.3.16    192.168.1.2     255.255.255.255 UGH   0      0        0 eth0
192.168.3.15    192.168.1.2     255.255.255.255 UGH   0      0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         212.74.111.220  0.0.0.0         UG    0      0        0 ppp0

bristol:/home/msp# ipmasq
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.

This comes from the line in A01routes.rul

for route in `route -n | grep '^[1-9]'`; do
    IFACE=$( echo $route | { read X X X X X X X Y ; echo $Y ; } )

I don't see how this can work:

bristol:/etc/ipmasq/rules# for route in `route -n | grep '^[1-9]'`; do
echo $route; done
212.74.111.220
0.0.0.0
255.255.255.255
UH
0
0
0
ppp0
192.168.3.16
192.168.1.2
255.255.255.255
UGH
0
0
0
eth0
192.168.3.15
192.168.1.2
255.255.255.255
UGH
0
0
0
eth0
192.168.1.0
0.0.0.0
255.255.255.0
U
0
0
0
eth0

The attached patch corrects ipmasq for routing by reverting to your old
ipmasq-3.5.27 A01route.rul file and also fixes up some other minor
typos.

Mark



--- /usr/share/doc/ipmasq/examples/routes/A01routes.rul 2004-07-28 
21:51:24.000000000 +0100
+++ A01routes.rul       2005-05-18 13:46:53.000000000 +0100
@@ -18,12 +18,12 @@
     return
 }
 
-for route in `route -n | grep '^[1-9]'`; do
-    IFACE=$( echo $route | { read X X X X X X X Y ; echo $Y ; } )
-            if echo $INTERNAL | grep -q $IFACE; then
-                # $IFACE is in $INTERNAL
-                NDEST=$( echo $route | { read Y X X X X X X X ; echo $Y ; } )
-                NMASK=$( echo $route | { read X X Y X X X X X ; echo $Y ; } )
+for route in `route -n | grep '^[1-9]' | sed 's/  */%/g'`; do
+    IFACE=${route##*%}
+    if echo $INTERNAL | grep -q $IFACE; then
+        NDEST=${route%%%*}
+        NMASK=${route#*%*%}
+               NMASK=${NMASK%%%*}
                eval "IPOFIF=\$IPOFIF_$IFACE"
                eval "NMOFIF=\$NMOFIF_$IFACE"
                eval "PEEROFIF=\$PEEROFIF_$IFACE"
--- /usr/share/doc/ipmasq/examples/routes/F31routes.rul 2004-07-27 
20:37:24.000000000 +0100
+++ F31routes.rul       2005-05-18 13:29:45.000000000 +0100
@@ -1,10 +1,10 @@
 #: Forward packets among internal and routed networks
 if [ -n "$ROUTES" ]; then
     for route in $ROUTES; do
-       j=${$route%%:*}
+       j=${route%%:*}
        dest=${route##*:}
        for r in $ROUTES; do 
-           j=${$r%%:*}
+           j=${r%%:*}
            src=${r##*:}
             if [ "$i" != "$j" ]; then
                 case $MASQMETHOD in
--- /usr/share/doc/ipmasq/examples/routes/I31routes.rul 2004-07-27 
20:37:24.000000000 +0100
+++ I31routes.rul       2005-05-18 13:30:00.000000000 +0100
@@ -1,7 +1,7 @@
 #: Allow packets coming from routed networks
 if [ -n "$ROUTES" ]; then
     for route in $ROUTES; do
-       i=${$route%%:*}
+       i=${route%%:*}
        dest=${route##*:}
        case $MASQMETHOD in
        ipfwadm)
--- /usr/share/doc/ipmasq/examples/routes/O31routes.rul 2004-07-27 
20:37:24.000000000 +0100
+++ O31routes.rul       2005-05-18 13:30:26.000000000 +0100
@@ -1,7 +1,7 @@
 #: Allow packets going to routed networks
 if [ -n "$ROUTES" ]; then
     for route in $ROUTES; do
-       i=${$route%%:*}
+       i=${route%%:*}
        dest=${route##*:}
         case $MASQMETHOD in
         ipfwadm)
--- /usr/share/doc/ipmasq/examples/routes/M71masq.rul   2004-07-27 
20:37:24.000000000 +0100
+++ M71masq.rul 2005-05-18 13:30:16.000000000 +0100
@@ -2,7 +2,7 @@
 if [ -n "$ROUTES" -a -n "$EXTERNAL_OUT" ]; then
     for j in $EXTERNAL_OUT; do
         for route in $ROUTES; do
-           i=${$route%%:*}
+           i=${route%%:*}
            dest=${route##*:}
             case $MASQMETHOD in
             ipfwadm)

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.11-1-686
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages ipmasq depends on:
ii  debconf                       1.4.49     Debian configuration management sy
ii  ipchains                      1.3.10-15  Network firewalling for Linux 2.2.
ii  iptables                      1.2.11-10  Linux kernel 2.4+ iptables adminis

-- debconf information:
  ipmasq/external-rules-moved: true
  ipmasq/start-location: After network interfaces are brought up
  ipmasq/dpkg-conffiles:
* ipmasq/ppp-turn-off:
  ipmasq/old-ipmasq.conf: true
  ipmasq/old-rc.boot-file: true
  ipmasq/start: true
  ipmasq/ppp-turn-on:
  ipmasq/move-ipmasq.rules: true
  ipmasq/ppp-recompute: true


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to