Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:selinux_netlbl_skbuff_setsid - Set the NetLabel on a packet given a sid*@skb: the packet*@family: protocol family*@sid: the SID* Description* Call the NetLabel mechanism to set the label of a packet using @sid.

Proto:int selinux_netlbl_skbuff_setsid(struct sk_buff *skb, u16 family, unsigned int sid)

Type:int

Parameter:

TypeParameterName
struct sk_buff *skb
u16family
unsigned intsid
231  struct netlbl_lsm_secattr * secattr = NULL
236  sk = skb_to_full_sk(skb)
237  If (sk != NULL) Then
238  sksec = sk_security
240  If nlbl_state != NLBL_REQSKB Then Return 0
242  secattr = selinux_netlbl_sock_getattr - Get the cached NetLabel secattr*@sk: the socket*@sid: the SID* Query the socket's cached secattr and if the SID matches the cached value* return the cache, otherwise return NULL.
244  If (secattr == NULL) Then
245  secattr = secattr_storage
246  lbl_secattr_init - Initialize a netlbl_lsm_secattr struct*@secattr: the struct to initialize* Description:* Initialize an already allocated netlbl_lsm_secattr struct.
247  rc = security_netlbl_sid_to_secattr( & selinux_state, sid, secattr)
249  If rc != 0 Then Go to skbuff_setsid_return
253  rc = netlbl_skbuff_setattr(skb, family, secattr)
255  skbuff_setsid_return :
256  If secattr == secattr_storage Then lbl_secattr_destroy - Clears a netlbl_lsm_secattr struct*@secattr: the struct to clear* Description:* Destroys the @secattr struct, including freeing all of the internal buffers.* The struct must be reset with a call to netlbl_secattr_init() before reuse.
258  Return rc