gui/Makefile.in | 4 +++- gui/tkpppoe.in | 24 +++++++++++++++++++++--- man/pppoe.conf.5 | 12 ++++++++---- scripts/pppoe-connect.in | 18 ++++++++---------- scripts/pppoe-init.in | 15 +++++++++++---- scripts/pppoe-stop.in | 14 +++++++++++++- src/configure.in | 10 +++++----- 7 files changed, 69 insertions(+), 28 deletions(-) diff --git a/gui/Makefile.in b/gui/Makefile.in index 84e2774..1eb3441 100644 --- a/gui/Makefile.in +++ b/gui/Makefile.in @@ -25,6 +25,7 @@ sbindir=@sbindir@ bindir=@bindir@ datadir=@datadir@ datarootdir=@datarootdir@ +docdir=/usr/share/doc PPPOE_START_PATH=@sbindir@/pppoe-start PPPOE_STOP_PATH=@sbindir@/pppoe-stop @@ -47,6 +48,7 @@ wrapper.o: wrapper.c install: all -mkdir -p $(DESTDIR)$(sbindir) -mkdir -p $(DESTDIR)$(bindir) + -mkdir -p $(DESTDIR)$(docdir)/tkpppoe -mkdir -p $(DESTDIR)/etc/ppp/rp-pppoe-gui $(install) -m 4755 -s pppoe-wrapper $(DESTDIR)$(sbindir) $(install) -m 755 tkpppoe $(DESTDIR)$(bindir) @@ -55,7 +57,7 @@ install: all $(install) -m 644 tkpppoe.1 $(DESTDIR)$(mandir)/man1 -mkdir -p $(DESTDIR)$(datadir)/tkpppoe for i in tkpppoe.html mainwin-busy.png mainwin-nonroot.png mainwin.png props-advanced.png props-basic.png props-nic.png props-options.png; do \ - $(install) -m 644 html/$$i $(DESTDIR)$(datadir)/tkpppoe; \ + $(install) -m 644 html/$$i $(DESTDIR)$(docdir)/tkpppoe; \ done for i in en.msg ja.msg; do \ $(install) -m 644 $$i $(DESTDIR)$(datadir)/tkpppoe; \ diff --git a/gui/tkpppoe.in b/gui/tkpppoe.in index 919d1fc..2ddaa5d 100644 --- a/gui/tkpppoe.in +++ b/gui/tkpppoe.in @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/wish # -*-Mode: TCL;-*- # LIC: GPL @@ -94,6 +94,11 @@ option add *Menubutton.borderWidth 1 option add *Menubutton.Pad 1 option add *Entry.Background white +# Help browser program +if {[info exists env(HELP_BROWSER)]} { + set Help_Browser $env(HELP_BROWSER) +} + # Array holding help strings for windows array set HelpData {} @@ -2840,12 +2845,25 @@ proc Pretty { n } { # Opens help page #*********************************************************************** proc Help {} { - set file [file join "@datadir_evaluated@" tkpppoe tkpppoe.html] + global Admin + global Help_Browser + set file [file join "@datadir_evaluated@" doc tkpppoe tkpppoe.html] if {![file readable $file]} { tk_dialog .err [m "Error"] [m "Help file is not installed"] error 0 OK return } - catch { exec /bin/sh -c "netscape -remote 'openURL($file)' || netscape $file" > /dev/null 2>/dev/null & } + + if {$Admin} { + tk_dialog .err [m "Error"] [m "Can't launch browser as root"] error 0 OK + return + } + + if {![info exists Help_Browser]} { + tk_dialog .err [m "Error"] [m "Help_Browser not defined"] error 0 OK + return + } + + catch { exec /bin/sh -c "$Help_Browser -remote 'openURL($file)' || $Help_Browser $file" > /dev/null 2>/dev/null & } } diff --git a/man/pppoe.conf.5 b/man/pppoe.conf.5 index faa20a1..577e787 100644 --- a/man/pppoe.conf.5 +++ b/man/pppoe.conf.5 @@ -44,10 +44,9 @@ up all the time rather than being activated on demand. .B DNSTYPE One of \fBNOCHANGE\fR, \fBSPECIFY\fR or \fBSERVER\fR. If set to NOCHANGE, \fBpppoe-connect\fR will not adjust the DNS setup in -any way. If set to SPECIFY, it will re-write /etc/resolv.conf with -the values of DNS1 and DNS2. If set to \fBSERVER\fR, it will -supply the \fIusepeerdns\fR option to \fBpppd\fR, and make a symlink -from /etc/resolv.conf to /etc/ppp/resolv.conf. +any way. If set to SPECIFY, it will use \fBresolvconf\fR for adding +values of DNS1 and DNS2 to /etc/resolv.conf. If set to \fBSERVER\fR, it will +supply the \fIusepeerdns\fR option to \fBpppd\fR. .TP .B DNS1, DNS2 @@ -156,6 +155,11 @@ This code is experimental and unsupported. Use of the plugin causes \fBpppoe-connect\fR to ignore CLAMPMSS, PPPOE_EXTRA, SYNCHRONOUS and PPPOE_TIMEOUT. +.TP +.B RESOLVCONF_NAME +Name for \fBresolvconf\fR entry. When used DNSTYPE=SPECIFY this name passed to +\fBresolvconf\fR with -a option. + .P By using different configuration files with different PIDFILE settings, you can manage multiple PPPoE connections. Just specify the diff --git a/scripts/pppoe-connect.in b/scripts/pppoe-connect.in index 3f1032c..3017357 100755 --- a/scripts/pppoe-connect.in +++ b/scripts/pppoe-connect.in @@ -34,6 +34,7 @@ PPPD=@PPPD@ SETSID=@SETSID@ PPPOE=@sbindir@/pppoe LOGGER="/usr/bin/logger -t `basename $0`" +RESOLVCONF=/sbin/resolvconf # Set to "C" locale so we can parse messages from commands LANG=C @@ -231,16 +232,13 @@ fi PPP_STD_OPTIONS="$PLUGIN_OPTS $DOUNIT noipdefault noauth default-asyncmap $DEFAULTROUTE hide-password nodetach $PEERDNS mtu $MTU mru $MRU noaccomp nodeflate nopcomp novj novjccomp user $USER lcp-echo-interval $LCP_INTERVAL lcp-echo-failure $LCP_FAILURE $PPPD_EXTRA" # Jigger DNS if required... -if test "$DNSTYPE" = "SERVER" ; then - # Sorry, dude... - rm -f /etc/resolv.conf - ln -s /etc/ppp/resolv.conf /etc/resolv.conf -elif test "$DNSTYPE" = "SPECIFY" ; then - # Sorry, dude... - rm -f /etc/resolv.conf - echo "nameserver $DNS1" > /etc/resolv.conf - if test -n "$DNS2" ; then - echo "nameserver $DNS2" >> /etc/resolv.conf +if test "$DNSTYPE" = "SPECIFY" ; then + dns_pppoe= + for i in $DNS1 $DNS2; do + dns_pppoe="${dns_pppoe}nameserver $i\n" + done + if test -n "$dns_pppoe" -a -x "$RESOLVCONF"; then + echo -ne "$dns_pppoe" | "$RESOLVCONF" -a "${RESOLVCONF_NAME:-pppoe}" fi fi diff --git a/scripts/pppoe-init.in b/scripts/pppoe-init.in index 8314c3e..9c1fdf8 100755 --- a/scripts/pppoe-init.in +++ b/scripts/pppoe-init.in @@ -2,7 +2,7 @@ # # pppoe This script starts or stops a PPPoE connection # -# chkconfig: 2345 99 01 +# chkconfig: 2345 15 85 # description: Connects to PPPoE provider # # LIC: GPL @@ -23,12 +23,16 @@ exec_prefix=@exec_prefix@ START=@sbindir@/pppoe-start STOP=@sbindir@/pppoe-stop STATUS=@sbindir@/pppoe-status + +RETVAL=0 + case "$1" in start) echo -n "Bringing up PPPoE link" $START - if [ $? = 0 ] ; then + RETVAL=$? + if [ $RETVAL = 0 ] ; then touch /var/lock/subsys/pppoe echo_success else @@ -41,7 +45,8 @@ case "$1" in echo -n "Shutting down PPPoE link" $STOP > /dev/null 2>&1 - if [ $? = 0 ] ; then + RETVAL=$? + if [ $RETVAL = 0 ] ; then rm -f /var/lock/subsys/pppoe echo_success else @@ -53,10 +58,12 @@ case "$1" in restart) $0 stop $0 start + RETVAL=$? ;; status) $STATUS + RETVAL=$? ;; *) @@ -64,4 +71,4 @@ case "$1" in exit 1 esac -exit 0 +exit $RETVAL diff --git a/scripts/pppoe-stop.in b/scripts/pppoe-stop.in index 3dd24ed..58e0893 100755 --- a/scripts/pppoe-stop.in +++ b/scripts/pppoe-stop.in @@ -27,6 +27,7 @@ export LANG ME="`basename $0`" LOGGER="/usr/bin/logger -t $ME" +RESOLVCONF=/sbin/resolvconf CONFIG="$1" if [ "$CONFIG" = "" ] ; then CONFIG=/etc/ppp/pppoe.conf @@ -84,9 +85,20 @@ if [ -r "$PIDFILE" ] ; then # Kill pppd again, in case it's still hanging around if [ -r "$PPPD_PIDFILE" ] ; then + # respect pppd and wait 5 sec + KILL_TRIES=10 + TRIES_TIMEOUT=500000 PPPD_PID=`cat "$PPPD_PIDFILE"` - kill -9 $PPPD_PID > /dev/null 2>&1 || exit 1 + while [ $KILL_TRIES -gt 0 ] && kill -0 $PPPD_PIDFILE > /dev/null 2>&1; do + usleep $TRIES_TIMEOUT + KILL_TRIES=$((KILL_TRIES-1)) + done + if [ $KILL_TRIES -le 0 ]; then + kill -9 $PPPD_PID > /dev/null 2>&1 || exit 1 + fi fi + # Remove resolvconf entry + [ -x "$RESOLVCONF" ] && "$RESOLVCONF" -fd "${RESOLVCONF_NAME:-pppoe}" rm -f "$PIDFILE" "$PPPD_PIDFILE" "$PPPOE_PIDFILE" "$STARTPID" else diff --git a/src/configure.in b/src/configure.in index 4add50c..922a7d0 100644 --- a/src/configure.in +++ b/src/configure.in @@ -11,7 +11,7 @@ AC_PREFIX_DEFAULT(/usr) dnl Checks for programs. AC_PROG_CC -AC_PROG_RANLIB +AC_PROG_LIBTOOL dnl Checks for libraries. @@ -45,7 +45,7 @@ ac_cv_struct_sockaddr_ll=no) AC_MSG_RESULT($ac_cv_struct_sockaddr_ll) if test "$ac_cv_struct_sockaddr_ll" = yes ; then -AC_DEFINE(HAVE_STRUCT_SOCKADDR_LL) +AC_DEFINE(HAVE_STRUCT_SOCKADDR_LL, 1, [struct sockaddr_ll]) fi dnl Check for N_HDLC line discipline @@ -58,7 +58,7 @@ AC_TRY_COMPILE([ ac_cv_n_hdlc=no) AC_MSG_RESULT($ac_cv_n_hdlc) if test "$ac_cv_n_hdlc" = yes ; then -AC_DEFINE(HAVE_N_HDLC) +AC_DEFINE(HAVE_N_HDLC, 1, [Define if you have the N_HDLC line discipline in linux/termios.h]) fi AC_ARG_ENABLE(plugin, [ --enable-plugin=pppd_src_path build pppd plugin], ac_cv_pluginpath=$enableval, ac_cv_pluginpath=no) @@ -106,7 +106,7 @@ PPPD_INCDIR="" if test "$ac_cv_header_linux_if_pppox_h" = yes ; then if test "$ac_cv_pluginpath" != no ; then LINUX_KERNELMODE_PLUGIN=rp-pppoe.so - AC_DEFINE(HAVE_LINUX_KERNEL_PPPOE) + AC_DEFINE(HAVE_LINUX_KERNEL_PPPOE, 1, [Define if you have kernel-mode PPPoE in Linux file.]) PPPD_INCDIR=$ac_cv_pluginpath fi fi @@ -116,7 +116,7 @@ if test "$PPPD_INCDIR" = "" ; then fi if test "$ac_cv_debugging" = "yes" ; then - AC_DEFINE(DEBUGGING_ENABLED) + AC_DEFINE(DEBUGGING_ENABLED, 1, [Define to include debugging code]) fi AC_SUBST(LINUX_KERNELMODE_PLUGIN)