Hi,

On Sat, Jul 23, 2005 at 03:04:50PM +0200, Osamu Aoki wrote:
> On Tue, Jun 28, 2005 at 07:31:22PM +0200, Frederic LEHOBEY wrote:

> Oops.  Yopu are right.  This could not work.  But I need to confirm few
> things. I have question on this patch. 
> 
> > -            if echo $INTERNAL | grep -q $IFACE; then
> > +            if `echo $INTERNAL | grep -q $IFACE -` ; then
> 
> First, I think grep do not need '-' as file name.  
> My original script should work.  It is testing exit code of grep.
> 
> Can you tell me why this patch?

You are right.  It does not seem to be necessary anymore.  I used it
to get rid of the following error (from my notes, sorry, French
locale) I cannot reproduce anymore (weird, as I was already in stable
sarge):

# invoke-rc.d ipmasq restart
Initializing IP Masquerading...Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
Usage: grep [OPTION]... PATRON [FICHIER]...
Pour en savoir davantage, faites: « grep --help ».
done.

Maybe they were only a consequence of the other typo (solved _after_
this change while investigating).

> > Otherwise, I have the same typos for files I31routes.rul, M71masq.rul
> > and O31routes.rul as original bug submitter (not included).
> 
> Give them to me.

Here they are, in the attachment.

Best regards,
Frederic Lehobey
diff -Naur /usr/share/doc/ipmasq/examples/routes/A01routes.rul 
/tmp/ipmasq-309629/A01routes.rul
--- /usr/share/doc/ipmasq/examples/routes/A01routes.rul 2004-07-28 
22:51:24.000000000 +0200
+++ /tmp/ipmasq-309629/A01routes.rul    2005-07-23 15:38:13.219017768 +0200
@@ -18,7 +18,9 @@
     return
 }
 
-for route in `route -n | grep '^[1-9]'`; do
+routelines=`route -n | grep '^[1-9]'`
+for (( i=1 ; $i <= `echo "$routelines" | wc -l` ; i++ )) do
+    route=`echo "$routelines" | head -n $i | tail -n 1`
     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
diff -Naur /usr/share/doc/ipmasq/examples/routes/F31routes.rul 
/tmp/ipmasq-309629/F31routes.rul
--- /usr/share/doc/ipmasq/examples/routes/F31routes.rul 2004-07-27 
21:37:24.000000000 +0200
+++ /tmp/ipmasq-309629/F31routes.rul    2005-07-23 15:38:13.220017616 +0200
@@ -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%%:*}
+           i=${r%%:*}
            src=${r##*:}
             if [ "$i" != "$j" ]; then
                 case $MASQMETHOD in
diff -Naur /usr/share/doc/ipmasq/examples/routes/I31routes.rul 
/tmp/ipmasq-309629/I31routes.rul
--- /usr/share/doc/ipmasq/examples/routes/I31routes.rul 2004-07-27 
21:37:24.000000000 +0200
+++ /tmp/ipmasq-309629/I31routes.rul    2005-07-23 15:38:13.220017616 +0200
@@ -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)
diff -Naur /usr/share/doc/ipmasq/examples/routes/M71masq.rul 
/tmp/ipmasq-309629/M71masq.rul
--- /usr/share/doc/ipmasq/examples/routes/M71masq.rul   2004-07-27 
21:37:24.000000000 +0200
+++ /tmp/ipmasq-309629/M71masq.rul      2005-07-23 15:38:13.221017464 +0200
@@ -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)
diff -Naur /usr/share/doc/ipmasq/examples/routes/O31routes.rul 
/tmp/ipmasq-309629/O31routes.rul
--- /usr/share/doc/ipmasq/examples/routes/O31routes.rul 2004-07-27 
21:37:24.000000000 +0200
+++ /tmp/ipmasq-309629/O31routes.rul    2005-07-23 15:38:13.221017464 +0200
@@ -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)

Reply via email to