Sophie

Sophie

distrib > Momonga > development > i686 > media > os > by-pkgid > e1604072606d0e320c824527770e694a > files > 20

cipe-1.6.0-17m.mo8.i686.rpm

#!/bin/sh
# ip-up <interface> <myaddr> <daemon-pid> <local> <remote> <arg>

# Sample of the ip-up script.
# This is called when the CIPE interface is opened.
# Arguments:
#  $1 interface     the CIPE interface
#  $2 myaddr        our UDP address
#  $3 daemon-pid    the daemon's process ID
#  $4 local         IP address of our CIPE device
#  $5 remote        IP address of the remote CIPE device
#  $6 arg           argument supplied via options

# Purposes for this script: set up routes, set up proxy-arps, etc.
# start daemons, logging...

umask 022
PATH=/sbin:/bin:/usr/sbin:/usr/bin

# If this becomes our default route...
#route add default gw $5

# just a logging example
now=`date "+%b %d %T"`
echo "$now UP   $*" >> /var/log/cipe.log

# Create/update PID file. Note: PKCIPE needs this.
# You can instead use the piddir option with the right path.
echo "$3 $1" >/var/run/cipe/${6:-$1}.pid

# Trigger the key exchange procedure, useful when we're using SOCKS
# This _must_ run delayed and in the background
#(sleep 10; ping -c5 $5) &

# If the system runs gated, tell it what has happened
#gdc interface

# The following are just ideas for further consideration

# Interconnect two 10. subnets through the Internet!
# Assuming $4 is in 10.1 and $5 in 10.2
#route add -net 10.2.0.0 netmask 255.255.0.0 gw $5

# Proxy-ARP the peer's address on eth0
#arp -i eth0 -Ds $5 eth0 pub

# For Linux 2.4: Prox-ARP the whole network behind the peer.
# Do this after setting up the route.
#echo 1 >/proc/sys/net/ipv4/conf/$1/proxy_arp

# Evil tricks department: masquerade the CIPE peer's /24 network to our IP
# (shown here in ipfwadm syntax for 2.0)
#NA=`expr $5 : '\([0-9]*\.[0-9]*\.[0-9]*\.\)'`
#ipfwadm -F -a accept -m -b -S $NA.0/24 -D 0.0.0.0/0
# the usual way for this would be a case selection on $5 or $6, however

# execute anything local
[ -x /etc/cipe/ip-up.local ] && /etc/cipe/ip-up.local $*

exit 0