rsockets: Add fine grained interception mechanism for preload library
By default the R-Sockets pre-loading library intercepts all
the stream and datagram sockets belonging to a launched
program processes and threads.
However, distributed application and database servers may
require fine grained interception to ensure that only the
processes which are listening for remote connections on the
RDMA transport need to be enabled with RDMA while remaining
can continue to use TCP as before. This allows proper
communication happening between various server components locally.
A configuration file based mechanism is introduced to facilitate
this fine grained interception mechanism. As part of preload
initialization, the configuration file is scanned and an
in-memory record store is created with all the entries found.
When a request is made to intercept a socket, its attributes
are cross checked with stored records to see whether we
should proceed with rsocket switch over.
Note: Right now, the fine grained interception mechanism is
enabled only for newly created sockets. Going forward,
this can be extened to select connections based on the
specified host/IP addresses and ports as well.
"preload_config" is the name of the configuration file which
should exist in the default configuration location
(usually the full path to this configuration file is:
<install-root>/etc/rdma/rsocket/preload_config)
of an installed rsocket library.
The sample format for this configuration file is shown below:
# Sample config file for preloading in a program specific way
#
# Each line entry should have the following format:
#
# program domain type protocol
#
# where,
#
# program - program or command name (string without spaces)
# domain - the socket domain: AF_INET / AF_INET6 / AF_IB
# type - the socket type: SOCK_STREAM / SOCK_DGRAM
# protocol - the socket protocol: IPPROTO_TCP / IPPROTO_UDP
#
# The wildcard value of '*' is supported for any
#
# Note:
# Lines beginning with '#' character are treated as comments.