|
80 | 80 | #include "objsec.h" |
81 | 81 | #include "netif.h" |
82 | 82 | #include "netnode.h" |
| 83 | +#include "netport.h" |
83 | 84 | #include "xfrm.h" |
84 | 85 | #include "netlabel.h" |
85 | 86 |
|
@@ -3670,10 +3671,8 @@ static int selinux_socket_bind(struct socket *sock, struct sockaddr *address, in |
3670 | 3671 | inet_get_local_port_range(&low, &high); |
3671 | 3672 |
|
3672 | 3673 | if (snum < max(PROT_SOCK, low) || snum > high) { |
3673 | | - err = security_port_sid(sk->sk_family, |
3674 | | - sk->sk_type, |
3675 | | - sk->sk_protocol, snum, |
3676 | | - &sid); |
| 3674 | + err = sel_netport_sid(sk->sk_protocol, |
| 3675 | + snum, &sid); |
3677 | 3676 | if (err) |
3678 | 3677 | goto out; |
3679 | 3678 | AVC_AUDIT_DATA_INIT(&ad,NET); |
@@ -3761,8 +3760,7 @@ static int selinux_socket_connect(struct socket *sock, struct sockaddr *address, |
3761 | 3760 | snum = ntohs(addr6->sin6_port); |
3762 | 3761 | } |
3763 | 3762 |
|
3764 | | - err = security_port_sid(sk->sk_family, sk->sk_type, |
3765 | | - sk->sk_protocol, snum, &sid); |
| 3763 | + err = sel_netport_sid(sk->sk_protocol, snum, &sid); |
3766 | 3764 | if (err) |
3767 | 3765 | goto out; |
3768 | 3766 |
|
@@ -3993,9 +3991,8 @@ static int selinux_sock_rcv_skb_iptables_compat(struct sock *sk, |
3993 | 3991 |
|
3994 | 3992 | if (!recv_perm) |
3995 | 3993 | return 0; |
3996 | | - err = security_port_sid(sk->sk_family, sk->sk_type, |
3997 | | - sk->sk_protocol, ntohs(ad->u.net.sport), |
3998 | | - &port_sid); |
| 3994 | + err = sel_netport_sid(sk->sk_protocol, |
| 3995 | + ntohs(ad->u.net.sport), &port_sid); |
3999 | 3996 | if (unlikely(err)) { |
4000 | 3997 | printk(KERN_WARNING |
4001 | 3998 | "SELinux: failure in" |
@@ -4416,9 +4413,8 @@ static int selinux_ip_postroute_iptables_compat(struct sock *sk, |
4416 | 4413 | if (send_perm != 0) |
4417 | 4414 | return 0; |
4418 | 4415 |
|
4419 | | - err = security_port_sid(sk->sk_family, sk->sk_type, |
4420 | | - sk->sk_protocol, ntohs(ad->u.net.dport), |
4421 | | - &port_sid); |
| 4416 | + err = sel_netport_sid(sk->sk_protocol, |
| 4417 | + ntohs(ad->u.net.dport), &port_sid); |
4422 | 4418 | if (unlikely(err)) { |
4423 | 4419 | printk(KERN_WARNING |
4424 | 4420 | "SELinux: failure in" |
|
0 commit comments