Signed-off-by: Felix Fietkau <nbd@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@37493 3c298f89-4303-0410-b956-a3cf2f4a3e73master
parent
4a3f7e845d
commit
0fee8272de
|
@ -1,6 +1,6 @@
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/net/sched/act_connmark.c
|
+++ b/net/sched/act_connmark.c
|
||||||
@@ -0,0 +1,137 @@
|
@@ -0,0 +1,148 @@
|
||||||
+/*
|
+/*
|
||||||
+ * Copyright (c) 2011 Felix Fietkau <nbd@openwrt.org>
|
+ * Copyright (c) 2011 Felix Fietkau <nbd@openwrt.org>
|
||||||
+ *
|
+ *
|
||||||
|
@ -81,19 +81,30 @@
|
||||||
+ return TC_ACT_PIPE;
|
+ return TC_ACT_PIPE;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static int tcf_connmark_init(struct nlattr *nla, struct nlattr *est,
|
+static int tcf_connmark_init(struct net *net, struct nlattr *nla,
|
||||||
+ struct tc_action *a, int ovr, int bind)
|
+ struct nlattr *est, struct tc_action *a,
|
||||||
|
+ int ovr, int bind)
|
||||||
+{
|
+{
|
||||||
+ struct tcf_common *pc;
|
+ struct tcf_common *pc;
|
||||||
|
+ int ret = 0;
|
||||||
+
|
+
|
||||||
+ pc = tcf_hash_create(0, est, a, sizeof(*pc), bind,
|
+ pc = tcf_hash_check(0, a, bind, &connmark_hash_info);
|
||||||
+ &connmark_idx_gen, &connmark_hash_info);
|
+ if (!pc) {
|
||||||
+ if (IS_ERR(pc))
|
+ pc = tcf_hash_create(0, est, a, sizeof(*pc), bind,
|
||||||
+ return PTR_ERR(pc);
|
+ &connmark_idx_gen, &connmark_hash_info);
|
||||||
|
+ if (IS_ERR(pc))
|
||||||
|
+ return PTR_ERR(pc);
|
||||||
+
|
+
|
||||||
+ tcf_hash_insert(pc, &connmark_hash_info);
|
+ tcf_hash_insert(pc, &connmark_hash_info);
|
||||||
|
+ ret = ACT_P_CREATED;
|
||||||
|
+ } else {
|
||||||
|
+ if (!ovr) {
|
||||||
|
+ tcf_hash_release(pc, bind, &connmark_hash_info);
|
||||||
|
+ return -EEXIST;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
+
|
+
|
||||||
+ return ACT_P_CREATED;
|
+ return ret;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static inline int tcf_connmark_cleanup(struct tc_action *a, int bind)
|
+static inline int tcf_connmark_cleanup(struct tc_action *a, int bind)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/net/sched/act_connmark.c
|
+++ b/net/sched/act_connmark.c
|
||||||
@@ -0,0 +1,137 @@
|
@@ -0,0 +1,148 @@
|
||||||
+/*
|
+/*
|
||||||
+ * Copyright (c) 2011 Felix Fietkau <nbd@openwrt.org>
|
+ * Copyright (c) 2011 Felix Fietkau <nbd@openwrt.org>
|
||||||
+ *
|
+ *
|
||||||
|
@ -81,19 +81,30 @@
|
||||||
+ return TC_ACT_PIPE;
|
+ return TC_ACT_PIPE;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static int tcf_connmark_init(struct nlattr *nla, struct nlattr *est,
|
+static int tcf_connmark_init(struct net *net, struct nlattr *nla,
|
||||||
+ struct tc_action *a, int ovr, int bind)
|
+ struct nlattr *est, struct tc_action *a,
|
||||||
|
+ int ovr, int bind)
|
||||||
+{
|
+{
|
||||||
+ struct tcf_common *pc;
|
+ struct tcf_common *pc;
|
||||||
|
+ int ret = 0;
|
||||||
+
|
+
|
||||||
+ pc = tcf_hash_create(0, est, a, sizeof(*pc), bind,
|
+ pc = tcf_hash_check(0, a, bind, &connmark_hash_info);
|
||||||
+ &connmark_idx_gen, &connmark_hash_info);
|
+ if (!pc) {
|
||||||
+ if (IS_ERR(pc))
|
+ pc = tcf_hash_create(0, est, a, sizeof(*pc), bind,
|
||||||
+ return PTR_ERR(pc);
|
+ &connmark_idx_gen, &connmark_hash_info);
|
||||||
|
+ if (IS_ERR(pc))
|
||||||
|
+ return PTR_ERR(pc);
|
||||||
+
|
+
|
||||||
+ tcf_hash_insert(pc, &connmark_hash_info);
|
+ tcf_hash_insert(pc, &connmark_hash_info);
|
||||||
|
+ ret = ACT_P_CREATED;
|
||||||
|
+ } else {
|
||||||
|
+ if (!ovr) {
|
||||||
|
+ tcf_hash_release(pc, bind, &connmark_hash_info);
|
||||||
|
+ return -EEXIST;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
+
|
+
|
||||||
+ return ACT_P_CREATED;
|
+ return ret;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static inline int tcf_connmark_cleanup(struct tc_action *a, int bind)
|
+static inline int tcf_connmark_cleanup(struct tc_action *a, int bind)
|
||||||
|
|
Loading…
Reference in New Issue