Linux Kernel TIPC¶
Introduction¶
TIPC (Transparent Inter Process Communication) is a protocol that is specially designed for intra-cluster communication. It can be configured to transmit messages either on UDP or directly across Ethernet. Message delivery is sequence guaranteed, loss free and flow controlled. Latency times are shorter than with any other known protocol, while maximal throughput is comparable to that of TCP.
TIPC Features¶
Cluster wide IPC service
Have you ever wished you had the convenience of Unix Domain Sockets even when transmitting data between cluster nodes? Where you yourself determine the addresses you want to bind to and use? Where you don’t have to perform DNS lookups and worry about IP addresses? Where you don’t have to start timers to monitor the continuous existence of peer sockets? And yet without the downsides of that socket type, such as the risk of lingering inodes?
Welcome to the Transparent Inter Process Communication service, TIPC in short, which gives you all of this, and a lot more.
Service Addressing
A fundamental concept in TIPC is that of Service Addressing which makes it possible for a programmer to chose his own address, bind it to a server socket and let client programs use only that address for sending messages.
Service Tracking
A client wanting to wait for the availability of a server, uses the Service Tracking mechanism to subscribe for binding and unbinding/close events for sockets with the associated service address.
The service tracking mechanism can also be used for Cluster Topology Tracking, i.e., subscribing for availability/non-availability of cluster nodes.
Likewise, the service tracking mechanism can be used for Cluster Connectivity Tracking, i.e., subscribing for up/down events for individual links between cluster nodes.
Transmission Modes
Using a service address, a client can send datagram messages to a server socket.
Using the same address type, it can establish a connection towards an accepting server socket.
It can also use a service address to create and join a Communication Group, which is the TIPC manifestation of a brokerless message bus.
Multicast with very good performance and scalability is available both in datagram mode and in communication group mode.
Inter Node Links
Communication between any two nodes in a cluster is maintained by one or two Inter Node Links, which both guarantee data traffic integrity and monitor the peer node’s availability.
Cluster Scalability
By applying the Overlapping Ring Monitoring algorithm on the inter node links it is possible to scale TIPC clusters up to 1000 nodes with a maintained neighbor failure discovery time of 1-2 seconds. For smaller clusters this time can be made much shorter.
Neighbor Discovery
Neighbor Node Discovery in the cluster is done by Ethernet broadcast or UDP multicast, when any of those services are available. If not, configured peer IP addresses can be used.
Configuration
When running TIPC in single node mode no configuration whatsoever is needed. When running in cluster mode TIPC must as a minimum be given a node address (before Linux 4.17) and told which interface to attach to. The “tipc” configuration tool makes is possible to add and maintain many more configuration parameters.
Performance
TIPC message transfer latency times are better than in any other known protocol. Maximal byte throughput for inter-node connections is still somewhat lower than for TCP, while they are superior for intra-node and inter-container throughput on the same host.
Language Support
The TIPC user API has support for C, Python, Perl, Ruby, D and Go.
More Information¶
How to set up TIPC:
How to program with TIPC:
How to contribute to TIPC:
More details about TIPC specification:
Implementation¶
TIPC is implemented as a kernel module in net/tipc/ directory.
TIPC Base Types¶
-
struct tipc_subscription¶
TIPC network topology subscription object
Definition:
struct tipc_subscription {
struct tipc_subscr s;
struct tipc_event evt;
struct kref kref;
struct net *net;
struct timer_list timer;
struct list_head service_list;
struct list_head sub_list;
int conid;
bool inactive;
spinlock_t lock;
};
Members
shost-endian copy of the user subscription
evttemplate for events generated by subscription
krefreference count for this subscription
netnetwork namespace associated with subscription
timertimer governing subscription duration (optional)
service_listadjacent subscriptions in name sequence’s subscription list
sub_listadjacent subscriptions in subscriber’s subscription list
conidconnection identifier of topology server
inactivetrue if this subscription is inactive
lockserialize up/down and timer events
-
struct tipc_media_addr¶
destination address used by TIPC bearers
Definition:
struct tipc_media_addr {
u8 value[TIPC_MEDIA_INFO_SIZE];
u8 media_id;
u8 broadcast;
};
Members
valueaddress info (format defined by media)
media_idTIPC media type identifier
broadcastnon-zero if address is a broadcast address
-
struct tipc_media¶
Media specific info exposed to generic bearer layer
Definition:
struct tipc_media {
int (*send_msg)(struct net *net, struct sk_buff *buf,struct tipc_bearer *b, struct tipc_media_addr *dest);
int (*enable_media)(struct net *net, struct tipc_bearer *b, struct nlattr *attr[]);
void (*disable_media)(struct tipc_bearer *b);
int (*addr2str)(struct tipc_media_addr *addr,char *strbuf, int bufsz);
int (*addr2msg)(char *msg, struct tipc_media_addr *addr);
int (*msg2addr)(struct tipc_bearer *b,struct tipc_media_addr *addr, char *msg);
int (*raw2addr)(struct tipc_bearer *b,struct tipc_media_addr *addr, const char *raw);
u32 priority;
u32 tolerance;
u32 min_win;
u32 max_win;
u32 mtu;
u32 type_id;
u32 hwaddr_len;
char name[TIPC_MAX_MEDIA_NAME];
};
Members
send_msgroutine which handles buffer transmission
enable_mediaroutine which enables a media
disable_mediaroutine which disables a media
addr2strconvert media address format to string
addr2msgconvert from media addr format to discovery msg addr format
msg2addrconvert from discovery msg addr format to media addr format
raw2addrconvert from raw addr format to media addr format
prioritydefault link (and bearer) priority
tolerancedefault time (in ms) before declaring link failure
min_winminimum window (in packets) before declaring link congestion
max_winmaximum window (in packets) before declaring link congestion
mtumax packet size bearer can support for media type not dependent on underlying device MTU
type_idTIPC media identifier
hwaddr_lenTIPC media address len
namemedia name
-
struct tipc_bearer¶
Generic TIPC bearer structure
Definition:
struct tipc_bearer {
void __rcu *media_ptr;
u32 mtu;
struct tipc_media_addr addr;
char name[TIPC_MAX_BEARER_NAME];
struct tipc_media *media;
struct tipc_media_addr bcast_addr;
struct packet_type pt;
struct rcu_head rcu;
u32 priority;
u32 min_win;
u32 max_win;
u32 tolerance;
u32 domain;
u32 identity;
struct tipc_discoverer *disc;
char net_plane;
u16 encap_hlen;
unsigned long up;
refcount_t refcnt;
};
Members
media_ptrpointer to additional media-specific information about bearer
mtumax packet size bearer can support
addrmedia-specific address associated with bearer
namebearer name (format = media:interface)
mediaptr to media structure associated with bearer
bcast_addrmedia address used in broadcasting
ptpacket type for bearer
rcurcu struct for tipc_bearer
prioritydefault link priority for bearer
min_winminimum window (in packets) before declaring link congestion
max_winmaximum window (in packets) before declaring link congestion
tolerancedefault link tolerance for bearer
domainnetwork domain to which links can be established
identityarray index of this bearer within TIPC bearer array
discptr to link setup request
net_planenetwork plane (‘A’ through ‘H’) currently associated with bearer
encap_hlenencap headers length
upbearer up flag (bit 0)
refcnttipc_bearer reference counter
Note
media-specific code is responsible for initialization of the fields indicated below when a bearer is enabled; TIPC’s generic bearer code takes care of initializing all other fields.
-
struct publication¶
info about a published service address or range
Definition:
struct publication {
struct tipc_service_range sr;
struct tipc_socket_addr sk;
u16 scope;
u32 key;
u32 id;
struct list_head binding_node;
struct list_head binding_sock;
struct list_head local_publ;
struct list_head all_publ;
struct list_head list;
struct rcu_head rcu;
};
Members
srservice range represented by this publication
skaddress of socket bound to this publication
scopescope of publication, TIPC_NODE_SCOPE or TIPC_CLUSTER_SCOPE
keypublication key, unique across the cluster
idpublication id
binding_nodeall publications from the same node which bound this one - Remote publications: in node->publ_list; Used by node/name distr to withdraw publications when node is lost - Local/node scope publications: in name_table->node_scope list - Local/cluster scope publications: in name_table->cluster_scope list
binding_sockall publications from the same socket which bound this one Used by socket to withdraw publications when socket is unbound/released
local_publlist of identical publications made from this node Used by closest_first and multicast receive lookup algorithms
all_publall publications identical to this one, whatever node and scope Used by round-robin lookup algorithm
listto form a list of publications in temporal order
rcuRCU callback head used for deferred freeing
-
struct name_table¶
table containing all existing port name publications
Definition:
struct name_table {
struct hlist_head services[TIPC_NAMETBL_SIZE];
struct list_head node_scope;
struct list_head cluster_scope;
rwlock_t cluster_scope_lock;
u32 local_publ_count;
u32 rc_dests;
u32 snd_nxt;
};
Members
servicesname sequence hash lists
node_scopeall local publications with node scope - used by name_distr during re-init of name table
cluster_scopeall local publications with cluster scope - used by name_distr to send bulk updates to new nodes - used by name_distr during re-init of name table
cluster_scope_locklock for accessing cluster_scope
local_publ_countnumber of publications issued by this node
rc_destsdestination node counter
snd_nxtnext sequence number to be used
-
struct distr_item¶
publication info distributed to other nodes
Definition:
struct distr_item {
__be32 type;
__be32 lower;
__be32 upper;
__be32 port;
__be32 key;
};
Members
typename sequence type
lowername sequence lower bound
uppername sequence upper bound
portpublishing port reference
keypublication key
Description
===> All fields are stored in network byte order. <===
First 3 fields identify (name or) name sequence being published. Reference field uniquely identifies port that published name sequence. Key field uniquely identifies publication, in the event a port has multiple publications of the same name sequence.
Note
There is no field that identifies the publishing node because it is the same for all items contained within a publication message.
-
struct tipc_bc_base¶
base structure for keeping broadcast send state
Definition:
struct tipc_bc_base {
struct tipc_link *link;
struct sk_buff_head inputq;
int dests[MAX_BEARERS];
int primary_bearer;
bool bcast_support;
bool force_bcast;
bool rcast_support;
bool force_rcast;
int rc_ratio;
int bc_threshold;
};
Members
linkbroadcast send link structure
inputqdata input queue; will only carry SOCK_WAKEUP messages
destsarray keeping number of reachable destinations per bearer
primary_bearera bearer having links to all broadcast destinations, if any
bcast_supportindicates if primary bearer, if any, supports broadcast
force_bcastforces broadcast for multicast traffic
rcast_supportindicates if all peer nodes support replicast
force_rcastforces replicast for multicast traffic
rc_ratiodest count as percentage of cluster size where send method changes
bc_thresholdcalculated from rc_ratio; if dests > threshold use broadcast
TIPC Bearer Interfaces¶
-
struct tipc_media *tipc_media_find(const char *name)¶
locates specified media object by name
Parameters
const char *namename to locate
-
struct tipc_media *media_find_id(u8 type)¶
locates specified media object by type identifier
Parameters
u8 typetype identifier to locate
-
int tipc_media_addr_printf(char *buf, int len, struct tipc_media_addr *a)¶
record media address in print buffer
Parameters
char *bufoutput buffer
int lenoutput buffer size remaining
struct tipc_media_addr *ainput media address
-
int bearer_name_validate(const char *name, struct tipc_bearer_names *name_parts)¶
validate & (optionally) deconstruct bearer name
Parameters
const char *nameptr to bearer name string
struct tipc_bearer_names *name_partsptr to area for bearer name components (or NULL if not needed)
Return
1 if bearer name is valid, otherwise 0.
-
struct tipc_bearer *tipc_bearer_find(struct net *net, const char *name)¶
locates bearer object with matching bearer name
Parameters
struct net *netthe applicable net namespace
const char *namebearer name to locate
-
int tipc_enable_bearer(struct net *net, const char *name, u32 disc_domain, u32 prio, struct nlattr *attr[], struct netlink_ext_ack *extack)¶
enable bearer with the given name
Parameters
struct net *netthe applicable net namespace
const char *namebearer name to enable
u32 disc_domainbearer domain
u32 priobearer priority
struct nlattr *attr[]nlattr array
struct netlink_ext_ack *extacknetlink extended ack
-
int tipc_reset_bearer(struct net *net, struct tipc_bearer *b)¶
Reset all links established over this bearer
Parameters
struct net *netthe applicable net namespace
struct tipc_bearer *bthe target bearer
-
void bearer_disable(struct net *net, struct tipc_bearer *b)¶
disable this bearer
Parameters
struct net *netthe applicable net namespace
struct tipc_bearer *bthe bearer to disable
Note
This routine assumes caller holds RTNL lock.
-
int tipc_l2_send_msg(struct net *net, struct sk_buff *skb, struct tipc_bearer *b, struct tipc_media_addr *dest)¶
send a TIPC packet out over an L2 interface
Parameters
struct net *netthe associated network namespace
struct sk_buff *skbthe packet to be sent
struct tipc_bearer *bthe bearer through which the packet is to be sent
struct tipc_media_addr *destpeer destination address
-
int tipc_l2_rcv_msg(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)¶
handle incoming TIPC message from an interface
Parameters
struct sk_buff *skbthe received message
struct net_device *devthe net device that the packet was received on
struct packet_type *ptthe packet_type structure which was used to register this handler
struct net_device *orig_devthe original receive net device in case the device is a bond
Description
Accept only packets explicitly sent to this node, or broadcast packets; ignores packets sent using interface multicast, and traffic sent to other nodes (which can happen if interface is running in promiscuous mode).
-
int tipc_l2_device_event(struct notifier_block *nb, unsigned long evt, void *ptr)¶
handle device events from network device
Parameters
struct notifier_block *nbthe context of the notification
unsigned long evtthe type of event
void *ptrthe net device that the event was on
Description
This function is called by the Ethernet driver in case of link change event.
-
struct udp_media_addr¶
IP/UDP addressing information
Definition:
struct udp_media_addr {
__be16 proto;
__be16 port;
union {
struct in_addr ipv4;
struct in6_addr ipv6;
};
};
Members
protoEthernet protocol in use
portport being used
{unnamed_union}anonymous
ipv4IPv4 address of neighbor
ipv6IPv6 address of neighbor
Description
This is the bearer level originating address used in neighbor discovery messages, and all fields should be in network byte order
-
struct udp_bearer¶
ip/udp bearer data structure
Definition:
struct udp_bearer {
struct tipc_bearer __rcu *bearer;
struct socket *ubsock;
u32 ifindex;
struct work_struct work;
struct udp_replicast rcast;
};
Members
bearerassociated generic tipc bearer
ubsockbearer associated socket
ifindexlocal address scope
workused to schedule deferred work on a bearer
rcastassociated udp_replicast container
-
int tipc_parse_udp_addr(struct nlattr *nla, struct udp_media_addr *addr, u32 *scope_id)¶
build udp media address from netlink data
Parameters
struct nlattr *nlanetlink attribute containing sockaddr storage aligned address
struct udp_media_addr *addrtipc media address to fill with address, port and protocol type
u32 *scope_idIPv6 scope id pointer, not NULL indicates it’s required
-
int tipc_udp_enable(struct net *net, struct tipc_bearer *b, struct nlattr *attrs[])¶
callback to create a new udp bearer instance
Parameters
struct net *netnetwork namespace
struct tipc_bearer *bpointer to generic tipc_bearer
struct nlattr *attrs[]netlink bearer configuration
Description
validate the bearer parameters and initialize the udp bearer rtnl_lock should be held
TIPC Crypto Interfaces¶
-
struct tipc_tfm¶
TIPC TFM structure to form a list of TFMs
Definition:
struct tipc_tfm {
struct crypto_aead *tfm;
struct list_head list;
};
Members
tfmcipher handle/key
listlinked list of TFMs
-
struct tipc_aead¶
TIPC AEAD key structure
Definition:
struct tipc_aead {
#define TIPC_AEAD_HINT_LEN (5);
struct tipc_tfm * __percpu *tfm_entry;
struct tipc_crypto *crypto;
struct tipc_aead *cloned;
atomic_t users;
u32 salt;
u8 authsize;
u8 mode;
char hint[2 * TIPC_AEAD_HINT_LEN + 1];
struct rcu_head rcu;
struct tipc_aead_key *key;
u16 gen;
atomic64_t seqno ;
refcount_t refcnt ;
};
Members
tfm_entryper-cpu pointer to one entry in TFM list
cryptoTIPC crypto owns this key
clonedreference to the source key in case cloning
usersthe number of the key users (TX/RX)
saltthe key’s SALT value
authsizeauthentication tag size (max = 16)
modecrypto mode is applied to the key
hinta hint for user key
rcustruct rcu_head
keythe aead key
genthe key’s generation
seqnothe key seqno (cluster scope)
refcntthe key reference counter
-
struct tipc_crypto_stats¶
TIPC Crypto statistics
Definition:
struct tipc_crypto_stats {
unsigned int stat[MAX_STATS];
};
Members
statarray of crypto statistics
-
struct tipc_crypto¶
TIPC TX/RX crypto structure
Definition:
struct tipc_crypto {
struct net *net;
struct tipc_node *node;
struct tipc_aead __rcu *aead[KEY_MAX + 1];
atomic_t peer_rx_active;
u16 key_gen;
struct tipc_key key;
u8 skey_mode;
struct tipc_aead_key *skey;
struct workqueue_struct *wq;
struct delayed_work work;
#define KEY_DISTR_SCHED 1;
#define KEY_DISTR_COMPL 2;
atomic_t key_distr;
u32 rekeying_intv;
struct tipc_crypto_stats __percpu *stats;
char name[48];
atomic64_t sndnxt ;
unsigned long timer1;
unsigned long timer2;
union {
struct {
u8 working:1;
u8 key_master:1;
u8 legacy_user:1;
u8 nokey: 1;
};
u8 flags;
};
spinlock_t lock;
};
Members
netstruct net
nodeTIPC node (RX)
aeadarray of pointers to AEAD keys for encryption/decryption
peer_rx_activereplicated peer RX active key index
key_genTX/RX key generation
keythe key states
skey_modesession key’s mode
skeyreceived session key
wqcommon workqueue on TX crypto
workdelayed work sched for TX/RX
key_distrkey distributing state
rekeying_intvrekeying interval (in minutes)
statsthe crypto statistics
namethe crypto name
sndnxtthe per-peer sndnxt (TX)
timer1general timer 1 (jiffies)
timer2general timer 2 (jiffies)
{unnamed_union}anonymous
{unnamed_struct}anonymous
workingthe crypto is working or not
key_masterflag indicates if master key exists
legacy_userflag indicates if a peer joins w/o master key (for bwd comp.)
nokeyno key indication
flagscombined flags field
locktipc_key lock
-
int tipc_aead_key_validate(struct tipc_aead_key *ukey, struct genl_info *info)¶
Validate a AEAD user key
Parameters
struct tipc_aead_key *ukeypointer to user key data
struct genl_info *infonetlink info pointer
-
int tipc_aead_key_generate(struct tipc_aead_key *skey)¶
Generate new session key
Parameters
struct tipc_aead_key *skeyinput/output key with new content
Return
0 in case of success, otherwise < 0
-
void tipc_aead_free(struct rcu_head *rp)¶
Release AEAD key incl. all the TFMs in the list
Parameters
struct rcu_head *rprcu head pointer
-
struct crypto_aead *tipc_aead_tfm_next(struct tipc_aead *aead)¶
Move TFM entry to the next one in list and return it
Parameters
struct tipc_aead *aeadthe AEAD key pointer
-
int tipc_aead_init(struct tipc_aead **aead, struct tipc_aead_key *ukey, u8 mode)¶
Initiate TIPC AEAD
Parameters
struct tipc_aead **aeadreturned new TIPC AEAD key handle pointer
struct tipc_aead_key *ukeypointer to user key data
u8 modethe key mode
Description
Allocate a (list of) new cipher transformation (TFM) with the specific user key data if valid. The number of the allocated TFMs can be set via the sysfs “net/tipc/max_tfms” first. Also, all the other AEAD data are also initialized.
Return
0 if the initiation is successful, otherwise: < 0
Parameters
struct tipc_aead **dstdest key for the cloning
struct tipc_aead *srcsource key to clone from
Description
Make a “copy” of the source AEAD key data to the dest, the TFMs list is common for the keys. A reference to the source is hold in the “cloned” pointer for the later freeing purposes.
Note
this must be done in cluster-key mode only!
Return
0 in case of success, otherwise < 0
-
void *tipc_aead_mem_alloc(struct crypto_aead *tfm, unsigned int crypto_ctx_size, u8 **iv, struct aead_request **req, struct scatterlist **sg, int nsg)¶
Allocate memory for AEAD request operations
Parameters
struct crypto_aead *tfmcipher handle to be registered with the request
unsigned int crypto_ctx_sizesize of crypto context for callback
u8 **ivreturned pointer to IV data
struct aead_request **reqreturned pointer to AEAD request data
struct scatterlist **sgreturned pointer to SG lists
int nsgnumber of SG lists to be allocated
Description
Allocate memory to store the crypto context data, AEAD request, IV and SG lists, the memory layout is as follows: crypto_ctx || iv || aead_req || sg[]
Return
the pointer to the memory areas in case of success, otherwise NULL
-
int tipc_aead_encrypt(struct tipc_aead *aead, struct sk_buff *skb, struct tipc_bearer *b, struct tipc_media_addr *dst, struct tipc_node *__dnode)¶
Encrypt a message
Parameters
struct tipc_aead *aeadTIPC AEAD key for the message encryption
struct sk_buff *skbthe input/output skb
struct tipc_bearer *bTIPC bearer where the message will be delivered after the encryption
struct tipc_media_addr *dstthe destination media address
struct tipc_node *__dnodeTIPC dest node if “known”
Return
0 : if the encryption has completed
-EINPROGRESS/-EBUSY : if a callback will be performed
< 0 : the encryption has failed
-
int tipc_aead_decrypt(struct net *net, struct tipc_aead *aead, struct sk_buff *skb, struct tipc_bearer *b)¶
Decrypt an encrypted message
Parameters
struct net *netstruct net
struct tipc_aead *aeadTIPC AEAD for the message decryption
struct sk_buff *skbthe input/output skb
struct tipc_bearer *bTIPC bearer where the message has been received
Return
0 : if the decryption has completed
-EINPROGRESS/-EBUSY : if a callback will be performed
< 0 : the decryption has failed
Parameters
struct sk_buff *skbthe message buffer
Return
“true” if this is a valid encryption message, otherwise “false”
-
int tipc_ehdr_build(struct net *net, struct tipc_aead *aead, u8 tx_key, struct sk_buff *skb, struct tipc_crypto *__rx)¶
Build TIPC encryption message header
Parameters
struct net *netstruct net
struct tipc_aead *aeadTX AEAD key to be used for the message encryption
u8 tx_keykey id used for the message encryption
struct sk_buff *skbinput/output message skb
struct tipc_crypto *__rxRX crypto handle if dest is “known”
Return
the header size if the building is successful, otherwise < 0
-
int tipc_crypto_key_init(struct tipc_crypto *c, struct tipc_aead_key *ukey, u8 mode, bool master_key)¶
Initiate a new user / AEAD key
Parameters
struct tipc_crypto *cTIPC crypto to which new key is attached
struct tipc_aead_key *ukeythe user key
u8 modethe key mode (CLUSTER_KEY or PER_NODE_KEY)
bool master_keyspecify this is a cluster master key
Description
A new TIPC AEAD key will be allocated and initiated with the specified user key, then attached to the TIPC crypto.
Return
new key id in case of success, otherwise: < 0
-
int tipc_crypto_key_attach(struct tipc_crypto *c, struct tipc_aead *aead, u8 pos, bool master_key)¶
Attach a new AEAD key to TIPC crypto
Parameters
struct tipc_crypto *cTIPC crypto to which the new AEAD key is attached
struct tipc_aead *aeadthe new AEAD key pointer
u8 posdesired slot in the crypto key array, = 0 if any!
bool master_keyspecify this is a cluster master key
Return
new key id in case of success, otherwise: -EBUSY
-
bool tipc_crypto_key_try_align(struct tipc_crypto *rx, u8 new_pending)¶
Align RX keys if possible
Parameters
struct tipc_crypto *rxRX crypto handle
u8 new_pendingnew pending slot if aligned (= TX key from peer)
Description
Peer has used an unknown key slot, this only happens when peer has left and rejoned, or we are newcomer. That means, there must be no active key but a pending key at unaligned slot. If so, we try to move the pending key to the new slot.
Note
A potential passive key can exist, it will be shifted correspondingly!
Return
“true” if key is successfully aligned, otherwise “false”
-
struct tipc_aead *tipc_crypto_key_pick_tx(struct tipc_crypto *tx, struct tipc_crypto *rx, struct sk_buff *skb, u8 tx_key)¶
Pick one TX key for message decryption
Parameters
struct tipc_crypto *txTX crypto handle
struct tipc_crypto *rxRX crypto handle (can be NULL)
struct sk_buff *skbthe message skb which will be decrypted later
u8 tx_keypeer TX key id
Description
This function looks up the existing TX keys and pick one which is suitable for the message decryption, that must be a cluster key and not used before on the same message (i.e. recursive).
Return
the TX AEAD key handle in case of success, otherwise NULL
-
void tipc_crypto_key_synch(struct tipc_crypto *rx, struct sk_buff *skb)¶
Synch own key data according to peer key status
Parameters
struct tipc_crypto *rxRX crypto handle
struct sk_buff *skbTIPCv2 message buffer (incl. the ehdr from peer)
Description
This function updates the peer node related data as the peer RX active key has changed, so the number of TX keys’ users on this node are increased and decreased correspondingly.
It also considers if peer has no key, then we need to make own master key (if any) taking over i.e. starting grace period and also trigger key distributing process.
The “per-peer” sndnxt is also reset when the peer key has switched.
-
int tipc_crypto_xmit(struct net *net, struct sk_buff **skb, struct tipc_bearer *b, struct tipc_media_addr *dst, struct tipc_node *__dnode)¶
Build & encrypt TIPC message for xmit
Parameters
struct net *netstruct net
struct sk_buff **skbinput/output message skb pointer
struct tipc_bearer *bbearer used for xmit later
struct tipc_media_addr *dstdestination media address
struct tipc_node *__dnodedestination node for reference if any
Description
First, build an encryption message header on the top of the message, then encrypt the original TIPC message by using the pending, master or active key with this preference order. If the encryption is successful, the encrypted skb is returned directly or via the callback. Otherwise, the skb is freed!
Return
0 : the encryption has succeeded (or no encryption)
-EINPROGRESS/-EBUSY : the encryption is ongoing, a callback will be made
- -ENOKEK
: the encryption has failed due to no key
- -EKEYREVOKED
: the encryption has failed due to key revoked
- -ENOMEM
: the encryption has failed due to no memory
< 0 : the encryption has failed due to other reasons
-
int tipc_crypto_rcv(struct net *net, struct tipc_crypto *rx, struct sk_buff **skb, struct tipc_bearer *b)¶
Decrypt an encrypted TIPC message from peer
Parameters
struct net *netstruct net
struct tipc_crypto *rxRX crypto handle
struct sk_buff **skbinput/output message skb pointer
struct tipc_bearer *bbearer where the message has been received
Description
If the decryption is successful, the decrypted skb is returned directly or
as the callback, the encryption header and auth tag will be trimed out
before forwarding to tipc_rcv() via the tipc_crypto_rcv_complete().
Otherwise, the skb will be freed!
Note
RX key(s) can be re-aligned, or in case of no key suitable, TX cluster key(s) can be taken for decryption (- recursive).
Return
0 : the decryption has successfully completed
-EINPROGRESS/-EBUSY : the decryption is ongoing, a callback will be made
- -ENOKEY
: the decryption has failed due to no key
- -EBADMSG
: the decryption has failed due to bad message
- -ENOMEM
: the decryption has failed due to no memory
< 0 : the decryption has failed due to other reasons
-
void tipc_crypto_msg_rcv(struct net *net, struct sk_buff *skb)¶
Common ‘MSG_CRYPTO’ processing point
Parameters
struct net *netthe struct net
struct sk_buff *skbthe receiving message buffer
-
int tipc_crypto_key_distr(struct tipc_crypto *tx, u8 key, struct tipc_node *dest)¶
Distribute a TX key
Parameters
struct tipc_crypto *txthe TX crypto
u8 keythe key’s index
struct tipc_node *destthe destination tipc node, = NULL if distributing to all nodes
Return
0 in case of success, otherwise < 0
-
int tipc_crypto_key_xmit(struct net *net, struct tipc_aead_key *skey, u16 gen, u8 mode, u32 dnode)¶
Send a session key
Parameters
struct net *netthe struct net
struct tipc_aead_key *skeythe session key to be sent
u16 genthe key’s generation
u8 modethe key’s mode
u32 dnodethe destination node address, = 0 if broadcasting to all nodes
Description
The session key ‘skey’ is packed in a TIPC v2 ‘MSG_CRYPTO/KEY_DISTR_MSG’ as its data section, then xmit-ed through the uc/bc link.
Return
0 in case of success, otherwise < 0
-
bool tipc_crypto_key_rcv(struct tipc_crypto *rx, struct tipc_msg *hdr)¶
Receive a session key
Parameters
struct tipc_crypto *rxthe RX crypto
struct tipc_msg *hdrthe TIPC v2 message incl. the receiving session key in its data
Description
This function retrieves the session key in the message from peer, then schedules a RX work to attach the key to the corresponding RX crypto.
Return
“true” if the key has been scheduled for attaching, otherwise “false”.
-
void tipc_crypto_work_rx(struct work_struct *work)¶
Scheduled RX works handler
Parameters
struct work_struct *workthe struct RX work
Description
The function processes the previous scheduled works i.e. distributing TX key or attaching a received session key on RX crypto.
-
void tipc_crypto_rekeying_sched(struct tipc_crypto *tx, bool changed, u32 new_intv)¶
(Re)schedule rekeying w/o new interval
Parameters
struct tipc_crypto *txTX crypto
bool changedif the rekeying needs to be rescheduled with new interval
u32 new_intvnew rekeying interval (when “changed” = true)
-
void tipc_crypto_work_tx(struct work_struct *work)¶
Scheduled TX works handler
Parameters
struct work_struct *workthe struct TX work
Description
The function processes the previous scheduled work, i.e. key rekeying, by generating a new session key based on current one, then attaching it to the TX crypto and finally distributing it to peers. It also re-schedules the rekeying if needed.
TIPC Discoverer Interfaces¶
-
struct tipc_discoverer¶
information about an ongoing link setup request
Definition:
struct tipc_discoverer {
u32 bearer_id;
struct tipc_media_addr dest;
struct net *net;
u32 domain;
int num_nodes;
spinlock_t lock;
struct sk_buff *skb;
struct timer_list timer;
unsigned long timer_intv;
};
Members
bearer_ididentity of bearer issuing requests
destdestination address for request messages
netnetwork namespace instance
domainnetwork domain to which links can be established
num_nodesnumber of nodes currently discovered (i.e. with an active link)
lockspinlock for controlling access to requests
skbrequest message to be (repeatedly) sent
timertimer governing period between requests
timer_intvcurrent interval between requests (in ms)
-
void tipc_disc_init_msg(struct net *net, struct sk_buff *skb, u32 mtyp, struct tipc_bearer *b)¶
initialize a link setup message
Parameters
struct net *netthe applicable net namespace
struct sk_buff *skbbuffer containing message
u32 mtypmessage type (request or response)
struct tipc_bearer *bptr to bearer issuing message
-
void disc_dupl_alert(struct tipc_bearer *b, u32 node_addr, struct tipc_media_addr *media_addr)¶
issue node address duplication alert
Parameters
struct tipc_bearer *bpointer to bearer detecting duplication
u32 node_addrduplicated node address
struct tipc_media_addr *media_addrmedia address advertised by duplicated node
-
void tipc_disc_rcv(struct net *net, struct sk_buff *skb, struct tipc_bearer *b)¶
handle incoming discovery message (request or response)
Parameters
struct net *netapplicable net namespace
struct sk_buff *skbbuffer containing message
struct tipc_bearer *bbearer that message arrived on
-
int tipc_disc_create(struct net *net, struct tipc_bearer *b, struct tipc_media_addr *dest, struct sk_buff **skb)¶
create object to send periodic link setup requests
Parameters
struct net *netthe applicable net namespace
struct tipc_bearer *bptr to bearer issuing requests
struct tipc_media_addr *destdestination address for request messages
struct sk_buff **skbpointer to created frame
Return
0 if successful, otherwise -errno.
-
void tipc_disc_delete(struct tipc_discoverer *d)¶
destroy object sending periodic link setup requests
Parameters
struct tipc_discoverer *dptr to link dest structure
-
void tipc_disc_reset(struct net *net, struct tipc_bearer *b)¶
reset object to send periodic link setup requests
Parameters
struct net *netthe applicable net namespace
struct tipc_bearer *bptr to bearer issuing requests
TIPC Link Interfaces¶
-
struct tipc_link¶
TIPC link data structure
Definition:
struct tipc_link {
u32 addr;
char name[TIPC_MAX_LINK_NAME];
struct net *net;
u16 peer_session;
u16 session;
u16 snd_nxt_state;
u16 rcv_nxt_state;
u32 peer_bearer_id;
u32 bearer_id;
u32 tolerance;
u32 abort_limit;
u32 state;
u16 peer_caps;
bool in_session;
bool active;
u32 silent_intv_cnt;
char if_name[TIPC_MAX_IF_NAME];
u32 priority;
char net_plane;
struct tipc_mon_state mon_state;
u16 rst_cnt;
u16 drop_point;
struct sk_buff *failover_reasm_skb;
struct sk_buff_head failover_deferdq;
u16 mtu;
u16 advertised_mtu;
struct sk_buff_head transmq;
struct sk_buff_head backlogq;
struct {
u16 len;
u16 limit;
struct sk_buff *target_bskb;
} backlog[5];
u16 snd_nxt;
u16 rcv_nxt;
u32 rcv_unacked;
struct sk_buff_head deferdq;
struct sk_buff_head *inputq;
struct sk_buff_head *namedq;
struct sk_buff_head wakeupq;
u16 window;
u16 min_win;
u16 ssthresh;
u16 max_win;
u16 cong_acks;
u16 checkpoint;
struct sk_buff *reasm_buf;
struct sk_buff *reasm_tnlmsg;
u16 ackers;
u16 acked;
u16 last_gap;
struct tipc_gap_ack_blks *last_ga;
struct tipc_link *bc_rcvlink;
struct tipc_link *bc_sndlink;
u8 nack_state;
bool bc_peer_is_up;
struct tipc_stats stats;
};
Members
addrnetwork address of link’s peer node
namelink name character string
netpointer to namespace struct
peer_sessionlink session # being used by peer end of link
sessionsession to be used by link
snd_nxt_statenext send seq number
rcv_nxt_statenext rcv seq number
peer_bearer_idbearer id used by link’s peer endpoint
bearer_idlocal bearer id used by link
toleranceminimum link continuity loss needed to reset link [in ms]
abort_limit# of unacknowledged continuity probes needed to reset link
statecurrent state of link FSM
peer_capsbitmap describing capabilities of peer node
in_sessionhave received ACTIVATE_MSG from peer
activelink is active
silent_intv_cnt# of timer intervals without any reception from peer
if_nameassociated interface name
prioritycurrent link priority
net_planecurrent link network plane (‘A’ through ‘H’)
mon_statecookie with information needed by link monitor
rst_cntlink reset counter
drop_pointseq number for failover handling (FIXME)
failover_reasm_skbsaved failover msg ptr (FIXME)
failover_deferdqdeferred message queue for failover processing (FIXME)
mtucurrent maximum packet size for this link
advertised_mtuadvertised own mtu when link is being established
transmqthe link’s transmit queue
backlogqqueue for messages waiting to be sent
backloglink’s backlog by priority (importance)
snd_nxtnext sequence number to be used
rcv_nxtnext sequence number to expect for inbound messages
rcv_unacked# messages read by user, but not yet acked back to peer
deferdqdeferred receive queue
inputqbuffer queue for messages to be delivered upwards
namedqbuffer queue for name table messages to be delivered upwards
wakeupqlinked list of wakeup msgs waiting for link congestion to abate
windowsliding window size for congestion handling
min_winminimal send window to be used by link
ssthreshslow start threshold for congestion handling
max_winmaximal send window to be used by link
cong_ackscongestion acks for congestion avoidance (FIXME)
checkpointseq number for congestion window size handling
reasm_bufhead of partially reassembled inbound message fragments
reasm_tnlmsgfragmentation/reassembly area for tunnel protocol message
ackers# of peers that needs to ack each packet before it can be released
acked# last packet acked by a certain peer. Used for broadcast.
last_gaplast gap ack blocks for bcast (FIXME)
last_gaptr to gap ack blocks
bc_rcvlinkthe peer specific link used for broadcast reception
bc_sndlinkthe namespace global link used for broadcast sending
nack_statebcast nack state
bc_peer_is_uppeer has acked the bcast init msg
statscollects statistics regarding link activity
-
bool tipc_link_create(struct net *net, char *if_name, int bearer_id, int tolerance, char net_plane, u32 mtu, int priority, u32 min_win, u32 max_win, u32 session, u32 self, u32 peer, u8 *peer_id, u16 peer_caps, struct tipc_link *bc_sndlink, struct tipc_link *bc_rcvlink, struct sk_buff_head *inputq, struct sk_buff_head *namedq, struct tipc_link **link)¶
create a new link
Parameters
struct net *netpointer to associated network namespace
char *if_nameassociated interface name
int bearer_idid (index) of associated bearer
int tolerancelink tolerance to be used by link
char net_planenetwork plane (A,B,c..) this link belongs to
u32 mtumtu to be advertised by link
int prioritypriority to be used by link
u32 min_winminimal send window to be used by link
u32 max_winmaximal send window to be used by link
u32 sessionsession to be used by link
u32 selflocal unicast link id
u32 peernode id of peer node
u8 *peer_id128-bit ID of peer
u16 peer_capsbitmap describing peer node capabilities
struct tipc_link *bc_sndlinkthe namespace global link used for broadcast sending
struct tipc_link *bc_rcvlinkthe peer specific link used for broadcast reception
struct sk_buff_head *inputqqueue to put messages ready for delivery
struct sk_buff_head *namedqqueue to put binding table update messages ready for delivery
struct tipc_link **linkreturn value, pointer to put the created link
Return
true if link was created, otherwise false
-
bool tipc_link_bc_create(struct net *net, u32 ownnode, u32 peer, u8 *peer_id, int mtu, u32 min_win, u32 max_win, u16 peer_caps, struct sk_buff_head *inputq, struct sk_buff_head *namedq, struct tipc_link *bc_sndlink, struct tipc_link **link)¶
create new link to be used for broadcast
Parameters
struct net *netpointer to associated network namespace
u32 ownnodeidentity of own node
u32 peernode id of peer node
u8 *peer_id128-bit ID of peer
int mtumtu to be used initially if no peers
u32 min_winminimal send window to be used by link
u32 max_winmaximal send window to be used by link
u16 peer_capsbitmap describing peer node capabilities
struct sk_buff_head *inputqqueue to put messages ready for delivery
struct sk_buff_head *namedqqueue to put binding table update messages ready for delivery
struct tipc_link *bc_sndlinkthe namespace global link used for broadcast sending
struct tipc_link **linkreturn value, pointer to put the created link
Return
true if link was created, otherwise false
Parameters
struct tipc_link *lpointer to link
int evtstate machine event to be processed
Parameters
struct tipc_link *ltipc link to be checked
Return
true if the link ‘silent_intv_cnt’ is about to reach the ‘abort_limit’ value, otherwise false
-
int link_schedule_user(struct tipc_link *l, struct tipc_msg *hdr)¶
schedule a message sender for wakeup after congestion
Parameters
struct tipc_link *lcongested link
struct tipc_msg *hdrheader of message that is being sent Create pseudo msg to send back to user when congestion abates
Parameters
struct tipc_link *lcongested link Wake up a number of waiting users, as permitted by available space in the send queue
-
void tipc_link_set_skb_retransmit_time(struct sk_buff *skb, struct tipc_link *l)¶
set the time at which retransmission of the given skb should be next attempted
Parameters
struct sk_buff *skbskb to set a future retransmission time for
struct tipc_link *llink the skb will be transmitted on
-
int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list, struct sk_buff_head *xmitq)¶
enqueue buffer list according to queue situation
Parameters
struct tipc_link *llink to use
struct sk_buff_head *listchain of buffers containing message
struct sk_buff_head *xmitqreturned list of packets to be sent by caller
Description
Consumes the buffer chain. Messages at TIPC_SYSTEM_IMPORTANCE are always accepted
Return
0 if success, or errno: -ELINKCONG, -EMSGSIZE or -ENOBUFS
-
bool link_retransmit_failure(struct tipc_link *l, struct tipc_link *r, int *rc)¶
Detect repeated retransmit failures
Parameters
struct tipc_link *ltipc link sender
struct tipc_link *rtipc link receiver (= l in case of unicast)
int *rcreturned code
Return
true if the repeated retransmit failures happens, otherwise false
-
u16 tipc_get_gap_ack_blks(struct tipc_gap_ack_blks **ga, struct tipc_link *l, struct tipc_msg *hdr, bool uc)¶
get Gap ACK blocks from PROTOCOL/STATE_MSG
Parameters
struct tipc_gap_ack_blks **gareturned pointer to the Gap ACK blocks if any
struct tipc_link *lthe tipc link
struct tipc_msg *hdrthe PROTOCOL/STATE_MSG header
bool ucdesired Gap ACK blocks type, i.e. unicast (= 1) or broadcast (= 0)
Return
the total Gap ACK blocks size
-
void tipc_link_failover_prepare(struct tipc_link *l, struct tipc_link *tnl, struct sk_buff_head *xmitq)¶
prepare tnl for link failover
Parameters
struct tipc_link *lfailover link
struct tipc_link *tnltunnel link
struct sk_buff_head *xmitqqueue for messages to be xmited
Description
This is a special version of the precursor - tipc_link_tnl_prepare(),
see the tipc_node_link_failover() for details
Parameters
struct tipc_link *lpointer to link
Parameters
struct tipc_link *ltipc link to be dumped
u16 dqueuesbitmask to decide if any link queue to be dumped? - TIPC_DUMP_NONE: don’t dump link queues - TIPC_DUMP_TRANSMQ: dump link transmq queue - TIPC_DUMP_BACKLOGQ: dump link backlog queue - TIPC_DUMP_DEFERDQ: dump link deferd queue - TIPC_DUMP_INPUTQ: dump link input queue - TIPC_DUMP_WAKEUP: dump link wakeup queue - TIPC_DUMP_ALL: dump all the link queues above
char *bufreturned buffer of dump data in format
TIPC msg Interfaces¶
Parameters
u32 sizemessage size (including TIPC header)
gfp_t gfpmemory allocation flags
Return
a new buffer with data pointers set to the specified size.
NOTE
Headroom is reserved to allow prepending of a data link header. There may also be unrequested tailroom present at the buffer’s end.
-
int tipc_msg_append(struct tipc_msg *_hdr, struct msghdr *m, int dlen, int mss, struct sk_buff_head *txq)¶
Append data to tail of an existing buffer queue
Parameters
struct tipc_msg *_hdrheader to be used
struct msghdr *mthe data to be appended
int dlensize of data to be appended
int mssmax allowable size of buffer
struct sk_buff_head *txqqueue to append to
Return
the number of 1k blocks appended or errno value
-
int tipc_msg_fragment(struct sk_buff *skb, const struct tipc_msg *hdr, int pktmax, struct sk_buff_head *frags)¶
build a fragment skb list for TIPC message
Parameters
struct sk_buff *skbTIPC message skb
const struct tipc_msg *hdrinternal msg header to be put on the top of the fragments
int pktmaxmax size of a fragment incl. the header
struct sk_buff_head *fragsreturned fragment skb list
Return
0 if the fragmentation is successful, otherwise: -EINVAL or -ENOMEM
-
int tipc_msg_build(struct tipc_msg *mhdr, struct msghdr *m, int offset, int dsz, int pktmax, struct sk_buff_head *list)¶
create buffer chain containing specified header and data
Parameters
struct tipc_msg *mhdrMessage header, to be prepended to data
struct msghdr *mUser message
int offsetbuffer offset for fragmented messages (FIXME)
int dszTotal length of user data
int pktmaxMax packet size that can be used
struct sk_buff_head *listBuffer or chain of buffers to be returned to caller
Description
Note that the recursive call we are making here is safe, since it can logically go only one further level down.
Return
message data size or errno: -ENOMEM, -EFAULT
-
bool tipc_msg_bundle(struct sk_buff *bskb, struct tipc_msg *msg, u32 max)¶
Append contents of a buffer to tail of an existing one
Parameters
struct sk_buff *bskbthe bundle buffer to append to
struct tipc_msg *msgmessage to be appended
u32 maxmax allowable size for the bundle buffer
Return
“true” if bundling has been performed, otherwise “false”
-
bool tipc_msg_try_bundle(struct sk_buff *tskb, struct sk_buff **skb, u32 mss, u32 dnode, bool *new_bundle)¶
Try to bundle a new message to the last one
Parameters
struct sk_buff *tskbthe last/target message to which the new one will be appended
struct sk_buff **skbthe new message skb pointer
u32 mssmax message size (header inclusive)
u32 dnodedestination node for the message
bool *new_bundleif this call made a new bundle or not
Return
“true” if the new message skb is potential for bundling this time or later, in the case a bundling has been done this time, the skb is consumed (the skb pointer = NULL). Otherwise, “false” if the skb cannot be bundled at all.
-
bool tipc_msg_extract(struct sk_buff *skb, struct sk_buff **iskb, int *pos)¶
extract bundled inner packet from buffer
Parameters
struct sk_buff *skbbuffer to be extracted from.
struct sk_buff **iskbextracted inner buffer, to be returned
int *posposition in outer message of msg to be extracted. Returns position of next msg. Consumes outer buffer when last packet extracted
Return
true when there is an extracted buffer, otherwise false
-
bool tipc_msg_reverse(u32 own_node, struct sk_buff **skb, int err)¶
swap source and destination addresses and add error code
Parameters
u32 own_nodeoriginating node id for reversed message
struct sk_buff **skbbuffer containing message to be reversed; will be consumed
int errerror code to be set in message, if any Replaces consumed buffer with new one when successful
Return
true if success, otherwise false
-
bool tipc_msg_lookup_dest(struct net *net, struct sk_buff *skb, int *err)¶
try to find new destination for named message
Parameters
struct net *netpointer to associated network namespace
struct sk_buff *skbthe buffer containing the message.
int *errerror code to be used by caller if lookup fails Does not consume buffer
Return
true if a destination is found, false otherwise
TIPC Name Interfaces¶
-
struct service_range¶
container for all bindings of a service range
Definition:
struct service_range {
u32 lower;
u32 upper;
struct rb_node tree_node;
u32 max;
struct list_head local_publ;
struct list_head all_publ;
};
Members
lowerservice range lower bound
upperservice range upper bound
tree_nodemember of service range RB tree
maxlargest ‘upper’ in this node subtree
local_publlist of identical publications made from this node Used by closest_first lookup and multicast lookup algorithm
all_publall publications identical to this one, whatever node and scope Used by round-robin lookup algorithm
-
struct tipc_service¶
container for all published instances of a service type
Definition:
struct tipc_service {
u32 type;
u32 publ_cnt;
struct rb_root ranges;
struct hlist_node service_list;
struct list_head subscriptions;
spinlock_t lock;
struct rcu_head rcu;
};
Members
type32 bit ‘type’ value for service
publ_cntincreasing counter for publications in this service
rangesrb tree containing all service ranges for this service
service_listlinks to adjacent name ranges in hash chain
subscriptionslist of subscriptions for this service type
lockspinlock controlling access to pertaining service ranges/publications
rcuRCU callback head used for deferred freeing
-
service_range_foreach_match¶
service_range_foreach_match (sr, sc, start, end)
iterate over tipc service rbtree for each range match
Parameters
srthe service range pointer as a loop cursor
scthe pointer to tipc service which holds the service range rbtree
startbeginning of the search range (end >= start) for matching
endend of the search range (end >= start) for matching
-
struct service_range *service_range_match_first(struct rb_node *n, u32 start, u32 end)¶
find first service range matching a range
Parameters
struct rb_node *nthe root node of service range rbtree for searching
u32 startbeginning of the search range (end >= start) for matching
u32 endend of the search range (end >= start) for matching
Return
the leftmost service range node in the rbtree that overlaps the specific range if any. Otherwise, returns NULL.
-
struct service_range *service_range_match_next(struct rb_node *n, u32 start, u32 end)¶
find next service range matching a range
Parameters
struct rb_node *na node in service range rbtree from which the searching starts
u32 startbeginning of the search range (end >= start) for matching
u32 endend of the search range (end >= start) for matching
Return
the next service range node to the given node in the rbtree that overlaps the specific range if any. Otherwise, returns NULL.
-
struct publication *tipc_publ_create(struct tipc_uaddr *ua, struct tipc_socket_addr *sk, u32 key)¶
create a publication structure
Parameters
struct tipc_uaddr *uathe service range the user is binding to
struct tipc_socket_addr *skthe address of the socket that is bound
u32 keypublication key
-
struct tipc_service *tipc_service_create(struct net *net, struct tipc_uaddr *ua)¶
create a service structure for the specified ‘type’
Parameters
struct net *netnetwork namespace
struct tipc_uaddr *uaaddress representing the service to be bound
Description
Allocates a single range structure and sets it to all 0’s.
-
struct publication *tipc_service_remove_publ(struct service_range *r, struct tipc_socket_addr *sk, u32 key)¶
remove a publication from a service
Parameters
struct service_range *rservice_range to remove publication from
struct tipc_socket_addr *skaddress publishing socket
u32 keytarget publication key
-
void tipc_service_subscribe(struct tipc_service *service, struct tipc_subscription *sub)¶
attach a subscription, and optionally issue the prescribed number of events if there is any service range overlapping with the requested range
Parameters
struct tipc_service *servicethe tipc_service to attach the sub to
struct tipc_subscription *subthe subscription to attach
-
bool tipc_nametbl_lookup_anycast(struct net *net, struct tipc_uaddr *ua, struct tipc_socket_addr *sk)¶
perform service instance to socket translation
Parameters
struct net *netnetwork namespace
struct tipc_uaddr *uaservice address to look up
struct tipc_socket_addr *skaddress to socket we want to find
Description
On entry, a non-zero ‘sk->node’ indicates the node where we want lookup to be performed, which may not be this one.
On exit:
If lookup is deferred to another node, leave ‘sk->node’ unchanged and return ‘true’.
If lookup is successful, set the ‘sk->node’ and ‘sk->ref’ (== portid) which represent the bound socket and return ‘true’.
If lookup fails, return ‘false’
Note that for legacy users (node configured with Z.C.N address format) the ‘closest-first’ lookup algorithm must be maintained, i.e., if sk.node is 0 we must look in the local binding list first
-
void tipc_nametbl_withdraw(struct net *net, struct tipc_uaddr *ua, struct tipc_socket_addr *sk, u32 key)¶
withdraw a service binding
Parameters
struct net *netnetwork namespace
struct tipc_uaddr *uaservice address/range being unbound
struct tipc_socket_addr *skaddress of the socket being unbound from
u32 keytarget publication key
-
bool tipc_nametbl_subscribe(struct tipc_subscription *sub)¶
add a subscription object to the name table
Parameters
struct tipc_subscription *subsubscription to add
-
void tipc_nametbl_unsubscribe(struct tipc_subscription *sub)¶
remove a subscription object from name table
Parameters
struct tipc_subscription *subsubscription to remove
-
void tipc_service_delete(struct net *net, struct tipc_service *sc)¶
purge all publications for a service and delete it
Parameters
struct net *netthe associated network namespace
struct tipc_service *sctipc_service to delete
-
void publ_to_item(struct distr_item *i, struct publication *p)¶
add publication info to a publication message
Parameters
struct distr_item *ilocation of item in the message
struct publication *ppublication info
-
struct sk_buff *named_prepare_buf(struct net *net, u32 type, u32 size, u32 dest)¶
allocate & initialize a publication message
Parameters
struct net *netthe associated network namespace
u32 typemessage type
u32 sizepayload size
u32 destdestination node
Description
The buffer returned is of size INT_H_SIZE + payload size
-
struct sk_buff *tipc_named_publish(struct net *net, struct publication *p)¶
tell other nodes about a new publication by this node
Parameters
struct net *netthe associated network namespace
struct publication *pthe new publication
-
struct sk_buff *tipc_named_withdraw(struct net *net, struct publication *p)¶
tell other nodes about a withdrawn publication by this node
Parameters
struct net *netthe associated network namespace
struct publication *pthe withdrawn publication
-
void named_distribute(struct net *net, struct sk_buff_head *list, u32 dnode, struct list_head *pls, u16 seqno)¶
prepare name info for bulk distribution to another node
Parameters
struct net *netthe associated network namespace
struct sk_buff_head *listlist of messages (buffers) to be returned from this function
u32 dnodenode to be updated
struct list_head *plslinked list of publication items to be packed into buffer chain
u16 seqnosequence number for this message
-
void tipc_named_node_up(struct net *net, u32 dnode, u16 capabilities)¶
tell specified node about all publications by this node
Parameters
struct net *netthe associated network namespace
u32 dnodedestination node
u16 capabilitiespeer node’s capabilities
-
void tipc_publ_purge(struct net *net, struct publication *p, u32 addr)¶
remove publication associated with a failed node
Parameters
struct net *netthe associated network namespace
struct publication *pthe publication to remove
u32 addrfailed node’s address
Description
Invoked for each publication issued by a newly failed node. Removes publication structure from name table & deletes it.
-
bool tipc_update_nametbl(struct net *net, struct distr_item *i, u32 node, u32 dtype)¶
try to process a nametable update and notify subscribers
Parameters
struct net *netthe associated network namespace
struct distr_item *ilocation of item in the message
u32 nodenode address
u32 dtypename distributor message type
Description
tipc_nametbl_lock must be held.
Return
the publication item if successful, otherwise NULL.
-
void tipc_named_rcv(struct net *net, struct sk_buff_head *namedq, u16 *rcv_nxt, bool *open)¶
process name table update messages sent by another node
Parameters
struct net *netthe associated network namespace
struct sk_buff_head *namedqqueue to receive from
u16 *rcv_nxtstore last received seqno here
bool *openlast bulk msg was received (FIXME)
Parameters
struct net *netthe associated network namespace
Description
This routine is called whenever TIPC networking is enabled. All name table entries published by this node are updated to reflect the node’s new network address.
TIPC Node Management Interfaces¶
-
struct tipc_node¶
TIPC node structure
Definition:
struct tipc_node {
u32 addr;
struct kref kref;
rwlock_t lock;
struct net *net;
struct hlist_node hash;
int active_links[2];
struct tipc_link_entry links[MAX_BEARERS];
struct tipc_bclink_entry bc_entry;
int action_flags;
struct list_head list;
int state;
bool preliminary;
bool failover_sent;
u16 sync_point;
int link_cnt;
u16 working_links;
u16 capabilities;
u32 signature;
u32 link_id;
u8 peer_id[16];
char peer_id_string[NODE_ID_STR_LEN];
struct list_head publ_list;
struct list_head conn_sks;
unsigned long keepalive_intv;
struct timer_list timer;
struct rcu_head rcu;
unsigned long delete_at;
struct net *peer_net;
u32 peer_hash_mix;
#ifdef CONFIG_TIPC_CRYPTO;
struct tipc_crypto *crypto_rx;
#endif;
};
Members
addrnetwork address of node
krefreference counter to node object
lockrwlock governing access to structure
netthe applicable net namespace
hashlinks to adjacent nodes in unsorted hash chain
active_linksbearer ids of active links, used as index into links[] array
linksarray containing references to all links to node
bc_entrybroadcast link entry
action_flagsbit mask of different types of node actions
listlinks to adjacent nodes in sorted list of cluster’s nodes
stateconnectivity state vs peer node
preliminarya preliminary node or not
failover_sentfailover sent or not
sync_pointsequence number where synch/failover is finished
link_cntnumber of links to node
working_linksnumber of working links to node (both active and standby)
capabilitiesbitmap, indicating peer node’s functional capabilities
signaturenode instance identifier
link_idlocal and remote bearer ids of changing link, if any
peer_id128-bit ID of peer
peer_id_stringID string of peer
publ_listlist of publications
conn_skslist of connections (FIXME)
keepalive_intvkeepalive interval in milliseconds
timernode’s keepalive timer
rcurcu struct for tipc_node
delete_atindicates the time for deleting a down node
peer_netpeer’s net namespace
peer_hash_mixhash for this peer (FIXME)
crypto_rxRX crypto handler
-
struct tipc_crypto *tipc_node_crypto_rx(struct tipc_node *__n)¶
Retrieve crypto RX handle from node
Parameters
struct tipc_node *__ntarget tipc_node
Note
node ref counter must be held first!
-
void __tipc_node_link_up(struct tipc_node *n, int bearer_id, struct sk_buff_head *xmitq)¶
handle addition of link
Parameters
struct tipc_node *ntarget tipc_node
int bearer_idid of the bearer
struct sk_buff_head *xmitqqueue for messages to be xmited on Node lock must be held by caller Link becomes active (alone or shared) or standby, depending on its priority.
-
void tipc_node_link_up(struct tipc_node *n, int bearer_id, struct sk_buff_head *xmitq)¶
handle addition of link
Parameters
struct tipc_node *ntarget tipc_node
int bearer_idid of the bearer
struct sk_buff_head *xmitqqueue for messages to be xmited on
Description
Link becomes active (alone or shared) or standby, depending on its priority.
-
void tipc_node_link_failover(struct tipc_node *n, struct tipc_link *l, struct tipc_link *tnl, struct sk_buff_head *xmitq)¶
start failover in case “half-failover”
Parameters
struct tipc_node *ntipc node structure
struct tipc_link *llink peer endpoint failingover (- can be NULL)
struct tipc_link *tnltunnel link
struct sk_buff_head *xmitqqueue for messages to be xmited on tnl link later
Description
This function is only called in a very special situation where link failover can be already started on peer node but not on this node. This can happen when e.g.:
1. Both links <1A-2A>, <1B-2B> down
2. Link endpoint 2A up, but 1A still down (e.g. due to network
disturbance, wrong session, etc.)
3. Link <1B-2B> up
4. Link endpoint 2A down (e.g. due to link tolerance timeout)
5. Node 2 starts failover onto link <1B-2B>
==> Node 1 does never start link/node failover!
-
void __tipc_node_link_down(struct tipc_node *n, int *bearer_id, struct sk_buff_head *xmitq, struct tipc_media_addr **maddr)¶
handle loss of link
Parameters
struct tipc_node *ntarget tipc_node
int *bearer_idid of the bearer
struct sk_buff_head *xmitqqueue for messages to be xmited on
struct tipc_media_addr **maddroutput media address of the bearer
-
int tipc_node_get_linkname(struct net *net, u32 bearer_id, u32 addr, char *linkname, size_t len)¶
get the name of a link
Parameters
struct net *netthe applicable net namespace
u32 bearer_idid of the bearer
u32 addrpeer node address
char *linknamelink name output buffer
size_t lensize of linkname output buffer
Return
0 on success
-
int tipc_node_xmit(struct net *net, struct sk_buff_head *list, u32 dnode, int selector)¶
general link level function for message sending
Parameters
struct net *netthe applicable net namespace
struct sk_buff_head *listchain of buffers containing message
u32 dnodeaddress of destination node
int selectora number used for deterministic link selection Consumes the buffer chain.
Return
0 if success, otherwise: -ELINKCONG,-EHOSTUNREACH,-EMSGSIZE,-ENOBUF
-
void tipc_node_bc_rcv(struct net *net, struct sk_buff *skb, int bearer_id)¶
process TIPC broadcast packet arriving from off-node
Parameters
struct net *netthe applicable net namespace
struct sk_buff *skbTIPC packet
int bearer_idid of bearer message arrived on
Description
Invoked with no locks held.
-
bool tipc_node_check_state(struct tipc_node *n, struct sk_buff *skb, int bearer_id, struct sk_buff_head *xmitq)¶
check and if necessary update node state
Parameters
struct tipc_node *ntarget tipc_node
struct sk_buff *skbTIPC packet
int bearer_ididentity of bearer delivering the packet
struct sk_buff_head *xmitqqueue for messages to be xmited on
Return
true if state and msg are ok, otherwise false
-
void tipc_rcv(struct net *net, struct sk_buff *skb, struct tipc_bearer *b)¶
process TIPC packets/messages arriving from off-node
Parameters
struct net *netthe applicable net namespace
struct sk_buff *skbTIPC packet
struct tipc_bearer *bpointer to bearer message arrived on
Description
Invoked with no locks held. Bearer pointer must point to a valid bearer structure (i.e. cannot be NULL), but bearer can be inactive.
Parameters
struct tipc_node *ntipc node to be dumped
bool moredump more? - false: dump only tipc node data - true: dump node link data as well
char *bufreturned buffer of dump data in format
TIPC Socket Interfaces¶
-
struct tipc_sock¶
TIPC socket structure
Definition:
struct tipc_sock {
struct sock sk;
u32 max_pkt;
u32 maxnagle;
u32 portid;
struct tipc_msg phdr;
struct list_head cong_links;
struct list_head publications;
u32 pub_count;
atomic_t dupl_rcvcnt;
u16 conn_timeout;
bool probe_unacked;
u16 cong_link_cnt;
u16 snt_unacked;
u16 snd_win;
u16 peer_caps;
u16 rcv_unacked;
u16 rcv_win;
struct sockaddr_tipc peer;
struct rhash_head node;
struct tipc_mc_method mc_method;
struct rcu_head rcu;
struct tipc_group *group;
u32 oneway;
u32 nagle_start;
u16 snd_backlog;
u16 msg_acc;
u16 pkt_cnt;
bool expect_ack;
bool nodelay;
bool group_is_open;
bool published;
u8 conn_addrtype;
};
Members
sksocket - interacts with ‘port’ and with user via the socket API
max_pktmaximum packet size “hint” used when building messages sent by port
maxnaglemaximum size of msg which can be subject to nagle
portidunique port identity in TIPC socket hash table
phdrpreformatted message header used when sending messages
cong_linkslist of congested links
publicationslist of publications for port
pub_counttotal # of publications port has made during its lifetime
dupl_rcvcntnumber of bytes counted twice, in both backlog and rcv queue
conn_timeoutthe time we can wait for an unresponded setup request
probe_unackedprobe has not received ack yet
cong_link_cntnumber of congested links
snt_unacked# messages sent by socket, and not yet acked by peer
snd_winsend window size
peer_capspeer capabilities mask
rcv_unacked# messages read by user, but not yet acked back to peer
rcv_winreceive window size
peer‘connected’ peer for dgram/rdm
nodehash table node
mc_methodcookie for use between socket and broadcast layer
rcurcu struct for tipc_sock
groupTIPC communications group
onewaymessage count in one direction (FIXME)
nagle_startcurrent nagle value
snd_backlogsend backlog count
msg_accmessages accepted; used in managing backlog and nagle
pkt_cntTIPC socket packet count
expect_ackwhether this TIPC socket is expecting an ack
nodelaysetsockopt() TIPC_NODELAY setting
group_is_openTIPC socket group is fully open (FIXME)
publishedtrue if port has one or more associated names
conn_addrtypeaddress type used when establishing connection
Parameters
struct sock *sknetwork socket
Description
Caller must hold socket lock
Parameters
struct sock *sknetwork socket
int errorresponse error code
Description
Caller must hold socket lock
-
int tipc_sk_create(struct net *net, struct socket *sock, int protocol, int kern)¶
create a TIPC socket
Parameters
struct net *netnetwork namespace (must be default network)
struct socket *sockpre-allocated socket structure
int protocolprotocol indicator (must be 0)
int kerncaused by kernel or by userspace?
Description
This routine creates additional data structures used by the TIPC socket, initializes them, and links them together.
Return
0 on success, errno otherwise
Parameters
struct socket *socksocket to destroy
Description
This routine cleans up any messages that are still queued on the socket. For DGRAM and RDM socket types, all queued messages are rejected. For SEQPACKET and STREAM socket types, the first message is rejected and any others are discarded. (If the first message on a STREAM socket is partially-read, it is discarded and the next one is rejected instead.)
NOTE
Rejected messages are not necessarily returned to the sender! They are returned or discarded according to the “destination droppable” setting specified for the message by the sender.
Return
0 on success, errno otherwise
-
int __tipc_bind(struct socket *sock, struct sockaddr *skaddr, int alen)¶
associate or disassocate TIPC name(s) with a socket
Parameters
struct socket *socksocket structure
struct sockaddr *skaddrsocket address describing name(s) and desired operation
int alensize of socket address data structure
Description
Name and name sequence binding are indicated using a positive scope value; a negative scope value unbinds the specified name. Specifying no name (i.e. a socket address length of 0) unbinds all names from the socket.
Return
0 on success, errno otherwise
NOTE
- This routine doesn’t need to take the socket lock since it doesn’t
access any non-constant socket information.
-
int tipc_getname(struct socket *sock, struct sockaddr *uaddr, int peer)¶
get port ID of socket or peer socket
Parameters
struct socket *socksocket structure
struct sockaddr *uaddrarea for returned socket address
int peer0 = own ID, 1 = current peer ID, 2 = current/former peer ID
Return
0 on success, errno otherwise
NOTE
- This routine doesn’t need to take the socket lock since it only
accesses socket information that is unchanging (or which changes in a completely predictable manner).
-
__poll_t tipc_poll(struct file *file, struct socket *sock, poll_table *wait)¶
read and possibly block on pollmask
Parameters
struct file *filefile structure associated with the socket
struct socket *socksocket for which to calculate the poll bits
poll_table *wait???
Return
pollmask value
Description
COMMENTARY: It appears that the usual socket locking mechanisms are not useful here since the pollmask info is potentially out-of-date the moment this routine exits. TCP and other protocols seem to rely on higher level poll routines to handle any preventable race conditions, so TIPC will do the same ...
IMPORTANT: The fact that a read or write operation is indicated does NOT imply that the operation will succeed, merely that it should be performed and will not block.
-
int tipc_sendmcast(struct socket *sock, struct tipc_uaddr *ua, struct msghdr *msg, size_t dlen, long timeout)¶
send multicast message
Parameters
struct socket *socksocket structure
struct tipc_uaddr *uadestination address struct
struct msghdr *msgmessage to send
size_t dlenlength of data to send
long timeouttimeout to wait for wakeup
Description
Called from function tipc_sendmsg(), which has done all sanity checks
Return
the number of bytes sent on success, or errno
-
int tipc_send_group_msg(struct net *net, struct tipc_sock *tsk, struct msghdr *m, struct tipc_member *mb, u32 dnode, u32 dport, int dlen)¶
send a message to a member in the group
Parameters
struct net *netnetwork namespace
struct tipc_sock *tsktipc socket
struct msghdr *mmessage to send
struct tipc_member *mbgroup member
u32 dnodedestination node
u32 dportdestination port
int dlentotal length of message data
-
int tipc_send_group_unicast(struct socket *sock, struct msghdr *m, int dlen, long timeout)¶
send message to a member in the group
Parameters
struct socket *socksocket structure
struct msghdr *mmessage to send
int dlentotal length of message data
long timeouttimeout to wait for wakeup
Description
Called from function tipc_sendmsg(), which has done all sanity checks
Return
the number of bytes sent on success, or errno
-
int tipc_send_group_anycast(struct socket *sock, struct msghdr *m, int dlen, long timeout)¶
send message to any member with given identity
Parameters
struct socket *socksocket structure
struct msghdr *mmessage to send
int dlentotal length of message data
long timeouttimeout to wait for wakeup
Description
Called from function tipc_sendmsg(), which has done all sanity checks
Return
the number of bytes sent on success, or errno
-
int tipc_send_group_bcast(struct socket *sock, struct msghdr *m, int dlen, long timeout)¶
send message to all members in communication group
Parameters
struct socket *socksocket structure
struct msghdr *mmessage to send
int dlentotal length of message data
long timeouttimeout to wait for wakeup
Description
Called from function tipc_sendmsg(), which has done all sanity checks
Return
the number of bytes sent on success, or errno
-
int tipc_send_group_mcast(struct socket *sock, struct msghdr *m, int dlen, long timeout)¶
send message to all members with given identity
Parameters
struct socket *socksocket structure
struct msghdr *mmessage to send
int dlentotal length of message data
long timeouttimeout to wait for wakeup
Description
Called from function tipc_sendmsg(), which has done all sanity checks
Return
the number of bytes sent on success, or errno
-
void tipc_sk_mcast_rcv(struct net *net, struct sk_buff_head *arrvq, struct sk_buff_head *inputq)¶
Deliver multicast messages to all destination sockets
Parameters
struct net *netthe associated network namespace
struct sk_buff_head *arrvqqueue with arriving messages, to be cloned after destination lookup
struct sk_buff_head *inputqqueue with cloned messages, delivered to socket after dest lookup
Description
Multi-threaded: parallel calls with reference to same queues may occur
-
void tipc_sk_conn_proto_rcv(struct tipc_sock *tsk, struct sk_buff *skb, struct sk_buff_head *inputq, struct sk_buff_head *xmitq)¶
receive a connection mng protocol message
Parameters
struct tipc_sock *tskreceiving socket
struct sk_buff *skbpointer to message buffer.
struct sk_buff_head *inputqbuffer list containing the buffers
struct sk_buff_head *xmitqoutput message area
-
int tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dsz)¶
send message in connectionless manner
Parameters
struct socket *socksocket structure
struct msghdr *mmessage to send
size_t dszamount of user data to be sent
Description
Message must have an destination specified explicitly. Used for SOCK_RDM and SOCK_DGRAM messages, and for ‘SYN’ messages on SOCK_SEQPACKET and SOCK_STREAM connections. (Note: ‘SYN+’ is prohibited on SOCK_STREAM.)
Return
the number of bytes sent on success, or errno otherwise
Parameters
struct socket *socksocket structure
struct msghdr *mdata to send
size_t dsztotal length of data to be transmitted
Description
Used for SOCK_STREAM data.
Return
the number of bytes sent on success (or partial success), or errno if no data sent
-
int tipc_send_packet(struct socket *sock, struct msghdr *m, size_t dsz)¶
send a connection-oriented message
Parameters
struct socket *socksocket structure
struct msghdr *mmessage to send
size_t dszlength of data to be transmitted
Description
Used for SOCK_SEQPACKET messages.
Return
the number of bytes sent on success, or errno otherwise
-
void tipc_sk_set_orig_addr(struct msghdr *m, struct sk_buff *skb)¶
capture sender’s address for received message
Parameters
struct msghdr *mdescriptor for message info
struct sk_buff *skbreceived message
Note
Address is not captured if not requested by receiver.
-
int tipc_sk_anc_data_recv(struct msghdr *m, struct sk_buff *skb, struct tipc_sock *tsk)¶
optionally capture ancillary data for received message
Parameters
struct msghdr *mdescriptor for message info
struct sk_buff *skbreceived message buffer
struct tipc_sock *tskTIPC port associated with message
Note
Ancillary data is not captured if not requested by receiver.
Return
0 if successful, otherwise errno
-
int tipc_recvmsg(struct socket *sock, struct msghdr *m, size_t buflen, int flags)¶
receive packet-oriented message
Parameters
struct socket *socknetwork socket
struct msghdr *mdescriptor for message info
size_t buflenlength of user buffer area
int flagsreceive flags
Description
Used for SOCK_DGRAM, SOCK_RDM, and SOCK_SEQPACKET messages. If the complete message doesn’t fit in user area, truncate it.
Return
size of returned message data, errno otherwise
-
int tipc_recvstream(struct socket *sock, struct msghdr *m, size_t buflen, int flags)¶
receive stream-oriented data
Parameters
struct socket *socknetwork socket
struct msghdr *mdescriptor for message info
size_t buflentotal size of user buffer area
int flagsreceive flags
Description
Used for SOCK_STREAM messages only. If not enough data is available will optionally wait for more; never truncates data.
Return
size of returned message data, errno otherwise
Parameters
struct sock *sksocket
Parameters
struct sock *sksocket
-
bool tipc_sk_filter_connect(struct tipc_sock *tsk, struct sk_buff *skb, struct sk_buff_head *xmitq)¶
check incoming message for a connection-based socket
Parameters
struct tipc_sock *tskTIPC socket
struct sk_buff *skbpointer to message buffer.
struct sk_buff_head *xmitqfor Nagle ACK if any
Return
true if message should be added to receive queue, false otherwise
-
unsigned int rcvbuf_limit(struct sock *sk, struct sk_buff *skb)¶
get proper overload limit of socket receive queue
Parameters
struct sock *sksocket
struct sk_buff *skbmessage
Description
For connection oriented messages, irrespective of importance, default queue limit is 2 MB.
For connectionless messages, queue limits are based on message importance as follows:
TIPC_LOW_IMPORTANCE (2 MB) TIPC_MEDIUM_IMPORTANCE (4 MB) TIPC_HIGH_IMPORTANCE (8 MB) TIPC_CRITICAL_IMPORTANCE (16 MB)
Return
overload limit according to corresponding message importance
-
void tipc_sk_filter_rcv(struct sock *sk, struct sk_buff *skb, struct sk_buff_head *xmitq)¶
validate incoming message
Parameters
struct sock *sksocket
struct sk_buff *skbpointer to message.
struct sk_buff_head *xmitqoutput message area (FIXME)
Description
Enqueues message on receive queue if acceptable; optionally handles disconnect indication for a connected socket.
Called with socket lock already taken
-
int tipc_sk_backlog_rcv(struct sock *sk, struct sk_buff *skb)¶
handle incoming message from backlog queue
Parameters
struct sock *sksocket
struct sk_buff *skbmessage
Description
Caller must hold socket lock
-
void tipc_sk_enqueue(struct sk_buff_head *inputq, struct sock *sk, u32 dport, struct sk_buff_head *xmitq)¶
extract all buffers with destination ‘dport’ from inputq and try adding them to socket or backlog queue
Parameters
struct sk_buff_head *inputqlist of incoming buffers with potentially different destinations
struct sock *sksocket where the buffers should be enqueued
u32 dportport number for the socket
struct sk_buff_head *xmitqoutput queue
Description
Caller must hold socket lock
Parameters
struct net *netthe associated network namespace
struct sk_buff_head *inputqbuffer list containing the buffers Consumes all buffers in list until inputq is empty
Note
may be called in multiple threads referring to the same queue
-
int tipc_connect(struct socket *sock, struct sockaddr *dest, int destlen, int flags)¶
establish a connection to another TIPC port
Parameters
struct socket *socksocket structure
struct sockaddr *destsocket address for destination port
int destlensize of socket address data structure
int flagsfile-related flags associated with socket
Return
0 on success, errno otherwise
Parameters
struct socket *socksocket structure
int len(unused)
Return
0 on success, errno otherwise
-
int tipc_accept(struct socket *sock, struct socket *new_sock, struct proto_accept_arg *arg)¶
wait for connection request
Parameters
struct socket *socklistening socket
struct socket *new_socknew socket that is to be connected
struct proto_accept_arg *argarguments for accept
Return
0 on success, errno otherwise
Parameters
struct socket *socksocket structure
int howdirection to close (must be SHUT_RDWR)
Description
Terminates connection (if necessary), then purges socket’s receive queue.
Return
0 on success, errno otherwise
-
int tipc_setsockopt(struct socket *sock, int lvl, int opt, sockptr_t ov, unsigned int ol)¶
set socket option
Parameters
struct socket *socksocket structure
int lvloption level
int optoption identifier
sockptr_t ovpointer to new option value
unsigned int ollength of option value
Description
For stream sockets only, accepts and ignores all IPPROTO_TCP options (to ease compatibility).
Return
0 on success, errno otherwise
-
int tipc_getsockopt(struct socket *sock, int lvl, int opt, char __user *ov, int __user *ol)¶
get socket option
Parameters
struct socket *socksocket structure
int lvloption level
int optoption identifier
char __user *ovreceptacle for option value
int __user *olreceptacle for length of option value
Description
For stream sockets only, returns 0 length result for all IPPROTO_TCP options (to ease compatibility).
Return
0 on success, errno otherwise
-
int tipc_socket_init(void)¶
initialize TIPC socket interface
Parameters
voidno arguments
Return
0 on success, errno otherwise
-
void tipc_socket_stop(void)¶
stop TIPC socket interface
Parameters
voidno arguments
Parameters
struct sock *skthe socket to be examined
Description
sysctl_tipc_sk_filter is used as the socket tuple for filtering: (portid, sock type, name type, name lower, name upper)
Return
true if the socket meets the socket tuple data (value 0 = ‘any’) or when there is no tuple set (all = 0), otherwise false
-
bool tipc_sk_overlimit1(struct sock *sk, struct sk_buff *skb)¶
check if socket rx queue is about to be overloaded, both the rcv and backlog queues are considered
Parameters
struct sock *sktipc sk to be checked
struct sk_buff *skbtipc msg to be checked
Return
true if the socket rx queue allocation is > 90%, otherwise false
-
bool tipc_sk_overlimit2(struct sock *sk, struct sk_buff *skb)¶
check if socket rx queue is about to be overloaded, only the rcv queue is considered
Parameters
struct sock *sktipc sk to be checked
struct sk_buff *skbtipc msg to be checked
Return
true if the socket rx queue allocation is > 90%, otherwise false
Parameters
struct sock *sktipc sk to be dumped
u16 dqueuesbitmask to decide if any socket queue to be dumped? - TIPC_DUMP_NONE: don’t dump socket queues - TIPC_DUMP_SK_SNDQ: dump socket send queue - TIPC_DUMP_SK_RCVQ: dump socket rcv queue - TIPC_DUMP_SK_BKLGQ: dump socket backlog queue - TIPC_DUMP_ALL: dump all the socket queues above
char *bufreturned buffer of dump data in format
TIPC Network Topology Interfaces¶
-
bool tipc_sub_check_overlap(struct tipc_service_range *subscribed, struct tipc_service_range *found)¶
test for subscription overlap with the given values
Parameters
struct tipc_service_range *subscribedthe service range subscribed for
struct tipc_service_range *foundthe service range we are checking for match
Description
Returns true if there is overlap, otherwise false.
TIPC Server Interfaces¶
-
struct tipc_topsrv¶
TIPC server structure
Definition:
struct tipc_topsrv {
struct idr conn_idr;
spinlock_t idr_lock;
int idr_in_use;
struct net *net;
struct work_struct awork;
struct workqueue_struct *rcv_wq;
struct workqueue_struct *send_wq;
struct socket *listener;
char name[TIPC_SERVER_NAME_LEN];
};
Members
conn_idridentifier set of connection
idr_lockprotect the connection identifier set
idr_in_useamount of allocated identifier entry
netnetwork namspace instance
aworkaccept work item
rcv_wqreceive workqueue
send_wqsend workqueue
listenertopsrv listener socket
nameserver name
-
struct tipc_conn¶
TIPC connection structure
Definition:
struct tipc_conn {
struct kref kref;
int conid;
struct socket *sock;
unsigned long flags;
struct tipc_topsrv *server;
struct list_head sub_list;
spinlock_t sub_lock;
struct work_struct rwork;
struct list_head outqueue;
spinlock_t outqueue_lock;
struct work_struct swork;
};
Members
krefreference counter to connection object
conidconnection identifier
socksocket handler associated with connection
flagsindicates connection state
serverpointer to connected server
sub_listlsit to all pertaing subscriptions
sub_locklock protecting the subscription list
rworkreceive work item
outqueuepointer to first outbound message in queue
outqueue_lockcontrol access to the outqueue
sworksend work item
TIPC Trace Interfaces¶
Parameters
struct sk_buff *skbskb to be dumped
bool moredump more? - false: dump only tipc msg data - true: dump kernel-related skb data and tipc cb[] array as well
char *bufreturned buffer of dump data in format
-
int tipc_list_dump(struct sk_buff_head *list, bool more, char *buf)¶
dump TIPC skb list/queue
Parameters
struct sk_buff_head *listlist of skbs to be dumped
bool moredump more? - false: dump only the head & tail skbs - true: dump the first & last 5 skbs
char *bufreturned buffer of dump data in format