@@ -32,7 +32,7 @@ static void explain(void)
"NOTE: CLASSID is parsed as hexadecimal input.\n");
}
-static int basic_parse_opt(struct filter_util *qu, char *handle,
+static int basic_parse_opt(const struct filter_util *qu, char *handle,
int argc, char **argv, struct nlmsghdr *n)
{
struct tcmsg *t = NLMSG_DATA(n);
@@ -103,7 +103,7 @@ static int basic_parse_opt(struct filter_util *qu, char *handle,
return 0;
}
-static int basic_print_opt(struct filter_util *qu, FILE *f,
+static int basic_print_opt(const struct filter_util *qu, FILE *f,
struct rtattr *opt, __u32 handle)
{
struct rtattr *tb[TCA_BASIC_MAX+1];
@@ -71,7 +71,7 @@ static const struct bpf_cfg_ops bpf_cb_ops = {
.ebpf_cb = bpf_ebpf_cb,
};
-static int bpf_parse_opt(struct filter_util *qu, char *handle,
+static int bpf_parse_opt(const struct filter_util *qu, char *handle,
int argc, char **argv, struct nlmsghdr *n)
{
const char *bpf_obj = NULL, *bpf_uds_name = NULL;
@@ -187,7 +187,7 @@ opt_bpf:
return ret;
}
-static int bpf_print_opt(struct filter_util *qu, FILE *f,
+static int bpf_print_opt(const struct filter_util *qu, FILE *f,
struct rtattr *opt, __u32 handle)
{
struct rtattr *tb[TCA_BPF_MAX + 1];
@@ -17,7 +17,7 @@ static void explain(void)
fprintf(stderr, " [ action ACTION_SPEC ]\n");
}
-static int cgroup_parse_opt(struct filter_util *qu, char *handle,
+static int cgroup_parse_opt(const struct filter_util *qu, char *handle,
int argc, char **argv, struct nlmsghdr *n)
{
struct tcmsg *t = NLMSG_DATA(n);
@@ -75,7 +75,7 @@ static int cgroup_parse_opt(struct filter_util *qu, char *handle,
return 0;
}
-static int cgroup_print_opt(struct filter_util *qu, FILE *f,
+static int cgroup_print_opt(const struct filter_util *qu, FILE *f,
struct rtattr *opt, __u32 handle)
{
struct rtattr *tb[TCA_CGROUP_MAX+1];
@@ -126,7 +126,7 @@ out:
return 0;
}
-static int flow_parse_opt(struct filter_util *fu, char *handle,
+static int flow_parse_opt(const struct filter_util *fu, char *handle,
int argc, char **argv, struct nlmsghdr *n)
{
struct tcmsg *t = NLMSG_DATA(n);
@@ -273,7 +273,7 @@ static const char *flow_mode2str(__u32 mode)
}
}
-static int flow_print_opt(struct filter_util *fu, FILE *f, struct rtattr *opt,
+static int flow_print_opt(const struct filter_util *fu, FILE *f, struct rtattr *opt,
__u32 handle)
{
struct rtattr *tb[TCA_FLOW_MAX+1];
@@ -1535,7 +1535,7 @@ static int flower_parse_cfm(int *argc_p, char ***argv_p, __be16 eth_type,
return 0;
}
-static int flower_parse_opt(struct filter_util *qu, char *handle,
+static int flower_parse_opt(const struct filter_util *qu, char *handle,
int argc, char **argv, struct nlmsghdr *n)
{
int ret;
@@ -2882,7 +2882,7 @@ static void flower_print_cfm(struct rtattr *attr)
close_json_object();
}
-static int flower_print_opt(struct filter_util *qu, FILE *f,
+static int flower_print_opt(const struct filter_util *qu, FILE *f,
struct rtattr *opt, __u32 handle)
{
struct rtattr *tb[TCA_FLOWER_MAX + 1];
@@ -29,7 +29,7 @@ static void explain(void)
" FWMASK is 0xffffffff by default.\n");
}
-static int fw_parse_opt(struct filter_util *qu, char *handle, int argc, char **argv, struct nlmsghdr *n)
+static int fw_parse_opt(const struct filter_util *qu, char *handle, int argc, char **argv, struct nlmsghdr *n)
{
struct tcmsg *t = NLMSG_DATA(n);
struct rtattr *tail;
@@ -112,7 +112,7 @@ static int fw_parse_opt(struct filter_util *qu, char *handle, int argc, char **a
return 0;
}
-static int fw_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt, __u32 handle)
+static int fw_print_opt(const struct filter_util *qu, FILE *f, struct rtattr *opt, __u32 handle)
{
struct rtattr *tb[TCA_FW_MAX+1];
@@ -31,7 +31,7 @@ static void explain(void)
"NOTE: CLASSID is parsed as hexadecimal input.\n");
}
-static int matchall_parse_opt(struct filter_util *qu, char *handle,
+static int matchall_parse_opt(const struct filter_util *qu, char *handle,
int argc, char **argv, struct nlmsghdr *n)
{
struct tcmsg *t = NLMSG_DATA(n);
@@ -107,7 +107,7 @@ static int matchall_parse_opt(struct filter_util *qu, char *handle,
return 0;
}
-static int matchall_print_opt(struct filter_util *qu, FILE *f,
+static int matchall_print_opt(const struct filter_util *qu, FILE *f,
struct rtattr *opt, __u32 handle)
{
struct rtattr *tb[TCA_MATCHALL_MAX+1];
@@ -30,7 +30,7 @@ static void explain(void)
"NOTE: CLASSID is parsed as hexadecimal input.\n");
}
-static int route_parse_opt(struct filter_util *qu, char *handle, int argc, char **argv, struct nlmsghdr *n)
+static int route_parse_opt(const struct filter_util *qu, char *handle, int argc, char **argv, struct nlmsghdr *n)
{
struct tcmsg *t = NLMSG_DATA(n);
struct rtattr *tail;
@@ -134,7 +134,7 @@ static int route_parse_opt(struct filter_util *qu, char *handle, int argc, char
return 0;
}
-static int route_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt, __u32 handle)
+static int route_print_opt(const struct filter_util *qu, FILE *f, struct rtattr *opt, __u32 handle)
{
struct rtattr *tb[TCA_ROUTE4_MAX+1];
@@ -1018,7 +1018,7 @@ static __u32 u32_hash_fold(struct tc_u32_key *key)
return ntohl(key->val & key->mask) >> fshift;
}
-static int u32_parse_opt(struct filter_util *qu, char *handle,
+static int u32_parse_opt(const struct filter_util *qu, char *handle,
int argc, char **argv, struct nlmsghdr *n)
{
struct {
@@ -1232,7 +1232,7 @@ static int u32_parse_opt(struct filter_util *qu, char *handle,
return 0;
}
-static int u32_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt,
+static int u32_print_opt(const struct filter_util *qu, FILE *f, struct rtattr *opt,
__u32 handle)
{
struct rtattr *tb[TCA_U32_MAX + 1];
@@ -69,7 +69,7 @@ static int parse_noqopt(const struct qdisc_util *qu, int argc, char **argv,
return 0;
}
-static int print_nofopt(struct filter_util *qu, FILE *f, struct rtattr *opt, __u32 fhandle)
+static int print_nofopt(const struct filter_util *qu, FILE *f, struct rtattr *opt, __u32 fhandle)
{
if (opt && RTA_PAYLOAD(opt))
fprintf(f, "fh %08x [Unknown filter, optlen=%u] ",
@@ -79,7 +79,7 @@ static int print_nofopt(struct filter_util *qu, FILE *f, struct rtattr *opt, __u
return 0;
}
-static int parse_nofopt(struct filter_util *qu, char *fhandle,
+static int parse_nofopt(const struct filter_util *qu, char *fhandle,
int argc, char **argv, struct nlmsghdr *n)
{
__u32 handle;
@@ -146,7 +146,7 @@ noexist:
}
-struct filter_util *get_filter_kind(const char *str)
+const struct filter_util *get_filter_kind(const char *str)
{
void *dlh;
char buf[256];
@@ -65,7 +65,7 @@ static int tc_filter_modify(int cmd, unsigned int flags, int argc, char **argv)
.n.nlmsg_type = cmd,
.t.tcm_family = AF_UNSPEC,
};
- struct filter_util *q = NULL;
+ const struct filter_util *q = NULL;
__u32 prio = 0;
__u32 protocol = 0;
int protocol_set = 0;
@@ -250,7 +250,7 @@ int print_filter(struct nlmsghdr *n, void *arg)
struct tcmsg *t = NLMSG_DATA(n);
int len = n->nlmsg_len;
struct rtattr *tb[TCA_MAX+1];
- struct filter_util *q;
+ const struct filter_util *q;
char abuf[256];
if (n->nlmsg_type != RTM_NEWTFILTER &&
@@ -398,7 +398,7 @@ static int tc_filter_get(int cmd, unsigned int flags, int argc, char **argv)
.t.tcm_family = AF_UNSPEC,
};
struct nlmsghdr *answer;
- struct filter_util *q = NULL;
+ const struct filter_util *q = NULL;
__u32 prio = 0;
__u32 protocol = 0;
int protocol_set = 0;
@@ -49,9 +49,9 @@ extern __u16 f_proto;
struct filter_util {
struct filter_util *next;
char id[FILTER_NAMESZ];
- int (*parse_fopt)(struct filter_util *qu, char *fhandle,
+ int (*parse_fopt)(const struct filter_util *qu, char *fhandle,
int argc, char **argv, struct nlmsghdr *n);
- int (*print_fopt)(struct filter_util *qu,
+ int (*print_fopt)(const struct filter_util *qu,
FILE *f, struct rtattr *opt, __u32 fhandle);
};
@@ -74,7 +74,7 @@ struct exec_util {
const char *get_tc_lib(void);
const struct qdisc_util *get_qdisc_kind(const char *str);
-struct filter_util *get_filter_kind(const char *str);
+const struct filter_util *get_filter_kind(const char *str);
int get_qdisc_handle(__u32 *h, const char *str);
int get_percent_rate(unsigned int *rate, const char *str, const char *dev);
The callbacks in filter_util should not be modifying underlying qdisc operations structure. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- tc/f_basic.c | 4 ++-- tc/f_bpf.c | 4 ++-- tc/f_cgroup.c | 4 ++-- tc/f_flow.c | 4 ++-- tc/f_flower.c | 4 ++-- tc/f_fw.c | 4 ++-- tc/f_matchall.c | 4 ++-- tc/f_route.c | 4 ++-- tc/f_u32.c | 4 ++-- tc/tc.c | 6 +++--- tc/tc_filter.c | 6 +++--- tc/tc_util.h | 6 +++--- 12 files changed, 27 insertions(+), 27 deletions(-)