1 /* Hop Limit matching module */
3 /* (C) 2001-2002 Maciej Soltysiak <solt@dns.toxicfilms.tv>
4 * Based on HW's ttl module
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 #include <linux/module.h>
12 #include <linux/skbuff.h>
14 #include <linux/netfilter_ipv6/ip6t_hl.h>
15 #include <linux/netfilter_ipv6/ip6_tables.h>
17 MODULE_AUTHOR("Maciej Soltysiak <solt@dns.toxicfilms.tv>");
18 MODULE_DESCRIPTION("IP tables Hop Limit matching module");
19 MODULE_LICENSE("GPL");
21 static int match(const struct sk_buff
*skb
,
22 const struct net_device
*in
, const struct net_device
*out
,
23 const struct xt_match
*match
, const void *matchinfo
,
24 int offset
, unsigned int protoff
, int *hotdrop
)
26 const struct ip6t_hl_info
*info
= matchinfo
;
27 const struct ipv6hdr
*ip6h
= skb
->nh
.ipv6h
;
31 return (ip6h
->hop_limit
== info
->hop_limit
);
34 return (!(ip6h
->hop_limit
== info
->hop_limit
));
37 return (ip6h
->hop_limit
< info
->hop_limit
);
40 return (ip6h
->hop_limit
> info
->hop_limit
);
43 printk(KERN_WARNING
"ip6t_hl: unknown mode %d\n",
51 static struct ip6t_match hl_match
= {
54 .matchsize
= sizeof(struct ip6t_hl_info
),
58 static int __init
ip6t_hl_init(void)
60 return ip6t_register_match(&hl_match
);
63 static void __exit
ip6t_hl_fini(void)
65 ip6t_unregister_match(&hl_match
);
69 module_init(ip6t_hl_init
);
70 module_exit(ip6t_hl_fini
);
This page took 0.033599 seconds and 5 git commands to generate.