Browse Source

allow iface block without actual interface

wip/notap-interface
Ralph Rönnquist 2 years ago
parent
commit
055bf6a8e0
  1. 22
      rrqnet-ifupdown.sh
  2. 17
      rrqnet-ifupdown.sh.8.adoc

22
rrqnet-ifupdown.sh

@ -18,7 +18,7 @@
[ -z "$IF_RRQNET_PORT" ] && exit 0
# An rrqnet stanza may have the following settings:
# rrqnet_port <port>
# rrqnet_port [ notap ] <port>
# rrqnet_nice <nice>
# rrqnet_remote <remote declaration>
# rrqnet_options <options>
@ -29,6 +29,9 @@
: ${RRQDAEMON:=/usr/sbin/rrqnet}
: ${NAME:=rrqnet-${IFACE}}
NOTAP="${IF_RRQNET_PORT##notap *}" # empty if 'notap' is used
IF_RRQNET_PORT="${IF_RRQNET_PORT#notap }"
#function
configure_tap_bridge() {
[ -z "$IF_RRQNET_BRIDGE" ] && return 0
@ -67,18 +70,25 @@ stop_dhclient() {
#function
start_cable_pre_up() {
configure_tap_up || return 1
configure_tap_bridge || return 1
local TAP
TAP="-t $IFACE"
if [ -z "$NOTAP" ] ; then
echo "Note: $IFACE is an rrqnet without local interface" >&2
TAP=""
else
configure_tap_up || return 1
configure_tap_bridge || return 1
fi
[ -z "$IF_RRQNET_NICE" ] || \
RRQDAEMON="/usr/bin/nice -n $IF_RRQNET_NICE $RRQDAEMON"
if [ -z "$IF_RRQNET_LOG" ] ; then
daemon -U -r -a 10 -n $NAME -- \
$RRQDAEMON $IF_RRQNET_OPTIONS \
-t $IFACE $IF_RRQNET_PORT $IF_RRQNET_REMOTE
$TAP $IF_RRQNET_PORT $IF_RRQNET_REMOTE
else
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
$TAP $IF_RRQNET_PORT $IF_RRQNET_REMOTE
fi
}
@ -109,7 +119,7 @@ stop_cable_pre_down() {
#function
stop_cable_post_down() {
ip link del $IFACE
[ -z "$NOTAP" ] || ip link del $IFACE
}
# main script body

17
rrqnet-ifupdown.sh.8.adoc

@ -33,16 +33,19 @@ addresses.
This script handles the special purpose "option codes" for the IFACE
blocks that are used for declaring the +rrqnet+ daemon configuration
to for the +tap+ interface for its virtual cabling. I.e., the IFACE
stanza is made for the tap interface and it includes one or more of
block is made for the tap interface and it includes one or more of
these +rrqnet+ options.
The list of IFACE options for +rrqnet+ are:
*rrqnet_port* _port_::
*rrqnet_port* [ notap ] _port_::
This IFACE option is required both as way of marking that the stanza
is for an +rrqnet+ virtual cable +tap+, and to declare which UDP port
the +rrqnet+ daemon should listen on for incoming cabling.
This IFACE option is required both as way of marking that the
configuration block is for an +rrqnet+ virtual cable +tap+, and to
declare which UDP port the +rrqnet+ daemon should listen on for
incoming cabling. The port number may be preceded by +notap+ to
indcate that this +rrqnet+ should not have an actual tap interface on
the host but rather only serve to interconnect remote connections.
*rrqnet_nice* _nice_::
@ -109,8 +112,8 @@ iface mynet0 inet static
The above example declares a virtual cable plug for UDP port +3636+
tunneling through host +111.222.333.444+ port +3636+ where the local
+tap+ +mynet0+ has ipv4 address +10.0.0.2+. The +rrqnet_port+ option
marks the stanza as an ++rrqnet+ virtual cabling set up which then is
duly handled by +rrqnet-ifupdown.sh+.
marks the IFACE block as an ++rrqnet+ virtual cabling set up which
then is duly handled by +rrqnet-ifupdown.sh+.
The +rrqnet_options+ in the example tells the +rrqnet+ process to use
an ipv4-only socket, 10 packet buffers and a single delivery thread,

Loading…
Cancel
Save