Skip to contentSkip to conversation

selinux: pull address family directly from the request_sock struct

PATCH New Paul Moore 1 participant 1 message Dec 4, 2013 SELinux security module

lore
Share & tools
lore

Paul Moore

author
#0 lore raw

PATCH 1/1 selinux: pull address family directly from the request_sock struct

We don't need to inspect the packet to determine if the packet is an IPv4 packet arriving on an IPv6 socket when we can query the request_sock directly.

---
 security/selinux/hooks.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
security/selinux/hooks.c +1 -5
index cc076a9..17d7689 100644
@@ -4476,14 +4476,10 @@ static int selinux_inet_conn_request(struct sock *sk, struct sk_buff *skb,
 {
 	struct sk_security_struct *sksec = sk->sk_security;
 	int err;
-	u16 family = sk->sk_family;
+	u16 family = req->rsk_ops->family;
 	u32 connsid;
 	u32 peersid;
 
-	/* handle mapped IPv4 packets arriving via IPv6 sockets */
-	if (family == PF_INET6 && skb->protocol == htons(ETH_P_IP))
-		family = PF_INET;
-
 	err = selinux_skb_peerlbl_sid(skb, family, &peersid);
 	if (err)
 		return err;

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.