netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [NETFILTER] [PATCH] xt_sctp: use WORD_ROUND macro to calculate length of multiple of 4 bytes
@ 2010-06-06 18:08 Shan Wei
  2010-06-09 12:48 ` Patrick McHardy
  0 siblings, 1 reply; 2+ messages in thread
From: Shan Wei @ 2010-06-06 18:08 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: netfilter-devel

Use  WORD_ROUND to round an int up to the next multiple of 4.

Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
---
 net/netfilter/xt_sctp.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/netfilter/xt_sctp.c b/net/netfilter/xt_sctp.c
index c04fcf3..ef36a56 100644
--- a/net/netfilter/xt_sctp.c
+++ b/net/netfilter/xt_sctp.c
@@ -3,6 +3,7 @@
 #include <linux/skbuff.h>
 #include <net/ip.h>
 #include <net/ipv6.h>
+#include <net/sctp/sctp.h>
 #include <linux/sctp.h>
 
 #include <linux/netfilter/x_tables.h>
@@ -67,7 +68,7 @@ match_packet(const struct sk_buff *skb,
 			 ++i, offset, sch->type, htons(sch->length),
 			 sch->flags);
 #endif
-		offset += (ntohs(sch->length) + 3) & ~3;
+		offset += WORD_ROUND(ntohs(sch->length));
 
 		pr_debug("skb->len: %d\toffset: %d\n", skb->len, offset);
 
-- 
1.6.3.3


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

* Re: [NETFILTER] [PATCH] xt_sctp: use WORD_ROUND macro to calculate length of multiple of 4 bytes
  2010-06-06 18:08 [NETFILTER] [PATCH] xt_sctp: use WORD_ROUND macro to calculate length of multiple of 4 bytes Shan Wei
@ 2010-06-09 12:48 ` Patrick McHardy
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick McHardy @ 2010-06-09 12:48 UTC (permalink / raw)
  To: Shan Wei; +Cc: netfilter-devel

Shan Wei wrote:
> Use  WORD_ROUND to round an int up to the next multiple of 4.
>   


Applied, thanks.

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

end of thread, other threads:[~2010-06-09 12:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-06 18:08 [NETFILTER] [PATCH] xt_sctp: use WORD_ROUND macro to calculate length of multiple of 4 bytes Shan Wei
2010-06-09 12:48 ` Patrick McHardy

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).