ia64/linux-2.6.18-xen.hg

view net/netfilter/xt_length.c @ 871:9cbcc9008446

xen/x86: don't initialize cpu_data[]'s apicid field on generic code

Afaict, this is not only redundant with the intialization done in
drivers/xen/core/smpboot.c, but actually results - at least for
secondary CPUs - in the Xen-specific value written to be later
overwritten with whatever the generic code determines (with no
guarantee that the two values are identical).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu May 14 10:09:15 2009 +0100 (2009-05-14)
parents 831230e53067
children
line source
1 /* Kernel module to match packet length. */
2 /* (C) 1999-2001 James Morris <jmorros@intercode.com.au>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
9 #include <linux/module.h>
10 #include <linux/skbuff.h>
11 #include <linux/ipv6.h>
12 #include <net/ip.h>
14 #include <linux/netfilter/xt_length.h>
15 #include <linux/netfilter/x_tables.h>
17 MODULE_AUTHOR("James Morris <jmorris@intercode.com.au>");
18 MODULE_DESCRIPTION("IP tables packet length matching module");
19 MODULE_LICENSE("GPL");
20 MODULE_ALIAS("ipt_length");
21 MODULE_ALIAS("ip6t_length");
23 static int
24 match(const struct sk_buff *skb,
25 const struct net_device *in,
26 const struct net_device *out,
27 const struct xt_match *match,
28 const void *matchinfo,
29 int offset,
30 unsigned int protoff,
31 int *hotdrop)
32 {
33 const struct xt_length_info *info = matchinfo;
34 u_int16_t pktlen = ntohs(skb->nh.iph->tot_len);
36 return (pktlen >= info->min && pktlen <= info->max) ^ info->invert;
37 }
39 static int
40 match6(const struct sk_buff *skb,
41 const struct net_device *in,
42 const struct net_device *out,
43 const struct xt_match *match,
44 const void *matchinfo,
45 int offset,
46 unsigned int protoff,
47 int *hotdrop)
48 {
49 const struct xt_length_info *info = matchinfo;
50 u_int16_t pktlen = ntohs(skb->nh.ipv6h->payload_len) + sizeof(struct ipv6hdr);
52 return (pktlen >= info->min && pktlen <= info->max) ^ info->invert;
53 }
55 static struct xt_match length_match = {
56 .name = "length",
57 .match = match,
58 .matchsize = sizeof(struct xt_length_info),
59 .family = AF_INET,
60 .me = THIS_MODULE,
61 };
63 static struct xt_match length6_match = {
64 .name = "length",
65 .match = match6,
66 .matchsize = sizeof(struct xt_length_info),
67 .family = AF_INET6,
68 .me = THIS_MODULE,
69 };
71 static int __init xt_length_init(void)
72 {
73 int ret;
74 ret = xt_register_match(&length_match);
75 if (ret)
76 return ret;
77 ret = xt_register_match(&length6_match);
78 if (ret)
79 xt_unregister_match(&length_match);
81 return ret;
82 }
84 static void __exit xt_length_fini(void)
85 {
86 xt_unregister_match(&length_match);
87 xt_unregister_match(&length6_match);
88 }
90 module_init(xt_length_init);
91 module_exit(xt_length_fini);