# rrqnet_options <options>
# rrqnet_log <level> <pathname>
# rrqnet_bridge <bridge>
+# rrqnet_dhcp <options>
: ${RRQDAEMON:=/usr/local/sbin/rrqnet}
: ${NAME:=rrqnet-${IFACE}}
grep -q "state UP" || ip link set dev $IFACE up
}
+############################################################
+## DHCP support
+: ${LEASES:=/var/lib/dhcp/dhclient.$IFACE.leases}
+: ${DHCPARGS:="-4 -cf /dev/null"}
+: ${PIDFILE:=/var/run/dhclient.$IFACE}
+
+#function
+start_dhclient() {
+ shift 1
+ [ -z "$*" ] || DHCPARGS="$*"
+ /sbin/dhclient -pf $PIDFILE $DHCPARGS -lf $LEASES $IFACE
+}
+
+#function
+stop_dhclient() {
+ shift 1
+ [ -z "$*" ] || DHCPARGS="$*"
+ /sbin/dhclient -x -pf $PIDFILE $DHCPARGS -lf $LEASES $IFACE 2>/dev/null
+}
+
+############################################################
+## The action functions
+
#function
start_cable_pre_up() {
configure_tap_up || return 1
[ -z "$IF_RRQNET_NICE" ] || \
RRQDAEMON="/usr/bin/nice -n $IF_RRQNET_NICE $RRQDAEMON"
if [ -z "$IF_RRQNET_LOG" ] ; then
- daemon -U -r -n $NAME -- \
+ daemon -U -r -a 10 -n $NAME -- \
$RRQDAEMON $IF_RRQNET_OPTIONS \
-t $IFACE $IF_RRQNET_PORT $IF_RRQNET_REMOTE
else
- daemon -U -r -n $NAME -E "${IF_RRQNET_LOG#* }" -- \
+ daemon -U -r -a 10 -n $NAME -E "${IF_RRQNET_LOG#* }" -- \
$RRQDAEMON ${IF_RRQNET_LOG%% *} $IF_RRQNET_OPTIONS \
-t $IFACE $IF_RRQNET_PORT $IF_RRQNET_REMOTE
fi
}
+#function
+start_cable_post_up() {
+ case "$IF_RRQNET_DHCP" in
+ dhclient*)
+ start_dhclient IF_RRQNET_DHCP
+ ;;
+ *)
+ : # no or unkown dhcp option
+ ;;
+ esac
+}
+
+#function
+stop_cable_pre_down() {
+ case "$IF_RRQNET_DHCP" in
+ dhclient*)
+ stop_dhclient $IF_RRQNET_DHCP
+ ;;
+ *)
+ : # no or unkown dhcp option
+ ;;
+ esac
+}
+
#function
stop_cable_post_down() {
daemon -n $NAME --stop
}
# main script body
-
case "$MODE-$PHASE" in
start-pre-up) start_cable_pre_up ;;
- start-post-up) : ;;
- stop-pre-down) : ;;
+ start-post-up) start_cable_post_up ;;
+ stop-pre-down) stop_cable_pre_down ;;
stop-post-down) stop_cable_post_down ;;
esac
SYNOPSIS
--------
- ln -s /etc/rrqnet/ifupdown.sh /etc/network/if-post-down.d/rrqnet
- ln -s /etc/rrqnet/ifupdown.sh /etc/network/if-pre-up.d/rrqnet
+ for HOOKD in down post-down pre-up up ; do
+ ln -s /etc/rrqnet/ifupdown.sh /etc/network/if-$HOOKD.d/rrqnet
+ done
DESCRIPTION
-----------
things is achieved by including the +tap+ in the +bridge_ports+ list
of the bridge, provided that the +tap+ is created before the bridge.
+*rrqnet_dhcp* _method args_::
+
+This IFACE option is used for attaching a DHCP client to the
+interface. The +method+ identifies the DHCP client method, and
+currently only the +dhclient+ method is defined, which is run as
+follows:
++
+----
+dhclient -pf $PIDFILE $DHCPARGS -lf $LEASES $IFACE
+----
++
+The given +args+ if non-empty replaces +$DHCPARGS+, which by default
+are "-4 -cf /dev/null". Refer to the +dhclient+ man page for details.
+
EXAMPLES
--------
to the orignal packet, which means that packets grow with some 28/48
(ipv4/6) bytes.
+
SEE ALSO
--------
- *brctl(8)* - ethernet bridge administration
- *daemon(1)* - turns other processes into daemons
- *interfaces(5)* - network interface configuration for ifup and ifdown
- *rrqnet(8)* - packet tunneling over UDP, multiple channels
-
+*brctl(8)* - ethernet bridge administration
+
+*daemon(1)* - turns other processes into daemons
+
+*dhclient(8)* - Dynamic Host Configuration Protocol Client
+
+*interfaces(5)* - network interface configuration for ifup and ifdown
+
+*rrqnet(8)* - packet tunneling over UDP, multiple channels
+
AUTHOR
------
Ralph Rönnquist <ralph.ronnquist@gmail.com>