]>
git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - net/ipv6/netfilter/ip6t_hl.c
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/ipv6.h>
12 #include <linux/module.h>
13 #include <linux/skbuff.h>
15 #include <linux/netfilter_ipv6/ip6t_hl.h>
16 #include <linux/netfilter/x_tables.h>
18 MODULE_AUTHOR("Maciej Soltysiak <solt@dns.toxicfilms.tv>");
19 MODULE_DESCRIPTION("IP tables Hop Limit matching module");
20 MODULE_LICENSE("GPL");
22 static int match(const struct sk_buff
*skb
,
23 const struct net_device
*in
, const struct net_device
*out
,
24 const struct xt_match
*match
, const void *matchinfo
,
25 int offset
, unsigned int protoff
, int *hotdrop
)
27 const struct ip6t_hl_info
*info
= matchinfo
;
28 const struct ipv6hdr
*ip6h
= skb
->nh
.ipv6h
;
32 return (ip6h
->hop_limit
== info
->hop_limit
);
35 return (!(ip6h
->hop_limit
== info
->hop_limit
));
38 return (ip6h
->hop_limit
< info
->hop_limit
);
41 return (ip6h
->hop_limit
> info
->hop_limit
);
44 printk(KERN_WARNING
"ip6t_hl: unknown mode %d\n",
52 static struct xt_match hl_match
= {
56 .matchsize
= sizeof(struct ip6t_hl_info
),
60 static int __init
ip6t_hl_init(void)
62 return xt_register_match(&hl_match
);
65 static void __exit
ip6t_hl_fini(void)
67 xt_unregister_match(&hl_match
);
70 module_init(ip6t_hl_init
);
71 module_exit(ip6t_hl_fini
);