#!/bin/bash
# Example bond hook.
#
# Bond hooks are run with the "start" argument after a bond is started and
# with the "stop" argument before it is stopped. A bond is considered started
# after PPP and DHCP leg daemons have been started, but before they have
# connected.
#
# Environment variables:
#   ID: the bond ID
#   AGGREGATOR_IP: IP address of aggregator
#   COMPRESSION: "True" if compression is enabled, otherwise "False"
#   QOS_PROFILE_ID: ID of the QoS profile used by this bond
#   TUNNEL_SUBNET: the /31 IP subnet assigned to the tunnel
#   TUNNEL_BONDER_IP: the IP address of the tunnel on the bonder
#   TUNNEL_AGGREGATOR_IP: the IP address of the tunnel on the aggregator
#   TUNNEL_LOCAL_IP: the IP address of the tunnel on the local host
#   TUNNEL_PEER_IP: the IP address of the tunnel on the remote host
#   CLAMP_TCP: "True" if TCP clamping is enabled, otherwise "False"
#   TUNNEL_SECURITY: type of security enabled. May be "none" if no security
#       is enabled, "hmac" if tunnel HMAC authentication is enabled, or
#       "encryption" if encryption is enabled (This replaces the
#       TUNNEL_AUTHENTICATE option present until 2014.2)
#   ENCRYPTION_CIPHER: this contains the configured encryption cipher
#   ENCRYPTION_HANDSHAKE_INTERVAL: this contains the interval for encryption
#       handshake renegotiation in seconds
#   ENCRYPTION_REPLAY_PROTECTION: "True" if encryption replay detection is
#       enabled
#   AUTOMATIC_PING_TIMING: "True" if ping timing will be determined based on the
#       latency of the links, otherwise "False"
#   FILTER_UNRECOGNIZED_TRAFFIC: "True" if the source address verification
#       option is enabled, otherwise "False" (this option was called "filter
#       unrecognized traffic" until 2014.2)
#   BRIDGE_ENABLED: "True" if the TCP proxy is enabled, otherwise "False"
#   BRIDGE_PORTS: The list of TCP ports going through the TCP proxy
#   BRIDGE_CONCURRENCY: The number of concurrent TCP connections the TCP proxy
#       uses
#   BRIDGE_CONNECTION_TIMEOUT: The timeout for connecting to destination hosts
#   BRIDGE_FILE_DESCRIPTOR_LIMIT: The greatest number of file descriptors the
#       TCP proxy process can open.
#   BRIDGE_CONGESTION_CONTROL_ALGORITHM: The TCP congestion control algorithm
#       used between proxy peers
#   LEG_MTU_DETECTION: "True" if leg MTU detection is enabled, which
#       automatically detects the path MTU of links
#   LEG_MTU_DETECTION_TIME: If leg MTU detection is enabled, repeat detection at
#       this interval (hours)
#   PACKET_LOSS_DETECTION: "True" if packet loss detection is enabled, otherwise "False".
#   FLAP_DETECTION: "True" if flap detection is enabled, otherwise "False".
#   AUTOMATIC_REORDER_MAX_HOLD: "True" if automatic reorder max hold is enabled, otherwise "False".

start () {
    remove 2> /dev/null
    true
}
stop () {
    remove
}
remove () {
    true
}

# Avoid changing anything below here.
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    *)
        echo "Usage: $0 {start|stop}"
        exit 1
        ;;
esac
