@@ -59,7 +59,7 @@ static void act_usage(void)
exit(-1);
}
-static int print_noaopt(struct action_util *au, FILE *f, struct rtattr *opt)
+static int print_noaopt(const struct action_util *au, FILE *f, struct rtattr *opt)
{
if (opt && RTA_PAYLOAD(opt))
fprintf(stderr, "[Unknown action, optlen=%u] ",
@@ -67,7 +67,7 @@ static int print_noaopt(struct action_util *au, FILE *f, struct rtattr *opt)
return 0;
}
-static int parse_noaopt(struct action_util *au, int *argc_p,
+static int parse_noaopt(const struct action_util *au, int *argc_p,
char ***argv_p, int code, struct nlmsghdr *n)
{
int argc = *argc_p;
@@ -69,7 +69,7 @@ static const struct bpf_cfg_ops bpf_cb_ops = {
.ebpf_cb = bpf_ebpf_cb,
};
-static int bpf_parse_opt(struct action_util *a, int *ptr_argc, char ***ptr_argv,
+static int bpf_parse_opt(const struct action_util *a, int *ptr_argc, char ***ptr_argv,
int tca_id, struct nlmsghdr *n)
{
const char *bpf_obj = NULL, *bpf_uds_name = NULL;
@@ -151,7 +151,7 @@ opt_bpf:
return ret;
}
-static int bpf_print_opt(struct action_util *au, FILE *f, struct rtattr *arg)
+static int bpf_print_opt(const struct action_util *au, FILE *f, struct rtattr *arg)
{
struct rtattr *tb[TCA_ACT_BPF_MAX + 1];
struct tc_act_bpf *parm;
@@ -32,7 +32,7 @@ usage(void)
}
static int
-parse_connmark(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
+parse_connmark(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
struct nlmsghdr *n)
{
struct tc_connmark sel = {};
@@ -94,7 +94,7 @@ parse_connmark(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
return 0;
}
-static int print_connmark(struct action_util *au, FILE *f, struct rtattr *arg)
+static int print_connmark(const struct action_util *au, FILE *f, struct rtattr *arg)
{
struct rtattr *tb[TCA_CONNMARK_MAX + 1];
struct tc_connmark *ci;
@@ -81,7 +81,7 @@ parse_csum_args(int *argc_p, char ***argv_p, struct tc_csum *sel)
}
static int
-parse_csum(struct action_util *a, int *argc_p,
+parse_csum(const struct action_util *a, int *argc_p,
char ***argv_p, int tca_id, struct nlmsghdr *n)
{
struct tc_csum sel = {};
@@ -148,7 +148,7 @@ skip_args:
}
static int
-print_csum(struct action_util *au, FILE *f, struct rtattr *arg)
+print_csum(const struct action_util *au, FILE *f, struct rtattr *arg)
{
struct tc_csum *sel;
@@ -225,7 +225,7 @@ static int ct_parse_labels(char *str, struct nlmsghdr *n)
}
static int
-parse_ct(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
+parse_ct(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
struct nlmsghdr *n)
{
struct tc_ct sel = {};
@@ -488,7 +488,7 @@ static void ct_print_helper(struct rtattr *family, struct rtattr *proto, struct
print_string(PRINT_ANY, "helper", " helper %s", helper);
}
-static int print_ct(struct action_util *au, FILE *f, struct rtattr *arg)
+static int print_ct(const struct action_util *au, FILE *f, struct rtattr *arg)
{
struct rtattr *tb[TCA_CT_MAX + 1];
const char *commit;
@@ -35,7 +35,7 @@ usage(void)
}
static int
-parse_ctinfo(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
+parse_ctinfo(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
struct nlmsghdr *n)
{
unsigned int cpmarkmask = 0, dscpmask = 0, dscpstatemask = 0;
@@ -181,7 +181,7 @@ static void print_ctinfo_stats(FILE *f, struct rtattr *tb[TCA_CTINFO_MAX + 1])
rta_getattr_u64(tb[TCA_CTINFO_STATS_CPMARK_SET]));
}
-static int print_ctinfo(struct action_util *au, FILE *f, struct rtattr *arg)
+static int print_ctinfo(const struct action_util *au, FILE *f, struct rtattr *arg)
{
unsigned int cpmarkmask = ~0, dscpmask = 0, dscpstatemask = 0;
struct rtattr *tb[TCA_CTINFO_MAX + 1];
@@ -66,7 +66,7 @@ usage(void)
}
static int
-parse_gact(struct action_util *a, int *argc_p, char ***argv_p,
+parse_gact(const struct action_util *a, int *argc_p, char ***argv_p,
int tca_id, struct nlmsghdr *n)
{
int argc = *argc_p;
@@ -157,7 +157,7 @@ skip_args:
}
static int
-print_gact(struct action_util *au, FILE *f, struct rtattr *arg)
+print_gact(const struct action_util *au, FILE *f, struct rtattr *arg)
{
#ifdef CONFIG_GACT_PROB
struct tc_gact_p *pp = NULL;
@@ -56,9 +56,9 @@ static void explain_entry_format(void)
fprintf(stderr, "Usage: sched-entry <open | close> <interval> [ <interval ipv> <octets max bytes> ]\n");
}
-static int parse_gate(struct action_util *a, int *argc_p, char ***argv_p,
+static int parse_gate(const struct action_util *a, int *argc_p, char ***argv_p,
int tca_id, struct nlmsghdr *n);
-static int print_gate(struct action_util *au, FILE *f, struct rtattr *arg);
+static int print_gate(const struct action_util *au, FILE *f, struct rtattr *arg);
struct action_util gate_action_util = {
.id = "gate",
@@ -135,7 +135,7 @@ static void free_entries(struct list_head *gate_entries)
}
}
-static int parse_gate(struct action_util *a, int *argc_p, char ***argv_p,
+static int parse_gate(const struct action_util *a, int *argc_p, char ***argv_p,
int tca_id, struct nlmsghdr *n)
{
struct tc_gate parm = {.action = TC_ACT_PIPE};
@@ -441,7 +441,7 @@ static int print_gate_list(struct rtattr *list)
return 0;
}
-static int print_gate(struct action_util *au, FILE *f, struct rtattr *arg)
+static int print_gate(const struct action_util *au, FILE *f, struct rtattr *arg)
{
struct tc_gate *parm;
struct rtattr *tb[TCA_GATE_MAX + 1];
@@ -44,7 +44,7 @@ static void ife_usage(void)
exit(-1);
}
-static int parse_ife(struct action_util *a, int *argc_p, char ***argv_p,
+static int parse_ife(const struct action_util *a, int *argc_p, char ***argv_p,
int tca_id, struct nlmsghdr *n)
{
int argc = *argc_p;
@@ -211,7 +211,7 @@ skip_encode:
return 0;
}
-static int print_ife(struct action_util *au, FILE *f, struct rtattr *arg)
+static int print_ife(const struct action_util *au, FILE *f, struct rtattr *arg)
{
struct tc_ife *p;
struct rtattr *tb[TCA_IFE_MAX + 1];
@@ -88,7 +88,7 @@ static const char *mirred_action(int action)
}
static int
-parse_direction(struct action_util *a, int *argc_p, char ***argv_p,
+parse_direction(const struct action_util *a, int *argc_p, char ***argv_p,
int tca_id, struct nlmsghdr *n)
{
@@ -258,7 +258,7 @@ parse_direction(struct action_util *a, int *argc_p, char ***argv_p,
static int
-parse_mirred(struct action_util *a, int *argc_p, char ***argv_p,
+parse_mirred(const struct action_util *a, int *argc_p, char ***argv_p,
int tca_id, struct nlmsghdr *n)
{
@@ -299,7 +299,7 @@ parse_mirred(struct action_util *a, int *argc_p, char ***argv_p,
}
static int
-print_mirred(struct action_util *au, FILE *f, struct rtattr *arg)
+print_mirred(const struct action_util *au, FILE *f, struct rtattr *arg)
{
struct tc_mirred *p;
struct rtattr *tb[TCA_MIRRED_MAX + 1];
@@ -72,7 +72,7 @@ static bool check_double_action(unsigned int action, const char *arg)
return true;
}
-static int parse_mpls(struct action_util *a, int *argc_p, char ***argv_p,
+static int parse_mpls(const struct action_util *a, int *argc_p, char ***argv_p,
int tca_id, struct nlmsghdr *n)
{
struct tc_mpls parm = {};
@@ -211,7 +211,7 @@ skip_args:
return 0;
}
-static int print_mpls(struct action_util *au, FILE *f, struct rtattr *arg)
+static int print_mpls(const struct action_util *au, FILE *f, struct rtattr *arg)
{
struct rtattr *tb[TCA_MPLS_MAX + 1];
struct tc_mpls *parm;
@@ -76,7 +76,7 @@ bad_val:
}
static int
-parse_nat(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n)
+parse_nat(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n)
{
struct tc_nat sel = {};
@@ -136,7 +136,7 @@ skip_args:
}
static int
-print_nat(struct action_util *au, FILE * f, struct rtattr *arg)
+print_nat(const struct action_util *au, FILE * f, struct rtattr *arg)
{
struct tc_nat *sel;
struct rtattr *tb[TCA_NAT_MAX + 1];
@@ -620,7 +620,7 @@ static int pedit_keys_ex_addattr(struct m_pedit_sel *sel, struct nlmsghdr *n)
return 0;
}
-static int parse_pedit(struct action_util *a, int *argc_p, char ***argv_p,
+static int parse_pedit(const struct action_util *a, int *argc_p, char ***argv_p,
int tca_id, struct nlmsghdr *n)
{
struct m_pedit_sel sel = {};
@@ -745,7 +745,7 @@ static int print_pedit_location(FILE *f,
return 0;
}
-static int print_pedit(struct action_util *au, FILE *f, struct rtattr *arg)
+static int print_pedit(const struct action_util *au, FILE *f, struct rtattr *arg)
{
struct tc_pedit_sel *sel;
struct rtattr *tb[TCA_PEDIT_MAX + 1];
@@ -17,9 +17,9 @@
#include "utils.h"
#include "tc_util.h"
-static int act_parse_police(struct action_util *a, int *argc_p,
+static int act_parse_police(const struct action_util *a, int *argc_p,
char ***argv_p, int tca_id, struct nlmsghdr *n);
-static int print_police(struct action_util *a, FILE *f, struct rtattr *tb);
+static int print_police(const struct action_util *a, FILE *f, struct rtattr *tb);
struct action_util police_action_util = {
.id = "police",
@@ -42,7 +42,7 @@ static void usage(void)
exit(-1);
}
-static int act_parse_police(struct action_util *a, int *argc_p, char ***argv_p,
+static int act_parse_police(const struct action_util *a, int *argc_p, char ***argv_p,
int tca_id, struct nlmsghdr *n)
{
int argc = *argc_p;
@@ -260,7 +260,7 @@ int parse_police(int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n)
return act_parse_police(NULL, argc_p, argv_p, tca_id, n);
}
-static int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
+static int print_police(const struct action_util *a, FILE *f, struct rtattr *arg)
{
SPRINT_BUF(b2);
struct tc_police *p;
@@ -31,7 +31,7 @@ static void usage(void)
exit(-1);
}
-static int parse_sample(struct action_util *a, int *argc_p, char ***argv_p,
+static int parse_sample(const struct action_util *a, int *argc_p, char ***argv_p,
int tca_id, struct nlmsghdr *n)
{
struct tc_sample p = { 0 };
@@ -133,7 +133,7 @@ static int parse_sample(struct action_util *a, int *argc_p, char ***argv_p,
return 0;
}
-static int print_sample(struct action_util *au, FILE *f, struct rtattr *arg)
+static int print_sample(const struct action_util *au, FILE *f, struct rtattr *arg)
{
struct rtattr *tb[TCA_SAMPLE_MAX + 1];
struct tc_sample *p;
@@ -90,7 +90,7 @@ static void usage(void)
}
static int
-parse_simple(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
+parse_simple(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
struct nlmsghdr *n)
{
struct tc_defact sel = {};
@@ -155,7 +155,7 @@ parse_simple(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
return 0;
}
-static int print_simple(struct action_util *au, FILE *f, struct rtattr *arg)
+static int print_simple(const struct action_util *au, FILE *f, struct rtattr *arg)
{
struct tc_defact *sel;
struct rtattr *tb[TCA_DEF_MAX + 1];
@@ -41,7 +41,7 @@ usage(void)
}
static int
-parse_skbedit(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
+parse_skbedit(const struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
struct nlmsghdr *n)
{
int argc = *argc_p;
@@ -177,7 +177,7 @@ parse_skbedit(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
return 0;
}
-static int print_skbedit(struct action_util *au, FILE *f, struct rtattr *arg)
+static int print_skbedit(const struct action_util *au, FILE *f, struct rtattr *arg)
{
struct rtattr *tb[TCA_SKBEDIT_MAX + 1];
@@ -40,7 +40,7 @@ static void skbmod_usage(void)
exit(-1);
}
-static int parse_skbmod(struct action_util *a, int *argc_p, char ***argv_p,
+static int parse_skbmod(const struct action_util *a, int *argc_p, char ***argv_p,
int tca_id, struct nlmsghdr *n)
{
int argc = *argc_p;
@@ -156,7 +156,7 @@ static int parse_skbmod(struct action_util *a, int *argc_p, char ***argv_p,
return 0;
}
-static int print_skbmod(struct action_util *au, FILE *f, struct rtattr *arg)
+static int print_skbmod(const struct action_util *au, FILE *f, struct rtattr *arg)
{
struct tc_skbmod *p;
struct rtattr *tb[TCA_SKBMOD_MAX + 1];
@@ -311,7 +311,7 @@ static int tunnel_key_parse_tos_ttl(char *str, int type, struct nlmsghdr *n)
return 0;
}
-static int parse_tunnel_key(struct action_util *a, int *argc_p, char ***argv_p,
+static int parse_tunnel_key(const struct action_util *a, int *argc_p, char ***argv_p,
int tca_id, struct nlmsghdr *n)
{
struct tc_tunnel_key parm = {};
@@ -688,7 +688,7 @@ static void tunnel_key_print_tos_ttl(FILE *f, char *name,
}
}
-static int print_tunnel_key(struct action_util *au, FILE *f, struct rtattr *arg)
+static int print_tunnel_key(const struct action_util *au, FILE *f, struct rtattr *arg)
{
struct rtattr *tb[TCA_TUNNEL_KEY_MAX + 1];
struct tc_tunnel_key *parm;
@@ -56,7 +56,7 @@ static void unexpected(const char *arg)
explain();
}
-static int parse_vlan(struct action_util *a, int *argc_p, char ***argv_p,
+static int parse_vlan(const struct action_util *a, int *argc_p, char ***argv_p,
int tca_id, struct nlmsghdr *n)
{
int argc = *argc_p;
@@ -227,7 +227,7 @@ static int parse_vlan(struct action_util *a, int *argc_p, char ***argv_p,
return 0;
}
-static int print_vlan(struct action_util *au, FILE *f, struct rtattr *arg)
+static int print_vlan(const struct action_util *au, FILE *f, struct rtattr *arg)
{
SPRINT_BUF(b1);
struct rtattr *tb[TCA_VLAN_MAX + 1];
@@ -58,10 +58,10 @@ struct filter_util {
struct action_util {
struct action_util *next;
char id[FILTER_NAMESZ];
- int (*parse_aopt)(struct action_util *a, int *argc,
+ int (*parse_aopt)(const struct action_util *a, int *argc,
char ***argv, int code, struct nlmsghdr *n);
- int (*print_aopt)(struct action_util *au, FILE *f, struct rtattr *opt);
- int (*print_xstats)(struct action_util *au,
+ int (*print_aopt)(const struct action_util *au, FILE *f, struct rtattr *opt);
+ int (*print_xstats)(const struct action_util *au,
FILE *f, struct rtattr *xstats);
};
@@ -112,7 +112,7 @@ int parse_action_control_slash(int *argc_p, char ***argv_p,
int *result1_p, int *result2_p, bool allow_num);
void print_action_control(FILE *f, const char *prefix,
int action, const char *suffix);
-int police_print_xstats(struct action_util *a, FILE *f, struct rtattr *tb);
+int police_print_xstats(const struct action_util *a, FILE *f, struct rtattr *tb);
int tc_print_action(FILE *f, const struct rtattr *tb, unsigned short tot_acts);
int parse_action(int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n);
void print_tm(FILE *f, const struct tcf_t *tm);
The callbacks in action_util should not be modifying underlying qdisc operations structure. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- tc/m_action.c | 4 ++-- tc/m_bpf.c | 4 ++-- tc/m_connmark.c | 4 ++-- tc/m_csum.c | 4 ++-- tc/m_ct.c | 4 ++-- tc/m_ctinfo.c | 4 ++-- tc/m_gact.c | 4 ++-- tc/m_gate.c | 8 ++++---- tc/m_ife.c | 4 ++-- tc/m_mirred.c | 6 +++--- tc/m_mpls.c | 4 ++-- tc/m_nat.c | 4 ++-- tc/m_pedit.c | 4 ++-- tc/m_police.c | 8 ++++---- tc/m_sample.c | 4 ++-- tc/m_simple.c | 4 ++-- tc/m_skbedit.c | 4 ++-- tc/m_skbmod.c | 4 ++-- tc/m_tunnel_key.c | 4 ++-- tc/m_vlan.c | 4 ++-- tc/tc_util.h | 8 ++++---- 21 files changed, 49 insertions(+), 49 deletions(-)