# Copyright (c) 2021, Dell Inc. or its subsidiaries.  All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# See the LICENSE file for details.
#
# This file is part of NVMe STorage Appliance Services (nvme-stas).

# ==============================================================================
# STorage Appliance Finder Daemon (stafd) - configuration file
#
# In this file, options that are commented represent the default values used.
# Uncommented options override the default value.


[Global]
# tron:        Trace-ON. Enable additional debug info
#              Type:  boolean
#              Range: [false, true]
#tron=false

# hdr-digest:  Protocol Data Unit (PDU) Header Digest. NVMe/TCP facilitates an
#              optional PDU Header digest. Digests are calculated using the
#              CRC32C algorithm.
#              Type:  boolean
#              Range: [false, true]
#hdr-digest=false

# data-digest: Protocol Data Unit (PDU) Data Digest. NVMe/TCP facilitates an
#              optional PDU Data digest. Digests are calculated using the
#              CRC32C algorithm.
#              Type:  boolean
#              Range: [false, true]
#data-digest=false

# kato:        Keep Alive Timeout (KATO): This field specifies the timeout value
#              for the Keep Alive feature in seconds. The default value for this
#              field is 30 seconds.
#              Type:  Unsigned integer
#              Range: 0..N
#              Unit:  Seconds
#kato=30

# persistent-connections: Whether connections to Discovery Controllers (DC)
#                         are persistent. If stafd is stopped, the connections
#                         will persists. When this is set to false, stafd will
#                         disconnect from all DCs it is connected to.
#                         Type:  boolean
#                         Range: [false, true]
#persistent-connections=true

# ignore-iface: This option controls how connections with Discovery Controllers
#               (DC) are made.
#
#               DCs are automatically discovered using DNS-SD/mDNS. mDNS
#               provides the DC's IP address and the interface on which the DC
#               was discovered.
#
#               There is no guarantee that there will be a route to reach that
#               DC. However, we can use the socket option SO_BINDTODEVICE to
#               force the connection to be made on a specific interface instead
#               of letting the routing tables decide where to make the
#               connection.
#
#               This option determines whether stafd will use SO_BINDTODEVICE to
#               force connections on an interface or just rely on the routing
#               tables. The default is to use SO_BINDTODEVICE, in other words,
#               stafd does not ignore the interface.
#
#               Type:    boolean
#               Range:   [false, true]
#               Default: false
#ignore-iface=false

# ip-family: With this you can specify whether stafd will support IPv4, IPv6,
#            or both when connecting to Discovery Controllers (DC). stafd will
#            not try to connect to IP addresses (whether discovered with mDNS
#            or manually configured with the 'controller' option defined below)
#            if those IP addresses are disabled by this option. stafd will
#            default to "ipv4+ipv6" if an invalid value is specified for this
#            option.
#
#            Type:    String
#            Range:   [ipv4, ipv6, ipv4+ipv6]
#            Default: ipv4+ipv6
#ip-family=ipv4+ipv6

[Service Discovery]
# zeroconf: Control whether DNS-SD/mDNS automatic discovery is enabled. This is
#           used to enable or disable automatic discovery of Discovery
#           Controllers using DNS-SD/mDNS.
#
#           Type:    String
#           Range:   [disabled, enabled]
#           Default: enabled
#zeroconf=enabled

[Controllers]
# controller: Discovery Controllers (DC) are specified with this keyword.
#
#             Syntax:
#               controller = transport=[trtype];traddr=[traddr];trsvcid=[trsvcid];host-traddr=[traddr];host-iface=[iface];nqn=<dcnqn>
#
#             transport=<trtype>   [MANDATORY]
#               This field specifies the network fabric being used for a NVMe-over-
#               Fabrics network. Current string values include:
#
#               Value   Definition
#               ------- -----------------------------------------------------------
#               rdma    The network fabric is an rdma network (RoCE, iWARP,
#                       Infiniband, basic rdma, etc)
#               fc      The network fabric is a Fibre Channel network.
#               tcp     The network fabric is a TCP/IP network.
#               loop    Connect to a NVMe over Fabrics target on the local host
#
#             traddr=<traddr>      [MANDATORY]
#               This field specifies the network address of the Controller. For
#               transports using IP addressing (e.g. rdma) this should be an IP-
#               based address (ex. IPv4, IPv6). It could also be a resolvable host
#               name (e.g. localhost).
#
#             nqn=<dcnqn>          [OPTIONAL]
#               This field specifies the Discovery Controller's NVMe Qualified
#               Name. If not specified, this will default to the well-known DC
#               NQN: "nqn.2014-08.org.nvmexpress.discovery".
#
#             trsvcid=<trsvcid>    [OPTIONAL]
#               This field specifies the transport service id. For transports using
#               IP addressing (e.g. rdma) this field is the port number.
#
#               Depending on the transport type, this field will default to either
#               8009 or 4420 as follows.
#
#               UDP port 4420 and TCP port 4420 have been assigned by IANA
#               for use by NVMe over Fabrics. NVMe/RoCEv2 controllers use UDP port
#               4420 by default. NVMe/iWARP controllers use TCP port 4420 by
#               default.
#
#               TCP port 4420 has been assigned for use by NVMe over Fabrics and TCP
#               port 8009 has been assigned by IANA for use by NVMe over Fabrics
#               discovery. TCP port 8009 is the default TCP port for NVMe/TCP
#               discovery controllers. There is no default TCP port for NVMe/TCP I/O
#               controllers, the Transport Service Identifier (TRSVCID) field in the
#               Discovery Log Entry indicates the TCP port to use.
#
#               The TCP ports that may be used for NVMe/TCP I/O controllers include
#               TCP port 4420, and the Dynamic and/or Private TCP ports (i.e., ports
#               in the TCP port number range from 49152 to 65535). NVMe/TCP I/O
#               controllers should not use TCP port 8009. TCP port 4420 shall not be
#               used for both NVMe/iWARP and NVMe/TCP at the same IP address on the
#               same network.
#
#               Ref: https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?search=nvme
#
#             host-traddr=<traddr> [OPTIONAL]
#               This field specifies the network address used on the host to connect
#               to the Controller. For TCP, this sets the source address on the
#               socket.
#
#             host-iface=<iface>   [OPTIONAL]
#               This field specifies the network interface used on the host to
#               connect to the Controller (e.g. IP eth1, enp2s0, enx78e7d1ea46da).
#               This forces the connection to be made on a specific interface
#               instead of letting the system decide.
#
#             Multiple DCs may be specified on separate lines like this (this is
#             just an example and does not represent default values):
#
#             controller = transport=tcp;traddr=localhost;trsvcid=8009
#             controller = transport=tcp;traddr=[2001:db8:::370:7334];host-iface=enp0s8
#             controller = transport=fc;traddr=nn-0x204600a098cbcac6:pn-0x204700a098cbcac6
#                 ...
#
#             Type: String
#
#             Default: There is no default controller. STAF will not try to
#                      connect to a default Discovery Controller.
#controller=


# blacklist: Blacklisted controllers. Using mDNS to automatically detect
#            and connect controllers, can result in unintentional connections
#            being made. This keyword allows configuring the controllers that
#            should not be connected to (whatever the reason may be).
#
#            The syntax is the same as for "controller", except that the key
#            host-traddr does not apply. Multiple "blacklist" keywords may
#            appear in the config file to specify more than 1 blacklisted
#            controller.
#
#            Note 1: A minimal match approach is used to eliminate unwanted
#            controllers. That is, you do not need to specify all the
#            parameters to identify a controller. Just specifying the
#            host-iface, for example, can be used to blacklist all controllers
#            on an interface.
#
#            Note 2: "blacklist" takes precedence over "controller". A
#            controller specified by the "controller" keyword, can be
#            eliminated by the "blacklist" keyword.
#
#            Syntax: Same as "controller" above.
#            Type:   String
#
#            Example:
#             blacklist = transport=tcp;traddr=fe80::2c6e:dee7:857:26bb # Eliminate a specific address
#             blacklist = host-iface=enp0s8                             # Eliminate everything on this interface
#blacklist=
