2 * net/sched/act_api.c Packet action API.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
9 * Author: Jamal Hadi Salim
14 #include <asm/uaccess.h>
15 #include <asm/system.h>
16 #include <linux/bitops.h>
17 #include <linux/types.h>
18 #include <linux/kernel.h>
19 #include <linux/sched.h>
20 #include <linux/string.h>
22 #include <linux/socket.h>
23 #include <linux/sockios.h>
25 #include <linux/errno.h>
26 #include <linux/interrupt.h>
27 #include <linux/netdevice.h>
28 #include <linux/skbuff.h>
29 #include <linux/rtnetlink.h>
30 #include <linux/init.h>
31 #include <linux/kmod.h>
33 #include <net/sch_generic.h>
34 #include <net/act_api.h>
36 void tcf_hash_destroy(struct tcf_common *p, struct tcf_hashinfo *hinfo)
38 unsigned int h = tcf_hash(p->tcfc_index, hinfo->hmask);
39 struct tcf_common **p1p;
41 for (p1p = &hinfo->htab[h]; *p1p; p1p = &(*p1p)->tcfc_next) {
43 write_lock_bh(hinfo->lock);
45 write_unlock_bh(hinfo->lock);
46 #ifdef CONFIG_NET_ESTIMATOR
47 gen_kill_estimator(&p->tcfc_bstats,
56 EXPORT_SYMBOL(tcf_hash_destroy);
58 int tcf_hash_release(struct tcf_common *p, int bind,
59 struct tcf_hashinfo *hinfo)
68 if (p->tcfc_bindcnt <= 0 && p->tcfc_refcnt <= 0) {
69 tcf_hash_destroy(p, hinfo);
75 EXPORT_SYMBOL(tcf_hash_release);
77 static int tcf_dump_walker(struct sk_buff *skb, struct netlink_callback *cb,
78 struct tc_action *a, struct tcf_hashinfo *hinfo)
81 int err = 0, index = -1,i = 0, s_i = 0, n_i = 0;
84 read_lock(hinfo->lock);
88 for (i = 0; i < (hinfo->hmask + 1); i++) {
89 p = hinfo->htab[tcf_hash(i, hinfo->hmask)];
91 for (; p; p = p->tcfc_next) {
97 r = (struct rtattr*) skb->tail;
98 RTA_PUT(skb, a->order, 0, NULL);
99 err = tcf_action_dump_1(skb, a, 0, 0);
102 skb_trim(skb, (u8*)r - skb->data);
105 r->rta_len = skb->tail - (u8*)r;
107 if (n_i >= TCA_ACT_MAX_PRIO)
112 read_unlock(hinfo->lock);
118 skb_trim(skb, (u8*)r - skb->data);
122 static int tcf_del_walker(struct sk_buff *skb, struct tc_action *a,
123 struct tcf_hashinfo *hinfo)
125 struct tcf_common *p, *s_p;
129 r = (struct rtattr*) skb->tail;
130 RTA_PUT(skb, a->order, 0, NULL);
131 RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind);
132 for (i = 0; i < (hinfo->hmask + 1); i++) {
133 p = hinfo->htab[tcf_hash(i, hinfo->hmask)];
137 if (ACT_P_DELETED == tcf_hash_release(p, 0, hinfo))
138 module_put(a->ops->owner);
143 RTA_PUT(skb, TCA_FCNT, 4, &n_i);
144 r->rta_len = skb->tail - (u8*)r;
148 skb_trim(skb, (u8*)r - skb->data);
152 int tcf_generic_walker(struct sk_buff *skb, struct netlink_callback *cb,
153 int type, struct tc_action *a)
155 struct tcf_hashinfo *hinfo = a->ops->hinfo;
157 if (type == RTM_DELACTION) {
158 return tcf_del_walker(skb, a, hinfo);
159 } else if (type == RTM_GETACTION) {
160 return tcf_dump_walker(skb, cb, a, hinfo);
162 printk("tcf_generic_walker: unknown action %d\n", type);
166 EXPORT_SYMBOL(tcf_generic_walker);
168 struct tcf_common *tcf_hash_lookup(u32 index, struct tcf_hashinfo *hinfo)
170 struct tcf_common *p;
172 read_lock(hinfo->lock);
173 for (p = hinfo->htab[tcf_hash(index, hinfo->hmask)]; p;
175 if (p->tcfc_index == index)
178 read_unlock(hinfo->lock);
182 EXPORT_SYMBOL(tcf_hash_lookup);
184 u32 tcf_hash_new_index(u32 *idx_gen, struct tcf_hashinfo *hinfo)
191 } while (tcf_hash_lookup(val, hinfo));
193 return (*idx_gen = val);
195 EXPORT_SYMBOL(tcf_hash_new_index);
197 int tcf_hash_search(struct tc_action *a, u32 index)
199 struct tcf_hashinfo *hinfo = a->ops->hinfo;
200 struct tcf_common *p = tcf_hash_lookup(index, hinfo);
208 EXPORT_SYMBOL(tcf_hash_search);
210 struct tcf_common *tcf_hash_check(u32 index, struct tc_action *a, int bind,
211 struct tcf_hashinfo *hinfo)
213 struct tcf_common *p = NULL;
214 if (index && (p = tcf_hash_lookup(index, hinfo)) != NULL) {
223 EXPORT_SYMBOL(tcf_hash_check);
225 struct tcf_common *tcf_hash_create(u32 index, struct rtattr *est, struct tc_action *a, int size, int bind, u32 *idx_gen, struct tcf_hashinfo *hinfo)
227 struct tcf_common *p = kzalloc(size, GFP_KERNEL);
235 spin_lock_init(&p->tcfc_lock);
236 p->tcfc_stats_lock = &p->tcfc_lock;
237 p->tcfc_index = index ? index : tcf_hash_new_index(idx_gen, hinfo);
238 p->tcfc_tm.install = jiffies;
239 p->tcfc_tm.lastuse = jiffies;
240 #ifdef CONFIG_NET_ESTIMATOR
242 gen_new_estimator(&p->tcfc_bstats, &p->tcfc_rate_est,
243 p->tcfc_stats_lock, est);
245 a->priv = (void *) p;
248 EXPORT_SYMBOL(tcf_hash_create);
250 void tcf_hash_insert(struct tcf_common *p, struct tcf_hashinfo *hinfo)
252 unsigned int h = tcf_hash(p->tcfc_index, hinfo->hmask);
254 write_lock_bh(hinfo->lock);
255 p->tcfc_next = hinfo->htab[h];
257 write_unlock_bh(hinfo->lock);
259 EXPORT_SYMBOL(tcf_hash_insert);
261 static struct tc_action_ops *act_base = NULL;
262 static DEFINE_RWLOCK(act_mod_lock);
264 int tcf_register_action(struct tc_action_ops *act)
266 struct tc_action_ops *a, **ap;
268 write_lock(&act_mod_lock);
269 for (ap = &act_base; (a = *ap) != NULL; ap = &a->next) {
270 if (act->type == a->type || (strcmp(act->kind, a->kind) == 0)) {
271 write_unlock(&act_mod_lock);
277 write_unlock(&act_mod_lock);
281 int tcf_unregister_action(struct tc_action_ops *act)
283 struct tc_action_ops *a, **ap;
286 write_lock(&act_mod_lock);
287 for (ap = &act_base; (a = *ap) != NULL; ap = &a->next)
295 write_unlock(&act_mod_lock);
300 static struct tc_action_ops *tc_lookup_action_n(char *kind)
302 struct tc_action_ops *a = NULL;
305 read_lock(&act_mod_lock);
306 for (a = act_base; a; a = a->next) {
307 if (strcmp(kind, a->kind) == 0) {
308 if (!try_module_get(a->owner)) {
309 read_unlock(&act_mod_lock);
315 read_unlock(&act_mod_lock);
320 /* lookup by rtattr */
321 static struct tc_action_ops *tc_lookup_action(struct rtattr *kind)
323 struct tc_action_ops *a = NULL;
326 read_lock(&act_mod_lock);
327 for (a = act_base; a; a = a->next) {
328 if (rtattr_strcmp(kind, a->kind) == 0) {
329 if (!try_module_get(a->owner)) {
330 read_unlock(&act_mod_lock);
336 read_unlock(&act_mod_lock);
343 static struct tc_action_ops *tc_lookup_action_id(u32 type)
345 struct tc_action_ops *a = NULL;
348 read_lock(&act_mod_lock);
349 for (a = act_base; a; a = a->next) {
350 if (a->type == type) {
351 if (!try_module_get(a->owner)) {
352 read_unlock(&act_mod_lock);
358 read_unlock(&act_mod_lock);
364 int tcf_action_exec(struct sk_buff *skb, struct tc_action *act,
365 struct tcf_result *res)
370 if (skb->tc_verd & TC_NCLS) {
371 skb->tc_verd = CLR_TC_NCLS(skb->tc_verd);
375 while ((a = act) != NULL) {
377 if (a->ops && a->ops->act) {
378 ret = a->ops->act(skb, a, res);
379 if (TC_MUNGED & skb->tc_verd) {
380 /* copied already, allow trampling */
381 skb->tc_verd = SET_TC_OK2MUNGE(skb->tc_verd);
382 skb->tc_verd = CLR_TC_MUNGED(skb->tc_verd);
384 if (ret == TC_ACT_REPEAT)
385 goto repeat; /* we need a ttl - JHS */
386 if (ret != TC_ACT_PIPE)
395 void tcf_action_destroy(struct tc_action *act, int bind)
399 for (a = act; a; a = act) {
400 if (a->ops && a->ops->cleanup) {
401 if (a->ops->cleanup(a, bind) == ACT_P_DELETED)
402 module_put(a->ops->owner);
405 } else { /*FIXME: Remove later - catch insertion bugs*/
406 printk("tcf_action_destroy: BUG? destroying NULL ops\n");
414 tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
418 if (a->ops == NULL || a->ops->dump == NULL)
420 return a->ops->dump(skb, a, bind, ref);
424 tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
427 unsigned char *b = skb->tail;
430 if (a->ops == NULL || a->ops->dump == NULL)
433 RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind);
434 if (tcf_action_copy_stats(skb, a, 0))
436 r = (struct rtattr*) skb->tail;
437 RTA_PUT(skb, TCA_OPTIONS, 0, NULL);
438 if ((err = tcf_action_dump_old(skb, a, bind, ref)) > 0) {
439 r->rta_len = skb->tail - (u8*)r;
444 skb_trim(skb, b - skb->data);
449 tcf_action_dump(struct sk_buff *skb, struct tc_action *act, int bind, int ref)
453 unsigned char *b = skb->tail;
456 while ((a = act) != NULL) {
457 r = (struct rtattr*) skb->tail;
459 RTA_PUT(skb, a->order, 0, NULL);
460 err = tcf_action_dump_1(skb, a, bind, ref);
463 r->rta_len = skb->tail - (u8*)r;
471 skb_trim(skb, b - skb->data);
475 struct tc_action *tcf_action_init_1(struct rtattr *rta, struct rtattr *est,
476 char *name, int ovr, int bind, int *err)
479 struct tc_action_ops *a_o;
480 char act_name[IFNAMSIZ];
481 struct rtattr *tb[TCA_ACT_MAX+1];
487 if (rtattr_parse_nested(tb, TCA_ACT_MAX, rta) < 0)
489 kind = tb[TCA_ACT_KIND-1];
492 if (rtattr_strlcpy(act_name, kind, IFNAMSIZ) >= IFNAMSIZ)
495 if (strlcpy(act_name, name, IFNAMSIZ) >= IFNAMSIZ)
499 a_o = tc_lookup_action_n(act_name);
503 request_module("act_%s", act_name);
506 a_o = tc_lookup_action_n(act_name);
508 /* We dropped the RTNL semaphore in order to
509 * perform the module load. So, even if we
510 * succeeded in loading the module we have to
511 * tell the caller to replay the request. We
512 * indicate this using -EAGAIN.
524 a = kzalloc(sizeof(*a), GFP_KERNEL);
528 /* backward compatibility for policer */
530 *err = a_o->init(tb[TCA_ACT_OPTIONS-1], est, a, ovr, bind);
532 *err = a_o->init(rta, est, a, ovr, bind);
536 /* module count goes up only when brand new policy is created
537 if it exists and is only bound to in a_o->init() then
538 ACT_P_CREATED is not returned (a zero is).
540 if (*err != ACT_P_CREATED)
541 module_put(a_o->owner);
550 module_put(a_o->owner);
555 struct tc_action *tcf_action_init(struct rtattr *rta, struct rtattr *est,
556 char *name, int ovr, int bind, int *err)
558 struct rtattr *tb[TCA_ACT_MAX_PRIO+1];
559 struct tc_action *head = NULL, *act, *act_prev = NULL;
562 if (rtattr_parse_nested(tb, TCA_ACT_MAX_PRIO, rta) < 0) {
567 for (i=0; i < TCA_ACT_MAX_PRIO && tb[i]; i++) {
568 act = tcf_action_init_1(tb[i], est, name, ovr, bind, err);
576 act_prev->next = act;
583 tcf_action_destroy(head, bind);
587 int tcf_action_copy_stats(struct sk_buff *skb, struct tc_action *a,
592 struct tcf_act_hdr *h = a->priv;
597 /* compat_mode being true specifies a call that is supposed
598 * to add additional backward compatiblity statistic TLVs.
601 if (a->type == TCA_OLD_COMPAT)
602 err = gnet_stats_start_copy_compat(skb, 0,
603 TCA_STATS, TCA_XSTATS, h->tcf_stats_lock, &d);
607 err = gnet_stats_start_copy(skb, TCA_ACT_STATS,
608 h->tcf_stats_lock, &d);
613 if (a->ops != NULL && a->ops->get_stats != NULL)
614 if (a->ops->get_stats(skb, a) < 0)
617 if (gnet_stats_copy_basic(&d, &h->tcf_bstats) < 0 ||
618 #ifdef CONFIG_NET_ESTIMATOR
619 gnet_stats_copy_rate_est(&d, &h->tcf_rate_est) < 0 ||
621 gnet_stats_copy_queue(&d, &h->tcf_qstats) < 0)
624 if (gnet_stats_finish_copy(&d) < 0)
634 tca_get_fill(struct sk_buff *skb, struct tc_action *a, u32 pid, u32 seq,
635 u16 flags, int event, int bind, int ref)
638 struct nlmsghdr *nlh;
639 unsigned char *b = skb->tail;
642 nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*t), flags);
645 t->tca_family = AF_UNSPEC;
649 x = (struct rtattr*) skb->tail;
650 RTA_PUT(skb, TCA_ACT_TAB, 0, NULL);
652 if (tcf_action_dump(skb, a, bind, ref) < 0)
655 x->rta_len = skb->tail - (u8*)x;
657 nlh->nlmsg_len = skb->tail - b;
662 skb_trim(skb, b - skb->data);
667 act_get_notify(u32 pid, struct nlmsghdr *n, struct tc_action *a, int event)
671 skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
674 if (tca_get_fill(skb, a, pid, n->nlmsg_seq, 0, event, 0, 0) <= 0) {
679 return rtnl_unicast(skb, pid);
682 static struct tc_action *
683 tcf_action_get_1(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int *err)
685 struct rtattr *tb[TCA_ACT_MAX+1];
690 if (rtattr_parse_nested(tb, TCA_ACT_MAX, rta) < 0)
693 if (tb[TCA_ACT_INDEX - 1] == NULL ||
694 RTA_PAYLOAD(tb[TCA_ACT_INDEX - 1]) < sizeof(index))
696 index = *(int *)RTA_DATA(tb[TCA_ACT_INDEX - 1]);
699 a = kzalloc(sizeof(struct tc_action), GFP_KERNEL);
704 a->ops = tc_lookup_action(tb[TCA_ACT_KIND - 1]);
707 if (a->ops->lookup == NULL)
710 if (a->ops->lookup(a, index) == 0)
713 module_put(a->ops->owner);
717 module_put(a->ops->owner);
723 static void cleanup_a(struct tc_action *act)
727 for (a = act; a; a = act) {
733 static struct tc_action *create_a(int i)
735 struct tc_action *act;
737 act = kzalloc(sizeof(*act), GFP_KERNEL);
739 printk("create_a: failed to alloc!\n");
746 static int tca_action_flush(struct rtattr *rta, struct nlmsghdr *n, u32 pid)
750 struct nlmsghdr *nlh;
752 struct netlink_callback dcb;
754 struct rtattr *tb[TCA_ACT_MAX+1];
756 struct tc_action *a = create_a(0);
760 printk("tca_action_flush: couldnt create tc_action\n");
764 skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
766 printk("tca_action_flush: failed skb alloc\n");
771 b = (unsigned char *)skb->tail;
773 if (rtattr_parse_nested(tb, TCA_ACT_MAX, rta) < 0)
776 kind = tb[TCA_ACT_KIND-1];
777 a->ops = tc_lookup_action(kind);
781 nlh = NLMSG_PUT(skb, pid, n->nlmsg_seq, RTM_DELACTION, sizeof(*t));
783 t->tca_family = AF_UNSPEC;
787 x = (struct rtattr *) skb->tail;
788 RTA_PUT(skb, TCA_ACT_TAB, 0, NULL);
790 err = a->ops->walk(skb, &dcb, RTM_DELACTION, a);
794 x->rta_len = skb->tail - (u8 *) x;
796 nlh->nlmsg_len = skb->tail - b;
797 nlh->nlmsg_flags |= NLM_F_ROOT;
798 module_put(a->ops->owner);
800 err = rtnetlink_send(skb, pid, RTNLGRP_TC, n->nlmsg_flags&NLM_F_ECHO);
808 module_put(a->ops->owner);
816 tca_action_gd(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int event)
819 struct rtattr *tb[TCA_ACT_MAX_PRIO+1];
820 struct tc_action *head = NULL, *act, *act_prev = NULL;
822 if (rtattr_parse_nested(tb, TCA_ACT_MAX_PRIO, rta) < 0)
825 if (event == RTM_DELACTION && n->nlmsg_flags&NLM_F_ROOT) {
826 if (tb[0] != NULL && tb[1] == NULL)
827 return tca_action_flush(tb[0], n, pid);
830 for (i=0; i < TCA_ACT_MAX_PRIO && tb[i]; i++) {
831 act = tcf_action_get_1(tb[i], n, pid, &ret);
839 act_prev->next = act;
843 if (event == RTM_GETACTION)
844 ret = act_get_notify(pid, n, head, event);
848 skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
854 if (tca_get_fill(skb, head, pid, n->nlmsg_seq, 0, event,
861 /* now do the delete */
862 tcf_action_destroy(head, 0);
863 ret = rtnetlink_send(skb, pid, RTNLGRP_TC,
864 n->nlmsg_flags&NLM_F_ECHO);
874 static int tcf_add_notify(struct tc_action *a, u32 pid, u32 seq, int event,
878 struct nlmsghdr *nlh;
884 skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
888 b = (unsigned char *)skb->tail;
890 nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*t), flags);
892 t->tca_family = AF_UNSPEC;
896 x = (struct rtattr*) skb->tail;
897 RTA_PUT(skb, TCA_ACT_TAB, 0, NULL);
899 if (tcf_action_dump(skb, a, 0, 0) < 0)
902 x->rta_len = skb->tail - (u8*)x;
904 nlh->nlmsg_len = skb->tail - b;
905 NETLINK_CB(skb).dst_group = RTNLGRP_TC;
907 err = rtnetlink_send(skb, pid, RTNLGRP_TC, flags&NLM_F_ECHO);
920 tcf_action_add(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int ovr)
923 struct tc_action *act;
925 u32 seq = n->nlmsg_seq;
927 act = tcf_action_init(rta, NULL, NULL, ovr, 0, &ret);
931 /* dump then free all the actions after update; inserted policy
934 ret = tcf_add_notify(act, pid, seq, RTM_NEWACTION, n->nlmsg_flags);
935 for (a = act; a; a = act) {
943 static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
945 struct rtattr **tca = arg;
946 u32 pid = skb ? NETLINK_CB(skb).pid : 0;
947 int ret = 0, ovr = 0;
949 if (tca[TCA_ACT_TAB-1] == NULL) {
950 printk("tc_ctl_action: received NO action attribs\n");
954 /* n->nlmsg_flags&NLM_F_CREATE
956 switch (n->nlmsg_type) {
958 /* we are going to assume all other flags
959 * imply create only if it doesnt exist
960 * Note that CREATE | EXCL implies that
961 * but since we want avoid ambiguity (eg when flags
962 * is zero) then just set this
964 if (n->nlmsg_flags&NLM_F_REPLACE)
967 ret = tcf_action_add(tca[TCA_ACT_TAB-1], n, pid, ovr);
972 ret = tca_action_gd(tca[TCA_ACT_TAB-1], n, pid, RTM_DELACTION);
975 ret = tca_action_gd(tca[TCA_ACT_TAB-1], n, pid, RTM_GETACTION);
984 static struct rtattr *
985 find_dump_kind(struct nlmsghdr *n)
987 struct rtattr *tb1, *tb2[TCA_ACT_MAX+1];
988 struct rtattr *tb[TCA_ACT_MAX_PRIO + 1];
989 struct rtattr *rta[TCAA_MAX + 1];
991 int min_len = NLMSG_LENGTH(sizeof(struct tcamsg));
992 int attrlen = n->nlmsg_len - NLMSG_ALIGN(min_len);
993 struct rtattr *attr = (void *) n + NLMSG_ALIGN(min_len);
995 if (rtattr_parse(rta, TCAA_MAX, attr, attrlen) < 0)
997 tb1 = rta[TCA_ACT_TAB - 1];
1001 if (rtattr_parse(tb, TCA_ACT_MAX_PRIO, RTA_DATA(tb1),
1002 NLMSG_ALIGN(RTA_PAYLOAD(tb1))) < 0)
1007 if (rtattr_parse(tb2, TCA_ACT_MAX, RTA_DATA(tb[0]),
1008 RTA_PAYLOAD(tb[0])) < 0)
1010 kind = tb2[TCA_ACT_KIND-1];
1016 tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
1018 struct nlmsghdr *nlh;
1019 unsigned char *b = skb->tail;
1021 struct tc_action_ops *a_o;
1024 struct tcamsg *t = (struct tcamsg *) NLMSG_DATA(cb->nlh);
1025 struct rtattr *kind = find_dump_kind(cb->nlh);
1028 printk("tc_dump_action: action bad kind\n");
1032 a_o = tc_lookup_action(kind);
1037 memset(&a, 0, sizeof(struct tc_action));
1040 if (a_o->walk == NULL) {
1041 printk("tc_dump_action: %s !capable of dumping table\n", a_o->kind);
1042 goto rtattr_failure;
1045 nlh = NLMSG_PUT(skb, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq,
1046 cb->nlh->nlmsg_type, sizeof(*t));
1047 t = NLMSG_DATA(nlh);
1048 t->tca_family = AF_UNSPEC;
1052 x = (struct rtattr *) skb->tail;
1053 RTA_PUT(skb, TCA_ACT_TAB, 0, NULL);
1055 ret = a_o->walk(skb, cb, RTM_GETACTION, &a);
1057 goto rtattr_failure;
1060 x->rta_len = skb->tail - (u8 *) x;
1063 skb_trim(skb, (u8*)x - skb->data);
1065 nlh->nlmsg_len = skb->tail - b;
1066 if (NETLINK_CB(cb->skb).pid && ret)
1067 nlh->nlmsg_flags |= NLM_F_MULTI;
1068 module_put(a_o->owner);
1073 module_put(a_o->owner);
1074 skb_trim(skb, b - skb->data);
1078 static int __init tc_action_init(void)
1080 struct rtnetlink_link *link_p = rtnetlink_links[PF_UNSPEC];
1083 link_p[RTM_NEWACTION-RTM_BASE].doit = tc_ctl_action;
1084 link_p[RTM_DELACTION-RTM_BASE].doit = tc_ctl_action;
1085 link_p[RTM_GETACTION-RTM_BASE].doit = tc_ctl_action;
1086 link_p[RTM_GETACTION-RTM_BASE].dumpit = tc_dump_action;
1092 subsys_initcall(tc_action_init);
1094 EXPORT_SYMBOL(tcf_register_action);
1095 EXPORT_SYMBOL(tcf_unregister_action);
1096 EXPORT_SYMBOL(tcf_action_exec);
1097 EXPORT_SYMBOL(tcf_action_dump_1);