Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\selinux\hooks.c Create Date:2022-07-28 19:00:03
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:This supports connect(2) and SCTP connect services such as sctp_connectx(3)* and sctp_sendmsg(3) as described in Documentation/security/SCTP.rst

Proto:static int selinux_socket_connect_helper(struct socket *sock, struct sockaddr *address, int addrlen)

Type:int

Parameter:

TypeParameterName
struct socket *sock
struct sockaddr *address
intaddrlen
4713  sk = sk
4714  sksec = sk_security
4717  err = sock_has_perm(sk, SOCKET__CONNECT)
4718  If err Then Return err
4720  If addrlen < get the member end offset of(structsockaddr, sa_family) Then Return -EINVAL
4726  If address family, AF_xxx == Supported address families. Then Return 0
4733  If sock security class == SECCLASS_TCP_SOCKET || sock security class == SECCLASS_DCCP_SOCKET || sock security class == SECCLASS_SCTP_SOCKET Then
4737  struct lsm_network_audit net = {0, }
4738  struct sockaddr_in * addr4 = NULL
4739  struct sockaddr_in6 * addr6 = NULL
4750  addr4 = address
4751  If addrlen < sizeof(structsockaddr_in) Then Return -EINVAL
4754  Break
4756  addr6 = address
4757  If addrlen < SIN6_LEN_RFC2133 Then Return -EINVAL
4760  Break
4761  Default
4767  Else Return -EAFNOSUPPORT
4771  err = sel_netport_sid(sk_protocol, snum, & sid)
4772  If err Then Return err
4778  Break
4781  Break
4784  Break
4787  type = LSM_AUDIT_DATA_NET
4788  net = net
4789  dport = htons(snum)
4790  family = address family, AF_xxx
4791  err = avc_has_perm - Check permissions and perform any appropriate auditing
4793  If err Then Return err
4797  Return 0
Caller
NameDescribe
selinux_socket_connectSupports connect(2), see comments in selinux_socket_connect_helper()
selinux_sctp_bind_connectCheck if sctp IPv4/IPv6 addresses are valid for binding or connecting* based on their @optname.