OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [net/] [ipv4/] [netfilter/] [ipt_tos.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/* Kernel module to match TOS values. */
2
#include <linux/module.h>
3
#include <linux/skbuff.h>
4
 
5
#include <linux/netfilter_ipv4/ipt_tos.h>
6
#include <linux/netfilter_ipv4/ip_tables.h>
7
 
8
static int
9
match(const struct sk_buff *skb,
10
      const struct net_device *in,
11
      const struct net_device *out,
12
      const void *matchinfo,
13
      int offset,
14
      const void *hdr,
15
      u_int16_t datalen,
16
      int *hotdrop)
17
{
18
        const struct ipt_tos_info *info = matchinfo;
19
        const struct iphdr *iph = skb->nh.iph;
20
 
21
        return (iph->tos == info->tos) ^ info->invert;
22
}
23
 
24
static int
25
checkentry(const char *tablename,
26
           const struct ipt_ip *ip,
27
           void *matchinfo,
28
           unsigned int matchsize,
29
           unsigned int hook_mask)
30
{
31
        if (matchsize != IPT_ALIGN(sizeof(struct ipt_tos_info)))
32
                return 0;
33
 
34
        return 1;
35
}
36
 
37
static struct ipt_match tos_match
38
= { { NULL, NULL }, "tos", &match, &checkentry, NULL, THIS_MODULE };
39
 
40
static int __init init(void)
41
{
42
        return ipt_register_match(&tos_match);
43
}
44
 
45
static void __exit fini(void)
46
{
47
        ipt_unregister_match(&tos_match);
48
}
49
 
50
module_init(init);
51
module_exit(fini);
52
MODULE_LICENSE("GPL");

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.