[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

ppp and ip-up.d, ip-down.d



Hi!

Recently, I did some modifications to the ppp package and e-mailed an
inquiry about that to the package's maintainer, Phil Hands. However,
he was unable to answer until now.

May I ask your opinion?

/etc/ppp/ip-up calls run-parts /etc/ppp/ip-up.d and /etc/ppp/ip-down
calls run-parts /etc/ppp/ip-down.d.

I have modified that mechanism a little bit. The modification has been
working here for four weeks. I have integrated ip-up.d and ip-down.d
to a single ip.d that contains scripts like this:

|mh@torres:/home/mh > cat /etc/ppp/ip.d/02routes
|#!/bin/bash
|
|case "$PPP_OPERATION" in
|  up)
|        /sbin/route del default
|        /sbin/route add default gw $PPP_REMOTE $PPP_IFACE
|        rm /var/lock/isdn_bad
|        ;;
|  down)
|        /sbin/route del default
|        /sbin/route del $PPP_REMOTE
|        /sbin/ifconfig $PPP_IFACE $PPP_DEFAULT_LOCAL_IP pointopoint $PPP_DEFAULT_REMOTE_IP metric 1
|        /sbin/route add $PPP_DEFAULT_REMOTE_IP $PPP_IFACE
|        if [ ! -e /var/lock/isdn_bad ]; then
|                /sbin/route add default gw $PPP_DEFAULT_REMOTE_IP
|        fi
|        ;;
|esac
|mh@torres:/home/mh > 

As you see, ip-up and ip-down export $PPP_OPERATION which is either
"up" or "down" and proceed to call run-parts /etc/ppp/ip.d.

This way, matching procedures being done at the beginning and/or end
of a PPP connection are beautifully integrated into a single script
which is IMHO easier to maintain and less error-prone.

I would love to see this integrated into a future release of the ppp
package since I really believe in that concept *grin*

To have "best of both worlds", ip-up and ip-down could check for
presence of ip-up.d resp ip-down.d and continue to behave the old way
if the "old style" directories are present and only proceed running
ip.d if the "old style" directories are not there. This could easily
be done.

It is entirely possible that I am particularly stupid and have failed
to notice a major design flaw in my idea. I'd really like to hear your
comments.

Any hints and/or comments will be appreciated.

Greetings
Marc

-- 
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber          |   " Questions are the         | Mailadresse im Header
Karlsruhe, Germany  |     Beginning of Wisdom "     | Fon: *49 721 966 32 15
Nordisch by Nature  | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29


Reply to: