From: Werner Almesberger <werner@almesberger.net>
To: netdev@vger.kernel.org
Subject: Re: minimum ICMPv6 message size vs. RPL's DIS
Date: Thu, 25 Jul 2013 07:30:49 -0300 [thread overview]
Message-ID: <20130725103048.GB29572@ws> (raw)
In-Reply-To: <20130725061731.GA12365@order.stressinduktion.org>
Hannes Frederic Sowa wrote:
> Hmm, maybe we should update the icmp header to something like
That would be quite clean. Is it okay to introduce new names
like that in a uapi/ header (uapi/linux/icmpv6.h) ?
> Hmm, there is a bug in this function, _hdr must not be a pointer.
Oh, I didn't even notice that. Very good catch !
So on 32 bit system, it would actually work even with "short"
ICMPv6 messages. Two wrongs sometimes do make a right :-)
I've attached a revised patch that, according to quick testing,
still works and doesn't break anything else.
Thanks,
- Werner
---------------------------------- cut here -----------------------------------
diff --git a/include/uapi/linux/icmpv6.h b/include/uapi/linux/icmpv6.h
index e0133c7..11eb5ff 100644
--- a/include/uapi/linux/icmpv6.h
+++ b/include/uapi/linux/icmpv6.h
@@ -5,11 +5,15 @@
#include <asm/byteorder.h>
struct icmp6hdr {
-
- __u8 icmp6_type;
- __u8 icmp6_code;
- __sum16 icmp6_cksum;
-
+ struct icmp6hdr_head {
+ __u8 type;
+ __u8 code;
+ __sum16 cksum;
+ } icmpv6_head;
+
+#define icmp6_type icmpv6_head.type
+#define icmp6_code icmpv6_head.code
+#define icmp6_cksum icmpv6_head.cksum
union {
__be32 un_data32[1];
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index c45f7a5..99ab06f 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -108,14 +108,14 @@ found:
*/
static int icmpv6_filter(const struct sock *sk, const struct sk_buff *skb)
{
- struct icmp6hdr *_hdr;
- const struct icmp6hdr *hdr;
+ struct icmp6hdr_head _head;
+ const struct icmp6hdr_head *head;
- hdr = skb_header_pointer(skb, skb_transport_offset(skb),
- sizeof(_hdr), &_hdr);
- if (hdr) {
+ head = skb_header_pointer(skb, skb_transport_offset(skb),
+ sizeof(_head), &_head);
+ if (head) {
const __u32 *data = &raw6_sk(sk)->filter.data[0];
- unsigned int type = hdr->icmp6_type;
+ unsigned int type = head->type;
return (data[type >> 5] & (1U << (type & 31))) != 0;
}
next prev parent reply other threads:[~2013-07-25 10:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-24 23:28 minimum ICMPv6 message size vs. RPL's DIS Werner Almesberger
2013-07-25 6:17 ` Hannes Frederic Sowa
2013-07-25 10:30 ` Werner Almesberger [this message]
2013-07-25 13:03 ` Hannes Frederic Sowa
2013-07-25 13:58 ` Hannes Frederic Sowa
2013-07-25 14:32 ` Werner Almesberger
2013-07-25 18:40 ` Hannes Frederic Sowa
2013-07-25 21:47 ` Werner Almesberger
2013-07-25 23:31 ` Hannes Frederic Sowa
2013-08-01 5:48 ` Hannes Frederic Sowa
2013-08-02 1:10 ` David Miller
2013-08-02 4:51 ` Werner Almesberger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130725103048.GB29572@ws \
--to=werner@almesberger.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).