From ino-qc@spotteswoode.de.eu.org Sun Jan 4 02:58:16 2004 Return-Path: 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 Subject: ppp(8) doesn't expand macro MYADDR in `!' commands X-Send-Pr-Version: 3.113 X-GNATS-Notify: >Number: 60886 >Category: bin >Synopsis: ppp(8) doesn't expand macro MYADDR in `!' commands >Confidential: no >Severity: serious >Priority: medium >Responsible: brian >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Jan 04 03:00:11 PST 2004 >Closed-Date: Mon Dec 13 18:27:35 GMT 2004 >Last-Modified: Mon Dec 13 18:27:35 GMT 2004 >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: Responsible-Changed-From-To: freebsd-bugs->brian Responsible-Changed-By: vs Responsible-Changed-When: Thu Jul 15 09:06:16 GMT 2004 Responsible-Changed-Why: Brian's territory http://www.freebsd.org/cgi/query-pr.cgi?pr=60886 State-Changed-From-To: open->closed State-Changed-By: brian State-Changed-When: Mon Dec 13 18:26:16 GMT 2004 State-Changed-Why: This is a duplicate of 62050 which was fixed on July 15 and MFC'd three days later. http://www.freebsd.org/cgi/query-pr.cgi?pr=60886 >Unformatted: SEND-PR: X-send-pr-version: 3.113 SEND-PR: X-GNATS-Notify: