Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
df6b4e66
Commit
df6b4e66
authored
Jul 30, 2018
by
James Morris
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'smack-for-4.19-a' of
https://github.com/cschaufler/next-smack
into next-smack
From Casey Schaufler.
parents
87ea5843
d66a8acb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
security/smack/smack_lsm.c
security/smack/smack_lsm.c
+16
-6
No files found.
security/smack/smack_lsm.c
View file @
df6b4e66
...
...
@@ -28,6 +28,7 @@
#include <linux/tcp.h>
#include <linux/udp.h>
#include <linux/dccp.h>
#include <linux/icmpv6.h>
#include <linux/slab.h>
#include <linux/mutex.h>
#include <linux/pipe_fs_i.h>
...
...
@@ -3895,6 +3896,7 @@ static int smk_skb_to_addr_ipv6(struct sk_buff *skb, struct sockaddr_in6 *sip)
sip
->
sin6_port
=
th
->
source
;
break
;
case
IPPROTO_UDP
:
case
IPPROTO_UDPLITE
:
uh
=
skb_header_pointer
(
skb
,
offset
,
sizeof
(
_udph
),
&
_udph
);
if
(
uh
!=
NULL
)
sip
->
sin6_port
=
uh
->
source
;
...
...
@@ -3923,15 +3925,19 @@ static int smack_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)
struct
smack_known
*
skp
=
NULL
;
int
rc
=
0
;
struct
smk_audit_info
ad
;
u16
family
=
sk
->
sk_family
;
#ifdef CONFIG_AUDIT
struct
lsm_network_audit
net
;
#endif
#if IS_ENABLED(CONFIG_IPV6)
struct
sockaddr_in6
sadd
;
int
proto
;
if
(
family
==
PF_INET6
&&
skb
->
protocol
==
htons
(
ETH_P_IP
))
family
=
PF_INET
;
#endif
/* CONFIG_IPV6 */
switch
(
sk
->
sk_
family
)
{
switch
(
family
)
{
case
PF_INET
:
#ifdef CONFIG_SECURITY_SMACK_NETFILTER
/*
...
...
@@ -3949,7 +3955,7 @@ static int smack_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)
*/
netlbl_secattr_init
(
&
secattr
);
rc
=
netlbl_skbuff_getattr
(
skb
,
sk
->
sk_
family
,
&
secattr
);
rc
=
netlbl_skbuff_getattr
(
skb
,
family
,
&
secattr
);
if
(
rc
==
0
)
skp
=
smack_from_secattr
(
&
secattr
,
ssp
);
else
...
...
@@ -3962,7 +3968,7 @@ static int smack_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)
#endif
#ifdef CONFIG_AUDIT
smk_ad_init_net
(
&
ad
,
__func__
,
LSM_AUDIT_DATA_NET
,
&
net
);
ad
.
a
.
u
.
net
->
family
=
sk
->
sk_
family
;
ad
.
a
.
u
.
net
->
family
=
family
;
ad
.
a
.
u
.
net
->
netif
=
skb
->
skb_iif
;
ipv4_skb_to_auditdata
(
skb
,
&
ad
.
a
,
NULL
);
#endif
...
...
@@ -3976,12 +3982,13 @@ static int smack_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)
rc
=
smk_bu_note
(
"IPv4 delivery"
,
skp
,
ssp
->
smk_in
,
MAY_WRITE
,
rc
);
if
(
rc
!=
0
)
netlbl_skbuff_err
(
skb
,
sk
->
sk_
family
,
rc
,
0
);
netlbl_skbuff_err
(
skb
,
family
,
rc
,
0
);
break
;
#if IS_ENABLED(CONFIG_IPV6)
case
PF_INET6
:
proto
=
smk_skb_to_addr_ipv6
(
skb
,
&
sadd
);
if
(
proto
!=
IPPROTO_UDP
&&
proto
!=
IPPROTO_TCP
)
if
(
proto
!=
IPPROTO_UDP
&&
proto
!=
IPPROTO_UDPLITE
&&
proto
!=
IPPROTO_TCP
&&
proto
!=
IPPROTO_DCCP
)
break
;
#ifdef SMACK_IPV6_SECMARK_LABELING
if
(
skb
&&
skb
->
secmark
!=
0
)
...
...
@@ -3992,7 +3999,7 @@ static int smack_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)
skp
=
smack_net_ambient
;
#ifdef CONFIG_AUDIT
smk_ad_init_net
(
&
ad
,
__func__
,
LSM_AUDIT_DATA_NET
,
&
net
);
ad
.
a
.
u
.
net
->
family
=
sk
->
sk_
family
;
ad
.
a
.
u
.
net
->
family
=
family
;
ad
.
a
.
u
.
net
->
netif
=
skb
->
skb_iif
;
ipv6_skb_to_auditdata
(
skb
,
&
ad
.
a
,
NULL
);
#endif
/* CONFIG_AUDIT */
...
...
@@ -4003,6 +4010,9 @@ static int smack_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)
#ifdef SMACK_IPV6_PORT_LABELING
rc
=
smk_ipv6_port_check
(
sk
,
&
sadd
,
SMK_RECEIVING
);
#endif
/* SMACK_IPV6_PORT_LABELING */
if
(
rc
!=
0
)
icmpv6_send
(
skb
,
ICMPV6_DEST_UNREACH
,
ICMPV6_ADM_PROHIBITED
,
0
);
break
;
#endif
/* CONFIG_IPV6 */
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment