aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2010-02-10 09:03:27 -0500
committerPatrick McHardy <kaber@trash.net>2010-02-10 09:03:27 -0500
commit42107f5009da223daa800d6da6904d77297ae829 (patch)
tree2e7490aa84a59e1e3f8753ce18c9faaa50ac6e32
parent0a02604628c49037e1de2091d75462fd856b26ed (diff)
netfilter: xtables: symmetric COMPAT_XT_ALIGN definition
Rewrite COMPAT_XT_ALIGN in terms of dummy structure hack. Compat counters logically have nothing to do with it. Use ALIGN() macro while I'm at it for same types. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Patrick McHardy <kaber@trash.net>
-rw-r--r--include/linux/netfilter/x_tables.h13
-rw-r--r--net/netfilter/x_tables.c4
2 files changed, 11 insertions, 6 deletions
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 8b6c0e7d2657..9d671ebf0605 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -93,8 +93,7 @@ struct _xt_align {
93 __u64 u64; 93 __u64 u64;
94}; 94};
95 95
96#define XT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) \ 96#define XT_ALIGN(s) ALIGN((s), __alignof__(struct _xt_align))
97 & ~(__alignof__(struct _xt_align)-1))
98 97
99/* Standard return verdict, or do jump. */ 98/* Standard return verdict, or do jump. */
100#define XT_STANDARD_TARGET "" 99#define XT_STANDARD_TARGET ""
@@ -571,8 +570,14 @@ struct compat_xt_counters_info {
571 struct compat_xt_counters counters[0]; 570 struct compat_xt_counters counters[0];
572}; 571};
573 572
574#define COMPAT_XT_ALIGN(s) (((s) + (__alignof__(struct compat_xt_counters)-1)) \ 573struct _compat_xt_align {
575 & ~(__alignof__(struct compat_xt_counters)-1)) 574 __u8 u8;
575 __u16 u16;
576 __u32 u32;
577 compat_u64 u64;
578};
579
580#define COMPAT_XT_ALIGN(s) ALIGN((s), __alignof__(struct _compat_xt_align))
576 581
577extern void xt_compat_lock(u_int8_t af); 582extern void xt_compat_lock(u_int8_t af);
578extern void xt_compat_unlock(u_int8_t af); 583extern void xt_compat_unlock(u_int8_t af);
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index f01955cce314..5c564ff10a3b 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -364,7 +364,7 @@ int xt_check_match(struct xt_mtchk_param *par,
364 * ebt_among is exempt from centralized matchsize checking 364 * ebt_among is exempt from centralized matchsize checking
365 * because it uses a dynamic-size data set. 365 * because it uses a dynamic-size data set.
366 */ 366 */
367 pr_err("%s_tables: %s match: invalid size %Zu != %u\n", 367 pr_err("%s_tables: %s match: invalid size %u != %u\n",
368 xt_prefix[par->family], par->match->name, 368 xt_prefix[par->family], par->match->name,
369 XT_ALIGN(par->match->matchsize), size); 369 XT_ALIGN(par->match->matchsize), size);
370 return -EINVAL; 370 return -EINVAL;
@@ -514,7 +514,7 @@ int xt_check_target(struct xt_tgchk_param *par,
514 unsigned int size, u_int8_t proto, bool inv_proto) 514 unsigned int size, u_int8_t proto, bool inv_proto)
515{ 515{
516 if (XT_ALIGN(par->target->targetsize) != size) { 516 if (XT_ALIGN(par->target->targetsize) != size) {
517 pr_err("%s_tables: %s target: invalid size %Zu != %u\n", 517 pr_err("%s_tables: %s target: invalid size %u != %u\n",
518 xt_prefix[par->family], par->target->name, 518 xt_prefix[par->family], par->target->name,
519 XT_ALIGN(par->target->targetsize), size); 519 XT_ALIGN(par->target->targetsize), size);
520 return -EINVAL; 520 return -EINVAL;