netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yuxuan Shui <yshuiv7@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: Yuxuan Shui <yshuiv7@gmail.com>
Subject: [nftables PATCH] src: proto: fix byteorder for ip headers.
Date: Wed,  4 Jun 2014 20:46:29 +0800	[thread overview]
Message-ID: <1401885989-9162-1-git-send-email-yshuiv7@gmail.com> (raw)

Add a new datatype for ip headers which specify the byteorder, this
fixes bug 918.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
---
 src/proto.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/proto.c b/src/proto.c
index 0a37a65..f1556db 100644
--- a/src/proto.c
+++ b/src/proto.c
@@ -184,13 +184,21 @@ void proto_ctx_update(struct proto_ctx *ctx, enum proto_bases base,
 	proto_ctx_debug(ctx, base);
 }
 
+const struct datatype net_integer = {
+	.type = TYPE_INTEGER,
+	.byteorder = BYTEORDER_BIG_ENDIAN,
+	.name = "net_integer",
+	.desc = "network integer",
+	.basetype = &integer_type,
+};
+
 #define HDR_TEMPLATE(__name, __dtype, __type, __member)			\
 	PROTO_HDR_TEMPLATE(__name, __dtype,				\
 			   offsetof(__type, __member) * 8,		\
 			   field_sizeof(__type, __member) * 8)
 
 #define HDR_FIELD(__name, __struct, __member)				\
-	HDR_TEMPLATE(__name, &integer_type, __struct, __member)
+	HDR_TEMPLATE(__name, &net_integer, __struct, __member)
 #define HDR_BITFIELD(__name, __dtype,  __offset, __len)			\
 	PROTO_HDR_TEMPLATE(__name, __dtype, __offset, __len)
 #define HDR_TYPE(__name, __dtype, __struct, __member)			\
-- 
2.0.0


             reply	other threads:[~2014-06-04 12:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-04 12:46 Yuxuan Shui [this message]
2014-06-04 16:44 ` [nftables PATCH] src: proto: fix byteorder for ip headers Patrick McHardy
2014-06-05 12:48   ` Pablo Neira Ayuso

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=1401885989-9162-1-git-send-email-yshuiv7@gmail.com \
    --to=yshuiv7@gmail.com \
    --cc=netfilter-devel@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).