All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] netlabel: If PF_INET6, check sk_buff ip header version
@ 2017-11-13 20:54 ` Richard Haines
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Haines @ 2017-11-13 20:54 UTC (permalink / raw)
  To: paul, selinux, netdev; +Cc: Richard Haines

When resolving a fallback label, check the sk_buff version as it
is possible (e.g. SCTP) to have family = PF_INET6 while
receiving ip_hdr(skb)->version = 4.

Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
---
 net/netlabel/netlabel_unlabeled.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
index 22dc1b9..c070dfc 100644
--- a/net/netlabel/netlabel_unlabeled.c
+++ b/net/netlabel/netlabel_unlabeled.c
@@ -1472,6 +1472,16 @@ int netlbl_unlabel_getattr(const struct sk_buff *skb,
 		iface = rcu_dereference(netlbl_unlhsh_def);
 	if (iface == NULL || !iface->valid)
 		goto unlabel_getattr_nolabel;
+
+#if IS_ENABLED(CONFIG_IPV6)
+	/* When resolving a fallback label, check the sk_buff version as
+	 * it is possible (e.g. SCTP) to have family = PF_INET6 while
+	 * receiving ip_hdr(skb)->version = 4.
+	 */
+	if (family == PF_INET6 && ip_hdr(skb)->version == 4)
+		family = PF_INET;
+#endif /* IPv6 */
+
 	switch (family) {
 	case PF_INET: {
 		struct iphdr *hdr4;
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] netlabel: If PF_INET6, check sk_buff ip header version
@ 2017-11-13 20:54 ` Richard Haines
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Haines @ 2017-11-13 20:54 UTC (permalink / raw)
  To: paul, selinux, netdev

When resolving a fallback label, check the sk_buff version as it
is possible (e.g. SCTP) to have family = PF_INET6 while
receiving ip_hdr(skb)->version = 4.

Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
---
 net/netlabel/netlabel_unlabeled.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
index 22dc1b9..c070dfc 100644
--- a/net/netlabel/netlabel_unlabeled.c
+++ b/net/netlabel/netlabel_unlabeled.c
@@ -1472,6 +1472,16 @@ int netlbl_unlabel_getattr(const struct sk_buff *skb,
 		iface = rcu_dereference(netlbl_unlhsh_def);
 	if (iface == NULL || !iface->valid)
 		goto unlabel_getattr_nolabel;
+
+#if IS_ENABLED(CONFIG_IPV6)
+	/* When resolving a fallback label, check the sk_buff version as
+	 * it is possible (e.g. SCTP) to have family = PF_INET6 while
+	 * receiving ip_hdr(skb)->version = 4.
+	 */
+	if (family == PF_INET6 && ip_hdr(skb)->version == 4)
+		family = PF_INET;
+#endif /* IPv6 */
+
 	switch (family) {
 	case PF_INET: {
 		struct iphdr *hdr4;
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] netlabel: If PF_INET6, check sk_buff ip header version
  2017-11-13 20:54 ` Richard Haines
  (?)
@ 2017-11-13 22:13 ` Paul Moore
  2018-02-14 19:03   ` Paul Moore
  -1 siblings, 1 reply; 4+ messages in thread
From: Paul Moore @ 2017-11-13 22:13 UTC (permalink / raw)
  To: Richard Haines; +Cc: selinux, netdev

On Mon, Nov 13, 2017 at 3:54 PM, Richard Haines
<richard_c_haines@btinternet.com> wrote:
> When resolving a fallback label, check the sk_buff version as it
> is possible (e.g. SCTP) to have family = PF_INET6 while
> receiving ip_hdr(skb)->version = 4.
>
> Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
> ---
>  net/netlabel/netlabel_unlabeled.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)

Thanks Richard.

Acked-by: Paul Moore <paul@paul-moore.com>

> diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
> index 22dc1b9..c070dfc 100644
> --- a/net/netlabel/netlabel_unlabeled.c
> +++ b/net/netlabel/netlabel_unlabeled.c
> @@ -1472,6 +1472,16 @@ int netlbl_unlabel_getattr(const struct sk_buff *skb,
>                 iface = rcu_dereference(netlbl_unlhsh_def);
>         if (iface == NULL || !iface->valid)
>                 goto unlabel_getattr_nolabel;
> +
> +#if IS_ENABLED(CONFIG_IPV6)
> +       /* When resolving a fallback label, check the sk_buff version as
> +        * it is possible (e.g. SCTP) to have family = PF_INET6 while
> +        * receiving ip_hdr(skb)->version = 4.
> +        */
> +       if (family == PF_INET6 && ip_hdr(skb)->version == 4)
> +               family = PF_INET;
> +#endif /* IPv6 */
> +
>         switch (family) {
>         case PF_INET: {
>                 struct iphdr *hdr4;
> --
> 2.13.6

-- 
paul moore
www.paul-moore.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] netlabel: If PF_INET6, check sk_buff ip header version
  2017-11-13 22:13 ` Paul Moore
@ 2018-02-14 19:03   ` Paul Moore
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Moore @ 2018-02-14 19:03 UTC (permalink / raw)
  To: Richard Haines; +Cc: selinux, netdev

On Mon, Nov 13, 2017 at 5:13 PM, Paul Moore <paul@paul-moore.com> wrote:
> On Mon, Nov 13, 2017 at 3:54 PM, Richard Haines
> <richard_c_haines@btinternet.com> wrote:
>> When resolving a fallback label, check the sk_buff version as it
>> is possible (e.g. SCTP) to have family = PF_INET6 while
>> receiving ip_hdr(skb)->version = 4.
>>
>> Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
>> ---
>>  net/netlabel/netlabel_unlabeled.c | 10 ++++++++++
>>  1 file changed, 10 insertions(+)
>
> Thanks Richard.
>
> Acked-by: Paul Moore <paul@paul-moore.com>

I don't believe the netdev folks picked this up, but I haven't heard
any objections (and I can't imagine there would be any) so I'm going
to go ahead and pull this into the selinux/next tree.

>> diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
>> index 22dc1b9..c070dfc 100644
>> --- a/net/netlabel/netlabel_unlabeled.c
>> +++ b/net/netlabel/netlabel_unlabeled.c
>> @@ -1472,6 +1472,16 @@ int netlbl_unlabel_getattr(const struct sk_buff *skb,
>>                 iface = rcu_dereference(netlbl_unlhsh_def);
>>         if (iface == NULL || !iface->valid)
>>                 goto unlabel_getattr_nolabel;
>> +
>> +#if IS_ENABLED(CONFIG_IPV6)
>> +       /* When resolving a fallback label, check the sk_buff version as
>> +        * it is possible (e.g. SCTP) to have family = PF_INET6 while
>> +        * receiving ip_hdr(skb)->version = 4.
>> +        */
>> +       if (family == PF_INET6 && ip_hdr(skb)->version == 4)
>> +               family = PF_INET;
>> +#endif /* IPv6 */
>> +
>>         switch (family) {
>>         case PF_INET: {
>>                 struct iphdr *hdr4;
>> --
>> 2.13.6

-- 
paul moore
www.paul-moore.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-02-14 19:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-13 20:54 [PATCH] netlabel: If PF_INET6, check sk_buff ip header version Richard Haines
2017-11-13 20:54 ` Richard Haines
2017-11-13 22:13 ` Paul Moore
2018-02-14 19:03   ` Paul Moore

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.