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
;
Members
s: host-endian copy of the user subscriptionevt: template for events generated by subscriptionkref: reference count for this subscriptionnet: network namespace associated with subscriptiontimer: timer governing subscription duration (optional)service_list: adjacent subscriptions in name sequence's subscription listsub_list: adjacent subscriptions in subscriber's subscription listconid: connection identifier of topology serverinactive: true if this subscription is inactivelock: serialize up/down and timer events
struct tipc_media_addr #
destination address used by TIPC bearers
Definition
;
Members
value: address info (format defined by media)media_id: TIPC media type identifierbroadcast: non-zero if address is a broadcast address
struct tipc_media #
Media specific info exposed to generic bearer layer
Definition
;
Members
send_msg: routine which handles buffer transmissionenable_media: routine which enables a mediadisable_media: routine which disables a mediaaddr2str: convert media address format to stringaddr2msg: convert from media addr format to discovery msg addr formatmsg2addr: convert from discovery msg addr format to media addr formatraw2addr: convert from raw addr format to media addr formatpriority: default link (and bearer) prioritytolerance: default time (in ms) before declaring link failuremin_win: minimum window (in packets) before declaring link congestionmax_win: maximum window (in packets) before declaring link congestionmtu: max packet size bearer can support for media type not dependent on underlying device MTUtype_id: TIPC media identifierhwaddr_len: TIPC media address lenname: media name
struct tipc_bearer #
Generic TIPC bearer structure
Definition
;
Members
media_ptr: pointer to additional media-specific information about bearermtu: max packet size bearer can supportaddr: media-specific address associated with bearername: bearer name (format = media:interface)media: ptr to media structure associated with bearerbcast_addr: media address used in broadcastingpt: packet type for bearerrcu: rcu struct for tipc_bearerpriority: default link priority for bearermin_win: minimum window (in packets) before declaring link congestionmax_win: maximum window (in packets) before declaring link congestiontolerance: default link tolerance for bearerdomain: network domain to which links can be establishedidentity: array index of this bearer within TIPC bearer arraydisc: ptr to link setup requestnet_plane: network plane ('A' through 'H') currently associated with bearerencap_hlen: encap headers lengthup: bearer up flag (bit 0)refcnt: tipc_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
;
Members
sr: service range represented by this publicationsk: address of socket bound to this publicationscope: scope of publication, TIPC_NODE_SCOPE or TIPC_CLUSTER_SCOPEkey: publication key, unique across the clusterid: publication idbinding_node: all 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_sock: all publications from the same socket which bound this one Used by socket to withdraw publications when socket is unbound/releasedlocal_publ: list of identical publications made from this node Used by closest_first and multicast receive lookup algorithmsall_publ: all publications identical to this one, whatever node and scope Used by round-robin lookup algorithmlist: to form a list of publications in temporal orderrcu: RCU callback head used for deferred freeing
struct name_table #
table containing all existing port name publications
Definition
;
Members
rcu: RCU callback head used for deferred freeingservices: name sequence hash listsnode_scope: all local publications with node scope- used by name_distr during re-init of name table
cluster_scope: all 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_lock: lock for accessing cluster_scopelocal_publ_count: number of publications issued by this noderc_dests: destination node countersnd_nxt: next sequence number to be used
struct distr_item #
publication info distributed to other nodes
Definition
;
Members
type: name sequence typelower: name sequence lower boundupper: name sequence upper boundport: publishing port referencekey: publication 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
;
Members
link: broadcast send link structureinputq: data input queue; will only carry SOCK_WAKEUP messagesdests: array keeping number of reachable destinations per bearerprimary_bearer: a bearer having links to all broadcast destinations, if anybcast_support: indicates if primary bearer, if any, supports broadcastforce_bcast: forces broadcast for multicast trafficrcast_support: indicates if all peer nodes support replicastforce_rcast: forces replicast for multicast trafficrc_ratio: dest count as percentage of cluster size where send method changesbc_threshold: calculated from rc_ratio; if dests > threshold use broadcast
TIPC Bearer Interfaces #
tipc_media_find() #
struct tipc_media * locates specified media object by name
Parameters
const char *name: name to locate
media_find_id() #
struct tipc_media * locates specified media object by type identifier
Parameters
u8 type: type identifier to locate
tipc_media_addr_printf() #
int record media address in print buffer
Parameters
char *buf: output bufferint len: output buffer size remainingstruct tipc_media_addr *a: input media address
bearer_name_validate() #
int validate & (optionally) deconstruct bearer name
Parameters
const char *name: ptr to bearer name stringstruct tipc_bearer_names *name_parts: ptr to area for bearer name components (or NULL if not needed)
Return
1 if bearer name is valid, otherwise 0.
tipc_bearer_find() #
struct tipc_bearer * locates bearer object with matching bearer name
Parameters
struct net *net: the applicable net namespaceconst char *name: bearer name to locate
tipc_enable_bearer() #
int enable bearer with the given name
Parameters
struct net *net: the applicable net namespaceconst char *name: bearer name to enableu32 disc_domain: bearer domainu32 prio: bearer prioritystruct nlattr *attr[]: nlattr arraystruct netlink_ext_ack *extack: netlink extended ack
tipc_reset_bearer() #
int Reset all links established over this bearer
Parameters
struct net *net: the applicable net namespacestruct tipc_bearer *b: the target bearer
bearer_disable() #
void disable this bearer
Parameters
struct net *net: the applicable net namespacestruct tipc_bearer *b: the bearer to disable
Note
This routine assumes caller holds RTNL lock.
tipc_l2_send_msg() #
int send a TIPC packet out over an L2 interface
Parameters
struct net *net: the associated network namespacestruct sk_buff *skb: the packet to be sentstruct tipc_bearer *b: the bearer through which the packet is to be sentstruct tipc_media_addr *dest: peer destination address
tipc_l2_rcv_msg() #
int handle incoming TIPC message from an interface
Parameters
struct sk_buff *skb: the received messagestruct net_device *dev: the net device that the packet was received onstruct packet_type *pt: the packet_type structure which was used to register this handlerstruct net_device *orig_dev: the 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).
tipc_l2_device_event() #
int handle device events from network device
Parameters
struct notifier_block *nb: the context of the notificationunsigned long evt: the type of eventvoid *ptr: the 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
;
Members
proto: Ethernet protocol in useport: port being used{unnamed_union}: anonymousipv4: IPv4 address of neighboripv6: IPv6 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
;
Members
bearer: associated generic tipc bearerubsock: bearer associated socketifindex: local address scopework: used to schedule deferred work on a bearerrcast: associated udp_replicast container
tipc_parse_udp_addr() #
int build udp media address from netlink data
Parameters
struct nlattr *nla: netlink attribute containing sockaddr storage aligned addressstruct udp_media_addr *addr: tipc media address to fill with address, port and protocol typeu32 *scope_id: IPv6 scope id pointer, not NULL indicates it's required
tipc_udp_enable() #
int callback to create a new udp bearer instance
Parameters
struct net *net: network namespacestruct tipc_bearer *b: pointer to generic tipc_bearerstruct 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
;
Members
tfm: cipher handle/keylist: linked list of TFMs
struct tipc_aead #
TIPC AEAD key structure
Definition
;
Members
tfm_entry: per-cpu pointer to one entry in TFM listcrypto: TIPC crypto owns this keycloned: reference to the source key in case cloningusers: the number of the key users (TX/RX)salt: the key's SALT valueauthsize: authentication tag size (max = 16)mode: crypto mode is applied to the keyhint: a hint for user keyrcu: struct rcu_headkey: the aead keygen: the key's generationseqno: the key seqno (cluster scope)refcnt: the key reference counter
struct tipc_crypto_stats #
TIPC Crypto statistics
Definition
;
Members
stat: array of crypto statistics
struct tipc_crypto #
TIPC TX/RX crypto structure
Definition
;
Members
net: struct netnode: TIPC node (RX)aead: array of pointers to AEAD keys for encryption/decryptionpeer_rx_active: replicated peer RX active key indexkey_gen: TX/RX key generationkey: the key statesskey_mode: session key's modeskey: received session keywq: common workqueue on TX cryptowork: delayed work sched for TX/RXkey_distr: key distributing staterekeying_intv: rekeying interval (in minutes)stats: the crypto statisticsname: the crypto namesndnxt: the per-peer sndnxt (TX)timer1: general timer 1 (jiffies)timer2: general timer 2 (jiffies){unnamed_union}: anonymous{unnamed_struct}: anonymousworking: the crypto is working or notkey_master: flag indicates if master key existslegacy_user: flag indicates if a peer joins w/o master key (for bwd comp.)nokey: no key indicationflags: combined flags fieldlock: tipc_key lock
tipc_aead_key_validate() #
int Validate a AEAD user key
Parameters
struct tipc_aead_key *ukey: pointer to user key datastruct genl_info *info: netlink info pointer
tipc_aead_key_generate() #
int Generate new session key
Parameters
struct tipc_aead_key *skey: input/output key with new content
Return
0 in case of success, otherwise < 0
tipc_aead_free() #
void Release AEAD key incl. all the TFMs in the list
Parameters
struct rcu_head *rp: rcu head pointer
tipc_aead_tfm_next() #
struct crypto_aead * Move TFM entry to the next one in list and return it
Parameters
struct tipc_aead *aead: the AEAD key pointer
tipc_aead_init() #
int Initiate TIPC AEAD
Parameters
struct tipc_aead **aead: returned new TIPC AEAD key handle pointerstruct tipc_aead_key *ukey: pointer to user key datau8 mode: the 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
tipc_aead_clone() #
int Clone a TIPC AEAD key
Parameters
struct tipc_aead **dst: dest key for the cloningstruct tipc_aead *src: source 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
tipc_aead_mem_alloc() #
void * Allocate memory for AEAD request operations
Parameters
struct crypto_aead *tfm: cipher handle to be registered with the requestunsigned int crypto_ctx_size: size of crypto context for callbacku8 **iv: returned pointer to IV datastruct aead_request **req: returned pointer to AEAD request datastruct scatterlist **sg: returned pointer to SG listsint nsg: number 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
tipc_aead_encrypt() #
int Encrypt a message
Parameters
struct tipc_aead *aead: TIPC AEAD key for the message encryptionstruct sk_buff *skb: the input/output skbstruct tipc_bearer *b: TIPC bearer where the message will be delivered after the encryptionstruct tipc_media_addr *dst: the destination media addressstruct tipc_node *__dnode: TIPC dest node if "known"
Return
- 0 : if the encryption has completed
- -EINPROGRESS/-EBUSY : if a callback will be performed
- < 0 : the encryption has failed
tipc_aead_decrypt() #
int Decrypt an encrypted message
Parameters
struct net *net: struct netstruct tipc_aead *aead: TIPC AEAD for the message decryptionstruct sk_buff *skb: the input/output skbstruct tipc_bearer *b: TIPC 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
tipc_ehdr_validate() #
bool Validate an encryption message
Parameters
struct sk_buff *skb: the message buffer
Return
"true" if this is a valid encryption message, otherwise "false"
tipc_ehdr_build() #
int Build TIPC encryption message header
Parameters
struct net *net: struct netstruct tipc_aead *aead: TX AEAD key to be used for the message encryptionu8 tx_key: key id used for the message encryptionstruct sk_buff *skb: input/output message skbstruct tipc_crypto *__rx: RX crypto handle if dest is "known"
Return
the header size if the building is successful, otherwise < 0
tipc_crypto_key_init() #
int Initiate a new user / AEAD key
Parameters
struct tipc_crypto *c: TIPC crypto to which new key is attachedstruct tipc_aead_key *ukey: the user keyu8 mode: the key mode (CLUSTER_KEY or PER_NODE_KEY)bool master_key: specify 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
tipc_crypto_key_attach() #
int Attach a new AEAD key to TIPC crypto
Parameters
struct tipc_crypto *c: TIPC crypto to which the new AEAD key is attachedstruct tipc_aead *aead: the new AEAD key pointeru8 pos: desired slot in the crypto key array, = 0 if any!bool master_key: specify this is a cluster master key
Return
new key id in case of success, otherwise: -EBUSY
tipc_crypto_key_try_align() #
bool Align RX keys if possible
Parameters
struct tipc_crypto *rx: RX crypto handleu8 new_pending: new 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"
tipc_crypto_key_pick_tx() #
struct tipc_aead * Pick one TX key for message decryption
Parameters
struct tipc_crypto *tx: TX crypto handlestruct tipc_crypto *rx: RX crypto handle (can be NULL)struct sk_buff *skb: the message skb which will be decrypted lateru8 tx_key: peer 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
tipc_crypto_key_synch() #
void Synch own key data according to peer key status
Parameters
struct tipc_crypto *rx: RX crypto handlestruct sk_buff *skb: TIPCv2 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.
tipc_crypto_xmit() #
int Build & encrypt TIPC message for xmit
Parameters
struct net *net: struct netstruct sk_buff **skb: input/output message skb pointerstruct tipc_bearer *b: bearer used for xmit laterstruct tipc_media_addr *dst: destination media addressstruct tipc_node *__dnode: destination 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
tipc_crypto_rcv() #
int Decrypt an encrypted TIPC message from peer
Parameters
struct net *net: struct netstruct tipc_crypto *rx: RX crypto handlestruct sk_buff **skb: input/output message skb pointerstruct tipc_bearer *b: bearer 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 trimmed 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
tipc_crypto_msg_rcv() #
void Common 'MSG_CRYPTO' processing point
Parameters
struct net *net: the struct netstruct sk_buff *skb: the receiving message buffer
tipc_crypto_key_distr() #
int Distribute a TX key
Parameters
struct tipc_crypto *tx: the TX cryptou8 key: the key's indexstruct tipc_node *dest: the destination tipc node, = NULL if distributing to all nodes
Return
0 in case of success, otherwise < 0
tipc_crypto_key_xmit() #
int Send a session key
Parameters
struct net *net: the struct netstruct tipc_aead_key *skey: the session key to be sentu16 gen: the key's generationu8 mode: the key's modeu32 dnode: the 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
tipc_crypto_key_rcv() #
bool Receive a session key
Parameters
struct tipc_crypto *rx: the RX cryptostruct tipc_msg *hdr: the 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".
tipc_crypto_work_rx() #
void Scheduled RX works handler
Parameters
struct work_struct *work: the 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.
tipc_crypto_rekeying_sched() #
void (Re)schedule rekeying w/o new interval
Parameters
struct tipc_crypto *tx: TX cryptobool changed: if the rekeying needs to be rescheduled with new intervalu32 new_intv: new rekeying interval (when "changed" = true)
tipc_crypto_work_tx() #
void Scheduled TX works handler
Parameters
struct work_struct *work: the 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
;
Members
bearer_id: identity of bearer issuing requestsdest: destination address for request messagesnet: network namespace instancedomain: network domain to which links can be establishednum_nodes: number of nodes currently discovered (i.e. with an active link)lock: spinlock for controlling access to requestsskb: request message to be (repeatedly) senttimer: timer governing period between requeststimer_intv: current interval between requests (in ms)
tipc_disc_init_msg() #
void initialize a link setup message
Parameters
struct net *net: the applicable net namespacestruct sk_buff *skb: buffer containing messageu32 mtyp: message type (request or response)struct tipc_bearer *b: ptr to bearer issuing message
disc_dupl_alert() #
void issue node address duplication alert
Parameters
struct tipc_bearer *b: pointer to bearer detecting duplicationu32 node_addr: duplicated node addressstruct tipc_media_addr *media_addr: media address advertised by duplicated node
tipc_disc_rcv() #
void handle incoming discovery message (request or response)
Parameters
struct net *net: applicable net namespacestruct sk_buff *skb: buffer containing messagestruct tipc_bearer *b: bearer that message arrived on
tipc_disc_create() #
int create object to send periodic link setup requests
Parameters
struct net *net: the applicable net namespacestruct tipc_bearer *b: ptr to bearer issuing requestsstruct tipc_media_addr *dest: destination address for request messagesstruct sk_buff **skb: pointer to created frame
Return
0 if successful, otherwise -errno.
tipc_disc_delete() #
void destroy object sending periodic link setup requests
Parameters
struct tipc_discoverer *d: ptr to link dest structure
tipc_disc_reset() #
void reset object to send periodic link setup requests
Parameters
struct net *net: the applicable net namespacestruct tipc_bearer *b: ptr to bearer issuing requests
TIPC Link Interfaces #
struct tipc_link #
TIPC link data structure
Definition
;
Members
addr: network address of link's peer nodename: link name character stringnet: pointer to namespace structpeer_session: link session # being used by peer end of linksession: session to be used by linksnd_nxt_state: next send seq numberrcv_nxt_state: next rcv seq numberpeer_bearer_id: bearer id used by link's peer endpointbearer_id: local bearer id used by linktolerance: minimum link continuity loss needed to reset link [in ms]abort_limit: # of unacknowledged continuity probes needed to reset linkstate: current state of link FSMpeer_caps: bitmap describing capabilities of peer nodein_session: have received ACTIVATE_MSG from peeractive: link is activesilent_intv_cnt: # of timer intervals without any reception from peerif_name: associated interface namepriority: current link prioritynet_plane: current link network plane ('A' through 'H')mon_state: cookie with information needed by link monitorrst_cnt: link reset counterdrop_point: seq number for failover handling (FIXME)failover_reasm_skb: saved failover msg ptr (FIXME)failover_deferdq: deferred message queue for failover processing (FIXME)mtu: current maximum packet size for this linkadvertised_mtu: advertised own mtu when link is being establishedtransmq: the link's transmit queuebacklogq: queue for messages waiting to be sentbacklog: link's backlog by priority (importance)snd_nxt: next sequence number to be usedrcv_nxt: next sequence number to expect for inbound messagesrcv_unacked: # messages read by user, but not yet acked back to peerdeferdq: deferred receive queueinputq: buffer queue for messages to be delivered upwardsnamedq: buffer queue for name table messages to be delivered upwardswakeupq: linked list of wakeup msgs waiting for link congestion to abatewindow: sliding window size for congestion handlingmin_win: minimal send window to be used by linkssthresh: slow start threshold for congestion handlingmax_win: maximal send window to be used by linkcong_acks: congestion acks for congestion avoidance (FIXME)checkpoint: seq number for congestion window size handlingreasm_buf: head of partially reassembled inbound message fragmentsreasm_tnlmsg: fragmentation/reassembly area for tunnel protocol messageackers: # of peers that needs to ack each packet before it can be releasedacked: # last packet acked by a certain peer. Used for broadcast.last_gap: last gap ack blocks for bcast (FIXME)last_ga: ptr to gap ack blocksbc_rcvlink: the peer specific link used for broadcast receptionbc_sndlink: the namespace global link used for broadcast sendingnack_state: bcast nack statebc_peer_is_up: peer has acked the bcast init msgstats: collects statistics regarding link activity
tipc_link_create() #
bool create a new link
Parameters
struct net *net: pointer to associated network namespacechar *if_name: associated interface nameint bearer_id: id (index) of associated bearerint tolerance: link tolerance to be used by linkchar net_plane: network plane (A,B,c..) this link belongs tou32 mtu: mtu to be advertised by linkint priority: priority to be used by linku32 min_win: minimal send window to be used by linku32 max_win: maximal send window to be used by linku32 session: session to be used by linku32 self: local unicast link idu32 peer: node id of peer nodeu8 *peer_id: 128-bit ID of peeru16 peer_caps: bitmap describing peer node capabilitiesstruct tipc_link *bc_sndlink: the namespace global link used for broadcast sendingstruct tipc_link *bc_rcvlink: the peer specific link used for broadcast receptionstruct sk_buff_head *inputq: queue to put messages ready for deliverystruct sk_buff_head *namedq: queue to put binding table update messages ready for deliverystruct tipc_link **link: return value, pointer to put the created link
Return
true if link was created, otherwise false
tipc_link_bc_create() #
bool create new link to be used for broadcast
Parameters
struct net *net: pointer to associated network namespaceu32 ownnode: identity of own nodeu32 peer: node id of peer nodeu8 *peer_id: 128-bit ID of peerint mtu: mtu to be used initially if no peersu32 min_win: minimal send window to be used by linku32 max_win: maximal send window to be used by linku16 peer_caps: bitmap describing peer node capabilitiesstruct sk_buff_head *inputq: queue to put messages ready for deliverystruct sk_buff_head *namedq: queue to put binding table update messages ready for deliverystruct tipc_link *bc_sndlink: the namespace global link used for broadcast sendingstruct tipc_link **link: return value, pointer to put the created link
Return
true if link was created, otherwise false
tipc_link_fsm_evt() #
int link finite state machine
Parameters
struct tipc_link *l: pointer to linkint evt: state machine event to be processed
tipc_link_too_silent() #
bool check if link is "too silent"
Parameters
struct tipc_link *l: tipc link to be checked
Return
true if the link 'silent_intv_cnt' is about to reach the 'abort_limit' value, otherwise false
link_schedule_user() #
int schedule a message sender for wakeup after congestion
Parameters
struct tipc_link *l: congested linkstruct tipc_msg *hdr: header of message that is being sent Create pseudo msg to send back to user when congestion abates
link_prepare_wakeup() #
void prepare users for wakeup after congestion
Parameters
struct tipc_link *l: congested link Wake up a number of waiting users, as permitted by available space in the send queue
tipc_link_set_skb_retransmit_time() #
void set the time at which retransmission of the given skb should be next attempted
Parameters
struct sk_buff *skb: skb to set a future retransmission time forstruct tipc_link *l: link the skb will be transmitted on
tipc_link_xmit() #
int enqueue buffer list according to queue situation
Parameters
struct tipc_link *l: link to usestruct sk_buff_head *list: chain of buffers containing messagestruct sk_buff_head *xmitq: returned 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
link_retransmit_failure() #
bool Detect repeated retransmit failures
Parameters
struct tipc_link *l: tipc link senderstruct tipc_link *r: tipc link receiver (= l in case of unicast)int *rc: returned code
Return
true if the repeated retransmit failures happens, otherwise false
tipc_get_gap_ack_blks() #
u16 get Gap ACK blocks from PROTOCOL/STATE_MSG
Parameters
struct tipc_gap_ack_blks **ga: returned pointer to the Gap ACK blocks if anystruct tipc_link *l: the tipc linkstruct tipc_msg *hdr: the PROTOCOL/STATE_MSG headerbool uc: desired Gap ACK blocks type, i.e. unicast (= 1) or broadcast (= 0)
Return
the total Gap ACK blocks size
tipc_link_failover_prepare() #
void prepare tnl for link failover
Parameters
struct tipc_link *l: failover linkstruct tipc_link *tnl: tunnel linkstruct sk_buff_head *xmitq: queue 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
tipc_link_reset_stats() #
void reset link statistics
Parameters
struct tipc_link *l: pointer to link
tipc_link_dump() #
int dump TIPC link data
Parameters
struct tipc_link *l: tipc link to be dumpedu16 dqueues: bitmask 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 *buf: returned buffer of dump data in format
TIPC msg Interfaces #
tipc_buf_acquire() #
struct sk_buff * creates a TIPC message buffer
Parameters
u32 size: message size (including TIPC header)gfp_t gfp: memory 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.
tipc_msg_append() #
int Append data to tail of an existing buffer queue
Parameters
struct tipc_msg *_hdr: header to be usedstruct msghdr *m: the data to be appendedint dlen: size of data to be appendedint mss: max allowable size of bufferstruct sk_buff_head *txq: queue to append to
Return
the number of 1k blocks appended or errno value
tipc_msg_fragment() #
int build a fragment skb list for TIPC message
Parameters
struct sk_buff *skb: TIPC message skbconst struct tipc_msg *hdr: internal msg header to be put on the top of the fragmentsint pktmax: max size of a fragment incl. the headerstruct sk_buff_head *frags: returned fragment skb list
Return
0 if the fragmentation is successful, otherwise: -EINVAL or -ENOMEM
tipc_msg_build() #
int create buffer chain containing specified header and data
Parameters
struct tipc_msg *mhdr: Message header, to be prepended to datastruct msghdr *m: User messageint offset: buffer offset for fragmented messages (FIXME)int dsz: Total length of user dataint pktmax: Max packet size that can be usedstruct sk_buff_head *list: Buffer 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
tipc_msg_bundle() #
bool Append contents of a buffer to tail of an existing one
Parameters
struct sk_buff *bskb: the bundle buffer to append tostruct tipc_msg *msg: message to be appendedu32 max: max allowable size for the bundle buffer
Return
"true" if bundling has been performed, otherwise "false"
tipc_msg_try_bundle() #
bool Try to bundle a new message to the last one
Parameters
struct sk_buff *tskb: the last/target message to which the new one will be appendedstruct sk_buff **skb: the new message skb pointeru32 mss: max message size (header inclusive)u32 dnode: destination node for the messagebool *new_bundle: if 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.
tipc_msg_extract() #
bool extract bundled inner packet from buffer
Parameters
struct sk_buff *skb: buffer to be extracted from.struct sk_buff **iskb: extracted inner buffer, to be returnedint *pos: position 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
tipc_msg_reverse() #
bool swap source and destination addresses and add error code
Parameters
u32 own_node: originating node id for reversed messagestruct sk_buff **skb: buffer containing message to be reversed; will be consumedint err: error code to be set in message, if any Replaces consumed buffer with new one when successful
Return
true if success, otherwise false
tipc_msg_lookup_dest() #
bool try to find new destination for named message
Parameters
struct net *net: pointer to associated network namespacestruct sk_buff *skb: the buffer containing the message.int *err: error 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
;
Members
lower: service range lower boundupper: service range upper boundtree_node: member of service range RB treemax: largest 'upper' in this node subtreelocal_publ: list of identical publications made from this node Used by closest_first lookup and multicast lookup algorithmall_publ: all 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
;
Members
type: 32 bit 'type' value for servicepubl_cnt: increasing counter for publications in this serviceranges: rb tree containing all service ranges for this serviceservice_list: links to adjacent name ranges in hash chainsubscriptions: list of subscriptions for this service typelock: spinlock controlling access to pertaining service ranges/publicationsrcu: RCU callback head used for deferred freeing
service_range_foreach_match() #
iterate over tipc service rbtree for each range match
Parameters
sr: the service range pointer as a loop cursorsc: the pointer to tipc service which holds the service range rbtreestart: beginning of the search range (end >= start) for matchingend: end of the search range (end >= start) for matching
service_range_match_first() #
struct service_range * find first service range matching a range
Parameters
struct rb_node *n: the root node of service range rbtree for searchingu32 start: beginning of the search range (end >= start) for matchingu32 end: end 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.
service_range_match_next() #
struct service_range * find next service range matching a range
Parameters
struct rb_node *n: a node in service range rbtree from which the searching startsu32 start: beginning of the search range (end >= start) for matchingu32 end: end 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.
tipc_publ_create() #
struct publication * create a publication structure
Parameters
struct tipc_uaddr *ua: the service range the user is binding tostruct tipc_socket_addr *sk: the address of the socket that is boundu32 key: publication key
tipc_service_create() #
struct tipc_service * create a service structure for the specified 'type'
Parameters
struct net *net: network namespacestruct tipc_uaddr *ua: address representing the service to be bound
Description
Allocates a single range structure and sets it to all 0's.
tipc_service_remove_publ() #
struct publication * remove a publication from a service
Parameters
struct service_range *r: service_range to remove publication fromstruct tipc_socket_addr *sk: address publishing socketu32 key: target publication key
tipc_service_subscribe() #
void 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 *service: the tipc_service to attach the sub tostruct tipc_subscription *sub: the subscription to attach
tipc_nametbl_lookup_anycast() #
bool perform service instance to socket translation
Parameters
struct net *net: network namespacestruct tipc_uaddr *ua: service address to look upstruct tipc_socket_addr *sk: address 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
tipc_nametbl_withdraw() #
void withdraw a service binding
Parameters
struct net *net: network namespacestruct tipc_uaddr *ua: service address/range being unboundstruct tipc_socket_addr *sk: address of the socket being unbound fromu32 key: target publication key
tipc_nametbl_subscribe() #
bool add a subscription object to the name table
Parameters
struct tipc_subscription *sub: subscription to add
tipc_nametbl_unsubscribe() #
void remove a subscription object from name table
Parameters
struct tipc_subscription *sub: subscription to remove
tipc_service_delete() #
void purge all publications for a service and delete it
Parameters
struct net *net: the associated network namespacestruct tipc_service *sc: tipc_service to delete
publ_to_item() #
void add publication info to a publication message
Parameters
struct distr_item *i: location of item in the messagestruct publication *p: publication info
named_prepare_buf() #
struct sk_buff * allocate & initialize a publication message
Parameters
struct net *net: the associated network namespaceu32 type: message typeu32 size: payload sizeu32 dest: destination node
Description
The buffer returned is of size INT_H_SIZE + payload size
tipc_named_publish() #
struct sk_buff * tell other nodes about a new publication by this node
Parameters
struct net *net: the associated network namespacestruct publication *p: the new publication
tipc_named_withdraw() #
struct sk_buff * tell other nodes about a withdrawn publication by this node
Parameters
struct net *net: the associated network namespacestruct publication *p: the withdrawn publication
named_distribute() #
void prepare name info for bulk distribution to another node
Parameters
struct net *net: the associated network namespacestruct sk_buff_head *list: list of messages (buffers) to be returned from this functionu32 dnode: node to be updatedstruct list_head *pls: linked list of publication items to be packed into buffer chainu16 seqno: sequence number for this message
tipc_named_node_up() #
void tell specified node about all publications by this node
Parameters
struct net *net: the associated network namespaceu32 dnode: destination nodeu16 capabilities: peer node's capabilities
tipc_publ_purge() #
void remove publication associated with a failed node
Parameters
struct net *net: the associated network namespacestruct publication *p: the publication to removeu32 addr: failed node's address
Description
Invoked for each publication issued by a newly failed node. Removes publication structure from name table & deletes it.
tipc_update_nametbl() #
bool try to process a nametable update and notify subscribers
Parameters
struct net *net: the associated network namespacestruct distr_item *i: location of item in the messageu32 node: node addressu32 dtype: name distributor message type
Description
tipc_nametbl_lock must be held.
Return
the publication item if successful, otherwise NULL.
tipc_named_rcv() #
void process name table update messages sent by another node
Parameters
struct net *net: the associated network namespacestruct sk_buff_head *namedq: queue to receive fromu16 *rcv_nxt: store last received seqno herebool *open: last bulk msg was received (FIXME)
tipc_named_reinit() #
void re-initialize local publications
Parameters
struct net *net: the 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
;
Members
addr: network address of nodekref: reference counter to node objectlock: rwlock governing access to structurenet: the applicable net namespacehash: links to adjacent nodes in unsorted hash chainactive_links: bearer ids of active links, used as index into links[] arraylinks: array containing references to all links to nodebc_entry: broadcast link entryaction_flags: bit mask of different types of node actionslist: links to adjacent nodes in sorted list of cluster's nodesstate: connectivity state vs peer nodepreliminary: a preliminary node or notfailover_sent: failover sent or notsync_point: sequence number where synch/failover is finishedlink_cnt: number of links to nodeworking_links: number of working links to node (both active and standby)capabilities: bitmap, indicating peer node's functional capabilitiessignature: node instance identifierlink_id: local and remote bearer ids of changing link, if anypeer_id: 128-bit ID of peerpeer_id_string: ID string of peerpubl_list: list of publicationsconn_sks: list of connections (FIXME)keepalive_intv: keepalive interval in millisecondstimer: node's keepalive timerrcu: rcu struct for tipc_nodedelete_at: indicates the time for deleting a down nodepeer_net: peer's net namespacepeer_hash_mix: hash for this peer (FIXME)crypto_rx: RX crypto handler
tipc_node_crypto_rx() #
struct tipc_crypto * Retrieve crypto RX handle from node
Parameters
struct tipc_node *__n: target tipc_node
Note
node ref counter must be held first!
__tipc_node_link_up() #
void handle addition of link
Parameters
struct tipc_node *n: target tipc_nodeint bearer_id: id of the bearerstruct sk_buff_head *xmitq: queue 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.
tipc_node_link_up() #
void handle addition of link
Parameters
struct tipc_node *n: target tipc_nodeint bearer_id: id of the bearerstruct sk_buff_head *xmitq: queue for messages to be xmited on
Description
Link becomes active (alone or shared) or standby, depending on its priority.
tipc_node_link_failover() #
void start failover in case "half-failover"
Parameters
struct tipc_node *n: tipc node structurestruct tipc_link *l: link peer endpoint failingover (- can be NULL)struct tipc_link *tnl: tunnel linkstruct sk_buff_head *xmitq: queue 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!
__tipc_node_link_down() #
void handle loss of link
Parameters
struct tipc_node *n: target tipc_nodeint *bearer_id: id of the bearerstruct sk_buff_head *xmitq: queue for messages to be xmited onstruct tipc_media_addr **maddr: output media address of the bearer
tipc_node_get_linkname() #
int get the name of a link
Parameters
struct net *net: the applicable net namespaceu32 bearer_id: id of the beareru32 addr: peer node addresschar *linkname: link name output buffersize_t len: size of linkname output buffer
Return
0 on success
tipc_node_xmit() #
int general link level function for message sending
Parameters
struct net *net: the applicable net namespacestruct sk_buff_head *list: chain of buffers containing messageu32 dnode: address of destination nodeint selector: a number used for deterministic link selection Consumes the buffer chain.
Return
0 if success, otherwise: -ELINKCONG,-EHOSTUNREACH,-EMSGSIZE,-ENOBUF
tipc_node_bc_rcv() #
void process TIPC broadcast packet arriving from off-node
Parameters
struct net *net: the applicable net namespacestruct sk_buff *skb: TIPC packetint bearer_id: id of bearer message arrived on
Description
Invoked with no locks held.
tipc_node_check_state() #
bool check and if necessary update node state
Parameters
struct tipc_node *n: target tipc_nodestruct sk_buff *skb: TIPC packetint bearer_id: identity of bearer delivering the packetstruct sk_buff_head *xmitq: queue for messages to be xmited on
Return
true if state and msg are ok, otherwise false
tipc_rcv() #
void process TIPC packets/messages arriving from off-node
Parameters
struct net *net: the applicable net namespacestruct sk_buff *skb: TIPC packetstruct tipc_bearer *b: pointer 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.
tipc_node_dump() #
int dump TIPC node data
Parameters
struct tipc_node *n: tipc node to be dumpedbool more: dump more?- false: dump only tipc node data
- true: dump node link data as well
char *buf: returned buffer of dump data in format
TIPC Socket Interfaces #
struct tipc_sock #
TIPC socket structure
Definition
;
Members
sk: socket - interacts with 'port' and with user via the socket APImax_pkt: maximum packet size "hint" used when building messages sent by portmaxnagle: maximum size of msg which can be subject to nagleportid: unique port identity in TIPC socket hash tablephdr: preformatted message header used when sending messagescong_links: list of congested linkspublications: list of publications for portpub_count: total # of publications port has made during its lifetimedupl_rcvcnt: number of bytes counted twice, in both backlog and rcv queueconn_timeout: the time we can wait for an unresponded setup requestprobe_unacked: probe has not received ack yetcong_link_cnt: number of congested linkssnt_unacked: # messages sent by socket, and not yet acked by peersnd_win: send window sizepeer_caps: peer capabilities maskrcv_unacked: # messages read by user, but not yet acked back to peerrcv_win: receive window sizepeer: 'connected' peer for dgram/rdmnode: hash table nodemc_method: cookie for use between socket and broadcast layerrcu: rcu struct for tipc_sockgroup: TIPC communications grouponeway: message count in one direction (FIXME)nagle_start: current nagle valuesnd_backlog: send backlog countmsg_acc: messages accepted; used in managing backlog and naglepkt_cnt: TIPC socket packet countexpect_ack: whether this TIPC socket is expecting an acknodelay:setsockopt()TIPC_NODELAY settinggroup_is_open: TIPC socket group is fully open (FIXME)published: true if port has one or more associated namesconn_addrtype: address type used when establishing connection
tsk_advance_rx_queue() #
void discard first buffer in socket receive queue
Parameters
struct sock *sk: network socket
Description
Caller must hold socket lock
tsk_rej_rx_queue() #
void reject all buffers in socket receive queue
Parameters
struct sock *sk: network socketint error: response error code
Description
Caller must hold socket lock
tipc_sk_create() #
int create a TIPC socket
Parameters
struct net *net: network namespace (must be default network)struct socket *sock: pre-allocated socket structureint protocol: protocol indicator (must be 0)int kern: caused 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
tipc_release() #
int destroy a TIPC socket
Parameters
struct socket *sock: socket 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
__tipc_bind() #
int associate or disassociate TIPC name(s) with a socket
Parameters
struct socket *sock: socket structurestruct sockaddr *skaddr: socket address describing name(s) and desired operationint alen: size 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.
tipc_getname() #
int get port ID of socket or peer socket
Parameters
struct socket *sock: socket structurestruct sockaddr *uaddr: area for returned socket addressint peer: 0 = 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).
tipc_poll() #
__poll_t read and possibly block on pollmask
Parameters
struct file *file: file structure associated with the socketstruct socket *sock: socket for which to calculate the poll bitspoll_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.
tipc_sendmcast() #
int send multicast message
Parameters
struct socket *sock: socket structurestruct tipc_uaddr *ua: destination address structstruct msghdr *msg: message to sendsize_t dlen: length of data to sendlong timeout: timeout 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
tipc_send_group_msg() #
int send a message to a member in the group
Parameters
struct net *net: network namespacestruct tipc_sock *tsk: tipc socketstruct msghdr *m: message to sendstruct tipc_member *mb: group memberu32 dnode: destination nodeu32 dport: destination portint dlen: total length of message data
tipc_send_group_unicast() #
int send message to a member in the group
Parameters
struct socket *sock: socket structurestruct msghdr *m: message to sendint dlen: total length of message datalong timeout: timeout 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
tipc_send_group_anycast() #
int send message to any member with given identity
Parameters
struct socket *sock: socket structurestruct msghdr *m: message to sendint dlen: total length of message datalong timeout: timeout 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
tipc_send_group_bcast() #
int send message to all members in communication group
Parameters
struct socket *sock: socket structurestruct msghdr *m: message to sendint dlen: total length of message datalong timeout: timeout 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
tipc_send_group_mcast() #
int send message to all members with given identity
Parameters
struct socket *sock: socket structurestruct msghdr *m: message to sendint dlen: total length of message datalong timeout: timeout 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
tipc_sk_mcast_rcv() #
void Deliver multicast messages to all destination sockets
Parameters
struct net *net: the associated network namespacestruct sk_buff_head *arrvq: queue with arriving messages, to be cloned after destination lookupstruct sk_buff_head *inputq: queue with cloned messages, delivered to socket after dest lookup
Description
Multi-threaded: parallel calls with reference to same queues may occur
tipc_sk_conn_proto_rcv() #
void receive a connection mng protocol message
Parameters
struct tipc_sock *tsk: receiving socketstruct sk_buff *skb: pointer to message buffer.struct sk_buff_head *inputq: buffer list containing the buffersstruct sk_buff_head *xmitq: output message area
tipc_sendmsg() #
int send message in connectionless manner
Parameters
struct socket *sock: socket structurestruct msghdr *m: message to sendsize_t dsz: amount 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
tipc_sendstream() #
int send stream-oriented data
Parameters
struct socket *sock: socket structurestruct msghdr *m: data to sendsize_t dsz: total 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
tipc_send_packet() #
int send a connection-oriented message
Parameters
struct socket *sock: socket structurestruct msghdr *m: message to sendsize_t dsz: length of data to be transmitted
Description
Used for SOCK_SEQPACKET messages.
Return
the number of bytes sent on success, or errno otherwise
tipc_sk_set_orig_addr() #
void capture sender's address for received message
Parameters
struct msghdr *m: descriptor for message infostruct sk_buff *skb: received message
Note
Address is not captured if not requested by receiver.
tipc_sk_anc_data_recv() #
int optionally capture ancillary data for received message
Parameters
struct msghdr *m: descriptor for message infostruct sk_buff *skb: received message bufferstruct tipc_sock *tsk: TIPC port associated with message
Note
Ancillary data is not captured if not requested by receiver.
Return
0 if successful, otherwise errno
tipc_recvmsg() #
int receive packet-oriented message
Parameters
struct socket *sock: network socketstruct msghdr *m: descriptor for message infosize_t buflen: length of user buffer areaint flags: receive 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
tipc_recvstream() #
int receive stream-oriented data
Parameters
struct socket *sock: network socketstruct msghdr *m: descriptor for message infosize_t buflen: total size of user buffer areaint flags: receive 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
tipc_write_space() #
void wake up thread if port congestion is released
Parameters
struct sock *sk: socket
tipc_data_ready() #
void wake up threads to indicate messages have been received
Parameters
struct sock *sk: socket
tipc_sk_filter_connect() #
bool check incoming message for a connection-based socket
Parameters
struct tipc_sock *tsk: TIPC socketstruct sk_buff *skb: pointer to message buffer.struct sk_buff_head *xmitq: for Nagle ACK if any
Return
true if message should be added to receive queue, false otherwise
rcvbuf_limit() #
unsigned int get proper overload limit of socket receive queue
Parameters
struct sock *sk: socketstruct sk_buff *skb: message
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
tipc_sk_filter_rcv() #
void validate incoming message
Parameters
struct sock *sk: socketstruct sk_buff *skb: pointer to message.struct sk_buff_head *xmitq: output 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
tipc_sk_backlog_rcv() #
int handle incoming message from backlog queue
Parameters
struct sock *sk: socketstruct sk_buff *skb: message
Description
Caller must hold socket lock
tipc_sk_enqueue() #
void extract all buffers with destination 'dport' from inputq and try adding them to socket or backlog queue
Parameters
struct sk_buff_head *inputq: list of incoming buffers with potentially different destinationsstruct sock *sk: socket where the buffers should be enqueuedu32 dport: port number for the socketstruct sk_buff_head *xmitq: output queue
Description
Caller must hold socket lock
tipc_sk_rcv() #
void handle a chain of incoming buffers
Parameters
struct net *net: the associated network namespacestruct sk_buff_head *inputq: buffer 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
tipc_connect() #
int establish a connection to another TIPC port
Parameters
struct socket *sock: socket structurestruct sockaddr_unsized *dest: socket address for destination portint destlen: size of socket address data structureint flags: file-related flags associated with socket
Return
0 on success, errno otherwise
tipc_listen() #
int allow socket to listen for incoming connections
Parameters
struct socket *sock: socket structureint len: (unused)
Return
0 on success, errno otherwise
tipc_accept() #
int wait for connection request
Parameters
struct socket *sock: listening socketstruct socket *new_sock: new socket that is to be connectedstruct proto_accept_arg *arg: arguments for accept
Return
0 on success, errno otherwise
tipc_shutdown() #
int shutdown socket connection
Parameters
struct socket *sock: socket structureint how: direction to close (must be SHUT_RDWR)
Description
Terminates connection (if necessary), then purges socket's receive queue.
Return
0 on success, errno otherwise
tipc_setsockopt() #
int set socket option
Parameters
struct socket *sock: socket structureint lvl: option levelint opt: option identifiersockptr_t ov: pointer to new option valueunsigned int ol: length of option value
Description
For stream sockets only, accepts and ignores all IPPROTO_TCP options (to ease compatibility).
Return
0 on success, errno otherwise
tipc_getsockopt() #
int get socket option
Parameters
struct socket *sock: socket structureint lvl: option levelint opt: option identifierchar __user *ov: receptacle for option valueint __user *ol: receptacle 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
tipc_socket_init() #
int initialize TIPC socket interface
Parameters
void: no arguments
Return
0 on success, errno otherwise
tipc_socket_stop() #
void stop TIPC socket interface
Parameters
void: no arguments
tipc_sk_filtering() #
bool check if a socket should be traced
Parameters
struct sock *sk: the 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
tipc_sk_overlimit1() #
bool check if socket rx queue is about to be overloaded, both the rcv and backlog queues are considered
Parameters
struct sock *sk: tipc sk to be checkedstruct sk_buff *skb: tipc msg to be checked
Return
true if the socket rx queue allocation is > 90%, otherwise false
tipc_sk_overlimit2() #
bool check if socket rx queue is about to be overloaded, only the rcv queue is considered
Parameters
struct sock *sk: tipc sk to be checkedstruct sk_buff *skb: tipc msg to be checked
Return
true if the socket rx queue allocation is > 90%, otherwise false
tipc_sk_dump() #
int dump TIPC socket
Parameters
struct sock *sk: tipc sk to be dumpedu16 dqueues: bitmask 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 *buf: returned buffer of dump data in format
TIPC Network Topology Interfaces #
tipc_sub_check_overlap() #
bool test for subscription overlap with the given values
Parameters
struct tipc_service_range *subscribed: the service range subscribed forstruct tipc_service_range *found: the 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
;
Members
conn_idr: identifier set of connectionidr_lock: protect the connection identifier setidr_in_use: amount of allocated identifier entrynet: network namespace instanceawork: accept work itemrcv_wq: receive workqueuesend_wq: send workqueuelistener: topsrv listener socketname: server name
struct tipc_conn #
TIPC connection structure
Definition
;
Members
kref: reference counter to connection objectconid: connection identifiersock: socket handler associated with connectionflags: indicates connection stateserver: pointer to connected serversub_list: list to all pertaining subscriptionssub_lock: lock protecting the subscription listrwork: receive work itemoutqueue: pointer to first outbound message in queueoutqueue_lock: control access to the outqueueswork: send work item
TIPC Trace Interfaces #
tipc_skb_dump() #
int dump TIPC skb data
Parameters
struct sk_buff *skb: skb to be dumpedbool more: dump more?- false: dump only tipc msg data
- true: dump kernel-related skb data and tipc cb[] array as well
char *buf: returned buffer of dump data in format
tipc_list_dump() #
int dump TIPC skb list/queue
Parameters
struct sk_buff_head *list: list of skbs to be dumpedbool more: dump more?- false: dump only the head & tail skbs
- true: dump the first & last 5 skbs
char *buf: returned buffer of dump data in format