Date: 4 Jan 2004 11:58:10 +0100 From: "Clemens Fischer" <ino-qc@spotteswoode.de.eu.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/60886: ppp(8) doesn't expand macro MYADDR in `!' commands Message-ID: <pte0t1yf.fsf@ID-23066.news.dfncis.de> Resent-Message-ID: <200401041100.i04B0BkK011845@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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 <ino-qc@spotteswoode.de.eu.org> >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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?pte0t1yf.fsf>