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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
#include <linux/module.h>
2
#include <linux/skbuff.h>
3
#include <linux/if_ether.h>
4
#include <linux/if_packet.h>
5
 
6
#include <linux/netfilter_ipv4/ipt_pkttype.h>
7
#include <linux/netfilter_ipv4/ip_tables.h>
8
 
9
MODULE_LICENSE("GPL");
10
 
11
static int match(const struct sk_buff *skb,
12
      const struct net_device *in,
13
      const struct net_device *out,
14
      const void *matchinfo,
15
      int offset,
16
      const void *hdr,
17
      u_int16_t datalen,
18
      int *hotdrop)
19
{
20
    const struct ipt_pkttype_info *info = matchinfo;
21
 
22
    return (skb->pkt_type == info->pkttype) ^ info->invert;
23
}
24
 
25
static int checkentry(const char *tablename,
26
                   const struct ipt_ip *ip,
27
                   void *matchinfo,
28
                   unsigned int matchsize,
29
                   unsigned int hook_mask)
30
{
31
/*
32
        if (hook_mask
33
            & ~((1 << NF_IP_PRE_ROUTING) | (1 << NF_IP_LOCAL_IN)
34
                | (1 << NF_IP_FORWARD))) {
35
                printk("ipt_pkttype: only valid for PRE_ROUTING, LOCAL_IN or FORWARD.\n");
36
                return 0;
37
        }
38
*/
39
        if (matchsize != IPT_ALIGN(sizeof(struct ipt_pkttype_info)))
40
                return 0;
41
 
42
        return 1;
43
}
44
 
45
static struct ipt_match pkttype_match
46
= { { NULL, NULL }, "pkttype", &match, &checkentry, NULL, THIS_MODULE };
47
 
48
static int __init init(void)
49
{
50
        return ipt_register_match(&pkttype_match);
51
}
52
 
53
static void __exit fini(void)
54
{
55
        ipt_unregister_match(&pkttype_match);
56
}
57
 
58
module_init(init);
59
module_exit(fini);

powered by: WebSVN 2.1.0

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