1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
/*
* net/sched/cls_route.c Routing table based packet classifier.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
*/
#include <linux/module.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/bitops.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/socket.h>
#include <linux/sockios.h>
#include <linux/in.h>
#include <linux/errno.h>
#include <linux/interrupt.h>
#include <linux/if_ether.h>
#include <linux/inet.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/notifier.h>
#include <net/ip.h>
#include <net/route.h>
#include <linux/skbuff.h>
#include <net/sock.h>
#include <net/pkt_sched.h>
static int route_classify(struct sk_buff *skb, struct tcf_proto *tp,
struct tcf_result *res)
{
struct dst_entry *dst = skb->dst;
if (dst) {
u32 clid = dst->tclassid;
if (clid && (TC_H_MAJ(clid) == 0 ||
!(TC_H_MAJ(clid^tp->q->handle)))) {
res->classid = clid;
res->class = 0;
return 0;
}
}
return -1;
}
static unsigned long route_get(struct tcf_proto *tp, u32 handle)
{
return 0;
}
static void route_put(struct tcf_proto *tp, unsigned long f)
{
}
static int route_init(struct tcf_proto *tp)
{
return 0;
}
static void route_destroy(struct tcf_proto *tp)
{
}
static int route_delete(struct tcf_proto *tp, unsigned long arg)
{
return -EINVAL;
}
static int route_change(struct tcf_proto *tp, u32 handle,
struct rtattr **tca,
unsigned long *arg)
{
return handle ? -EINVAL : 0;
}
struct tcf_proto_ops cls_route_ops = {
NULL,
"route",
route_classify,
route_init,
route_destroy,
route_get,
route_put,
route_change,
route_delete,
NULL,
};
|