From owner-freebsd-bugs@FreeBSD.ORG Sun Jan 4 03:00:15 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 044A016A4CE for ; Sun, 4 Jan 2004 03:00:15 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1509043D41 for ; Sun, 4 Jan 2004 03:00:12 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i04B0BFR011846 for ; Sun, 4 Jan 2004 03:00:11 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i04B0BkK011845; Sun, 4 Jan 2004 03:00:11 -0800 (PST) (envelope-from gnats) Resent-Date: Sun, 4 Jan 2004 03:00:11 -0800 (PST) Resent-Message-Id: <200401041100.i04B0BkK011845@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Clemens Fischer" Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 06CD816A4CE for ; Sun, 4 Jan 2004 02:58:16 -0800 (PST) Received: from mout1.freenet.de (mout1.freenet.de [194.97.50.132]) by mx1.FreeBSD.org (Postfix) with ESMTP id 750A843D2F for ; Sun, 4 Jan 2004 02:58:13 -0800 (PST) (envelope-from ino-qc@spotteswoode.de.eu.org) Received: from [194.97.55.147] (helo=mx4.freenet.de) by mout1.freenet.de with asmtp (Exim 4.30) id 1Ad5xU-0000LC-Bu for FreeBSD-gnats-submit@freebsd.org; Sun, 04 Jan 2004 11:58:12 +0100 Received: from pd9e7670b.dip.t-dialin.net ([217.231.103.11] helo=spotteswoode.dnsalias.org) by mx4.freenet.de with asmtp (ID inode@freenet.de) (Exim 4.30 #1) id 1Ad5xT-0008Fy-V6 for FreeBSD-gnats-submit@freebsd.org; Sun, 04 Jan 2004 11:58:12 +0100 Received: (qmail 1492 invoked by uid 0); 4 Jan 2004 10:58:33 -0000 Message-Id: Date: 4 Jan 2004 11:58:10 +0100 From: "Clemens Fischer" To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/60886: ppp(8) doesn't expand macro MYADDR in `!' commands X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Jan 2004 11:00:15 -0000 >Number: 60886 >Category: bin >Synopsis: ppp(8) doesn't expand macro MYADDR in `!' commands >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Jan 04 03:00:11 PST 2004 >Closed-Date: >Last-Modified: >Originator: Clemens Fischer >Release: FreeBSD 4.9-STABLE i386 >Organization: Clemens Fischer >Environment: System: FreeBSD spotteswoode.dnsalias.org 4.9-STABLE FreeBSD 4.9-STABLE #15: Fri Jan 2 16:35:22 CET 2004 root@spotteswoode.dnsalias.org:/www/freebsd/obj/www/freebsd/RELENG_4/src/sys/n1 i386 >Description: userland-ppp allows custom configuration commands to be executed when a PPP connection goes fully functional and when the connection is terminated. administrators can rely on several macros beeing expanded to useful values, among them HISADDR (IP of peer), INTERFACE (name of interface), MYADDR (IP of local PPP interface) etc. the relevant configuration lines are (etc/rc.local): kldload netgraph || logger "kldload netgraph failed: $?" (etc/ppp/ppp.conf): set device PPPoE:xl0 set speed sync set MTU 1492 set MRU 1492 my invocation line is: "/usr/sbin/ppp -unit 0 -foreground dsl", and etc/ppp/ppp.linkup has: MYADDR: !bg /usr/local/libexec/spott/ppplinkup "LABEL" "MYADDR" "HISADDR" "INTERFACE" this script is used to establish various DNS, mail and firewall related things. only "MYADDR" is really used (and logged) in this bourne-shell script, and sometimes the very first octet of the local peers IP has the leading digits replaced by "ay", ie. i get IPs like (from the log): "ay7.231.107.141" instead of "217.231.107.141", or "ay7.231.106.233" instead of "217.231.106.233" etc. the origin of these faulty expansions of "MYADDR" must be ppp(8), as checked by additional "echo" or "printf(1)" statements. also, "MYADDR" is only read, never set in any way by my scripts. the problem doesn't appear every time ppp(8) connects and doesn't seem to depend on the actual IP. a rough estimate would be one out of five connections have the "ay-syndrome". >How-To-Repeat: i don't know how to reproduce this problem other than trying to connect and verify all the macro expansions, but at my workstation type of fbsd installation it first appeared 2003/11/27 with a system cvsup'ed 2003/11/10 and built later the same day. note that i use the netgraph(4) module for my DSL line. >Fix: since the error seems located at the code where MYADDR is expanded, i can use the actual value given to the tun0 interface, thus the following workaround makes the problem invisible: #!/bin/sh # $Header: /l/dns/RCS/freebsd.sh,v 1.8 2003/12/11 16:46:03 root Exp root $ # freebsd.sh gets parameters from calling /etc/ppp/ppp.linkup & /l/libexec/spott/*link* # LABEL="$1" MYADDR="$2" HISADDR="$3" INTERFACE="$4" logger "LABEL=${LABEL} MYADDR=${MYADDR} HISADDR=${HISADDR} INTERFACE=${INTERFACE}" # case "$MYADDR" in [0-9]*.[0-9]*.[0-9]*.[0-9]*) ip_addr="$MYADDR" ex="$0 ip_addr: $ip_addr" ;; *) ip_addr=$(ifconfig "${INTERFACE:-tun0}" | grep -- '-->' | awk '{print $2}') ex="$0 CORRECTED using ifconfig ip_addr: $ip_addr" ;; esac echo "$ip_addr" > /var/spott/ip_addr regards, clemens >Release-Note: >Audit-Trail: >Unformatted: SEND-PR: X-send-pr-version: 3.113 SEND-PR: X-GNATS-Notify: