From root@fgmusic.org  Tue May 27 19:09:23 2003
Return-Path: <root@fgmusic.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 46E4537B401
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 27 May 2003 19:09:23 -0700 (PDT)
Received: from fgmusic.org (adsl-64-108-0-99.dsl.clevoh.ameritech.net [64.108.0.99])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 2C2F243F3F
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 27 May 2003 19:09:22 -0700 (PDT)
	(envelope-from root@fgmusic.org)
Received: from fgmusic.org (localhost [127.0.0.1])
	by fgmusic.org (8.12.8p1/8.12.6) with ESMTP id h4S29KVH000363
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 27 May 2003 21:09:20 -0500 (CDT)
	(envelope-from root@fgmusic.org)
Received: (from root@localhost)
	by fgmusic.org (8.12.8p1/8.12.6/Submit) id h4S29K0j000362;
	Tue, 27 May 2003 21:09:20 -0500 (CDT)
Message-Id: <200305280209.h4S29K0j000362@fgmusic.org>
Date: Tue, 27 May 2003 21:09:20 -0500 (CDT)
From: Felipe Gasper <fgasper@uiuc.edu>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: /etc/ppp/ppp.linkup instability issues	
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         52743
>Category:       bin
>Synopsis:       ppp(8) /etc/ppp/ppp.linkup instability issues
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 27 19:10:05 PDT 2003
>Closed-Date:    
>Last-Modified:  Sat May 24 17:57:02 UTC 2008
>Originator:     Felipe Gasper
>Release:        FreeBSD 4.8-RELEASE i386
>Organization:
>Environment:
System: FreeBSD fgmusic.org 4.8-RELEASE FreeBSD 4.8-RELEASE #4: Tue Apr 1 22:05:17 CST 2003 fgasper@operaman.ods.org:/usr/obj/usr/src/sys/CUSTOM i386


	
>Description:
When trying to do shell commands from /etc/ppp/ppp.linkup (to handle dynamic DNS issues), the ppp program fails to initiate a proper connection. The following is my ppp.linkup file as it stands now:

---------------
#
# ppp.linkup
# FG 20-V-2003
#

SBC_Yahoo:
#       ! sh -c "/usr/scripts/linkup.sh"
        # mail root w/ new IP
        ! sh -c "/sbin/ifconfig tun0 | /usr/bin/mail -s 'New IP' root"
        # dynamic DNS
#       ! sh -c "/usr/local/sbin/odsclient fgasper `/bin/cat /etc/ods-pw` operaman.ods.org"
#       ! sh -c "/usr/local/bin/wget -O - --http-user=fgasper --http-passwd=GurgiKin 'https
://dynamic.zoneedit.com/auth/dynamic.html?host=fgmusic.org'"
#       ! sh -c "/usr/local/bin/wget -O - https://www.sitelutions.com/dnsup?id=145690\&user
=fgasper@uiuc.edu\&pass=<password>\&ip=
---------------

An alternate form of the ifconfig line that I've used (and that makes ppp.linkup mess things up) is:

--------
! sh -c "/sbin/ifconfig tun0 | /usr/bin/grep inet | /usr/bin/awk '{print $2}' | mail -s 'New IP' root"
--------

Taking out the two middle commands clears up the problem. Also, running any external script (like the linkup.sh) seems to hose things as well.

>How-To-Repeat:
Configure /etc/ppp/ppp.linkup as I have it and run it in PPPoE mode w/ ddial.

>Fix:
>Release-Note:
>Audit-Trail:

From: Martin.Kaeske@Stud.TU-Ilmenau.DE
To: freebsd-gnats-submit@FreeBSD.org, fgasper@uiuc.edu
Cc:  
Subject: Re: bin/52743: /etc/ppp/ppp.linkup instability issues
Date: Sat, 14 Jun 2003 12:08:28 +0200 (CEST)

 Hello,
 Some days ago i had a similar problem (dyndns but with fetch instead of wget).
 I think the reason why it doesn't work is that ppp waits for all commands in
 ppp.linkup to complete before it actually transfer data over tun0. Since ppp
 waits for wget and wget wants to send data over tun0 there is some sort of
 dead-lock. I solved the issue by running fetch (or wget in your case) in the
 background (replace "!" with "!bg").
 
 HTH
 Martin
 

From: Felipe Gasper <fgasper@uiuc.edu>
To: freebsd-gnats-submit@FreeBSD.org,
	Martin.Kaeske@Stud.TU-Ilmenau.DE
Cc:  
Subject: Re: bin/52743: /etc/ppp/ppp.linkup instability issues
Date: Sat, 14 Jun 2003 11:07:22 -0500

 But that doesn't explain why
 
 ! sh -c "/sbin/ifconfig tun0 | /usr/bin/grep inet | /usr/bin/awk '{print $2}' | 
 mail -s 'New IP' root"
 
 locks the script up and
 
 ! sh -c "/sbin/ifconfig tun0 | /usr/bin/mail -s 'New IP' root"
 
 doesn't, am I right?
 
 I have noticed, though, that if I create a shell script that contains only the 
 first line (ifconfig | grep | awk), it seems to ignore the awk command, 
 outputting the output of the grep command. If I take out the sh -c and double 
 quotes, though, it works....maybe completely unrelated, quite possibly something 
 that I'm doing wrong, but ....?
 

From: Martin Kaeske <Martin.Kaeske@Stud.TU-Ilmenau.DE>
To: Felipe Gasper <fgasper@uiuc.edu>,
	freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: bin/52743: /etc/ppp/ppp.linkup instability issues
Date: Sat, 14 Jun 2003 20:13:26 +0200

 On Sat, Jun 14, 2003 at 11:07:22AM -0500, Felipe Gasper wrote:
 > But that doesn't explain why
 
 I thought you've had a problem with ppp not initiating the network
 connection properly, did i misunderstood you?
  
 > ! sh -c "/sbin/ifconfig tun0 | /usr/bin/grep inet | /usr/bin/awk '{print 
 > $2}' | mail -s 'New IP' root"
 > 
 > locks the script up and
 > 
 > ! sh -c "/sbin/ifconfig tun0 | /usr/bin/mail -s 'New IP' root"
 > 
 > doesn't, am I right?
 > 
 > I have noticed, though, that if I create a shell script that contains only 
 > the first line (ifconfig | grep | awk), it seems to ignore the awk command, 
 > outputting the output of the grep command. If I take out the sh -c and 
 > double quotes, though, it works....maybe completely unrelated, quite 
 > possibly something that I'm doing wrong, but ....?
 
 What do you mean by "locks the script up"? I tried this on my machine
 and it didn't lock ppp but i can confirm that the results are wrong.
 It seems that the awk command is ignored, in fact awk is executed but
 its parameter is wrong. The shell inserts the value of variable "$2"
 since this variable isn't set the resulting string is "awk {print}"
 that's why it looks like awk isn't called at all.
 I'm still investigating why this happens, it has something to do
 with nested quotes ("foo '$bar' foo"). I'll submit a followup to this
 PR if I know wether this is desired behaviour or not.
 To circumvent the problem you can write {print\$2} instead, that worked
 for me.
 
 So long
 Martin
  
 -- 
 The instructions said to use Windows 98 or better, so I installed FreeBSD.
 
 		-- Jim Levie in comp.unix.bsd.freebsd.misc --
>Unformatted:
 serious
 medium
 bin
