SFCB will currently bind to any available IP address when the HTTP daemon is started (i.e. it will bind to ALL available IPv4 and IPv6 addresses). The only exception is when "httpLocalOnly: true" is set in sfcb.cfg, in which case it will bind to the IPv4 or IPv6 loopback address.
There are situations where it is useful to bind to specific IP or set of IP addresses. This patch introduces two new configuration options, "ip4AddrList" and "ip6AddrList" (and corresponding command-line options "-4" and "-6") to allow binding to an arbitrary list of IPv4 and/or IPv6 addresses, as follows:
## List of IPv4 addresses to bind to. The default behavior is to bind to any
## available IP address. To bind to specific IPs enter a comma delimited list
## of IPv4 addresses here. Note that a loopback address must be explicitly
## listed if that is desired. Do not include "0.0.0.0" (i.e. INADDR_ANY) as it
## will conflict with other addresses. All addresses are bound to http and/or
## https according to the values of enableHttp and enableHttps.
## The value listed here is ignored if the -4 option is set on the command line.
## Default is an empty list, which implies bind to any available IP.
#ip4AddrList:
## List of IPv6 addresses to bind to. The default behavior is to bind to any
## available IP address. To bind to specific IPs enter a comma delimited list
## of IPv6 addresses here. These addresses are bound in addition to any IPv4
## addresses listed above. Note that a loopback address must be explicitly
## listed if that is desired. Do not include "::" (i.e. IN6ADDR_ANY) as it
## will conflict with other addresses. All addresses are bound to http and/or
## https according to the values of enableHttp and enableHttps.
## The value listed here is ignored if the -6 option is set on the command line.
## Default is an empty list, which implies bind to any available IP.
#ip6AddrList:
There is no change in behavior for the httpLocalOnly option; when "httpLocalOnly: true" is set in sfcb.cfg it will override the configuration set by "ip4AddrList" and "ip6AddrList".
There is also no change in behavior for the "networkInterface" option, which forces SFCB to bind to a specific layer-2 interface. This option is independent from, and can be used in conjunction with, the new "ip4AddrList" and "ip6AddrList" options to bind to specific layer-3 addresses (although there is normally no need to do this).
Note that if specific bind IPs are set via ip4AddrList and ip6AddrList, and a specific networkInterface is set, any requested IP that is not assigned to the networkInterface will not be reachable. (In most cases there is no need to use the ip4AddrList or ip6AddrList options together with networkInterface; typically one or the other is sufficient.)
patch for SFCB 1.4
Committed to git master