For places where tc is expecting device name use IFNAMSIZ.
For others where it is a filter name, introduce a new constant.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
int argc = *argc_p;
char **argv = *argv_p;
struct rtattr *tail, *tail2;
int argc = *argc_p;
char **argv = *argv_p;
struct rtattr *tail, *tail2;
int act_ck_len = 0;
int ok = 0;
int eap = 0; /* expect action parameters */
int act_ck_len = 0;
int ok = 0;
int eap = 0; /* expect action parameters */
static int tc_action_gd(int cmd, unsigned int flags, int *argc_p, char ***argv_p)
{
static int tc_action_gd(int cmd, unsigned int flags, int *argc_p, char ***argv_p)
{
struct action_util *a = NULL;
int argc = *argc_p;
char **argv = *argv_p;
struct action_util *a = NULL;
int argc = *argc_p;
char **argv = *argv_p;
char **argv = *argv_p;
__u32 msec_since = 0;
int argc = *argc_p;
char **argv = *argv_p;
__u32 msec_since = 0;
int argc = *argc_p;
struct {
struct nlmsghdr n;
struct tcamsg t;
struct {
struct nlmsghdr n;
struct tcamsg t;
int rargc = *argc_p;
char **argv = *argv_p;
int argc = 0, iargc = 0;
int rargc = *argc_p;
char **argv = *argv_p;
int argc = 0, iargc = 0;
int size = 0;
int iok = 0, ok = 0;
__u32 hook = 0, index = 0;
int size = 0;
int iok = 0, ok = 0;
__u32 hook = 0, index = 0;
int ok = 0, iok = 0, mirror = 0, redir = 0, ingress = 0, egress = 0;
struct tc_mirred p = {};
struct rtattr *tail;
int ok = 0, iok = 0, mirror = 0, redir = 0, ingress = 0, egress = 0;
struct tc_mirred p = {};
struct rtattr *tail;
res = parse_offset(&argc, &argv, sel, &tkey);
goto done;
} else {
res = parse_offset(&argc, &argv, sel, &tkey);
goto done;
} else {
struct m_pedit_util *p = NULL;
strncpy(k, *argv, sizeof(k) - 1);
struct m_pedit_util *p = NULL;
strncpy(k, *argv, sizeof(k) - 1);
int c;
char **argv = *argv_p;
int argc;
int c;
char **argv = *argv_p;
int argc;
int size = 0;
int iok = 0, ok = 0;
__u32 hook = 0, index = 0;
int size = 0;
int iok = 0, ok = 0;
__u32 hook = 0, index = 0;
int rargc = *argc_p;
char **argv = *argv_p;
int argc = 0, iargc = 0;
int rargc = *argc_p;
char **argv = *argv_p;
int argc = 0, iargc = 0;
int size = 0;
int iok = 0, ok = 0;
__u32 hook = 0, index = 0;
int size = 0;
int iok = 0, ok = 0;
__u32 hook = 0, index = 0;
};
struct qdisc_util *q = NULL;
struct tc_estimator est = {};
};
struct qdisc_util *q = NULL;
struct tc_estimator est = {};
- char d[16] = {};
- char k[16] = {};
+ char d[IFNAMSIZ] = {};
+ char k[FILTER_NAMESZ] = {};
while (argc > 0) {
if (strcmp(*argv, "dev") == 0) {
while (argc > 0) {
if (strcmp(*argv, "dev") == 0) {
static int tc_class_list(int argc, char **argv)
{
struct tcmsg t = { .tcm_family = AF_UNSPEC };
static int tc_class_list(int argc, char **argv)
{
struct tcmsg t = { .tcm_family = AF_UNSPEC };
char buf[1024] = {0};
filter_qdisc = 0;
char buf[1024] = {0};
filter_qdisc = 0;
int do_exec(int argc, char **argv)
{
struct exec_util *eu;
int do_exec(int argc, char **argv)
{
struct exec_util *eu;
+ char kind[FILTER_NAMESZ] = {};
if (argc < 1) {
fprintf(stderr, "No command given, try \"tc exec help\".\n");
if (argc < 1) {
fprintf(stderr, "No command given, try \"tc exec help\".\n");
__u32 chain_index;
int chain_index_set = 0;
char *fhandle = NULL;
__u32 chain_index;
int chain_index_set = 0;
char *fhandle = NULL;
- char d[16] = {};
- char k[16] = {};
+ char d[IFNAMSIZ] = {};
+ char k[FILTER_NAMESZ] = {};
struct tc_estimator est = {};
if (cmd == RTM_NEWTFILTER && flags & NLM_F_CREATE)
struct tc_estimator est = {};
if (cmd == RTM_NEWTFILTER && flags & NLM_F_CREATE)
int chain_index_set = 0;
__u32 parent_handle = 0;
char *fhandle = NULL;
int chain_index_set = 0;
__u32 parent_handle = 0;
char *fhandle = NULL;
- char d[16] = {};
- char k[16] = {};
+ char d[IFNAMSIZ] = {};
+ char k[FILTER_NAMESZ] = {};
while (argc > 0) {
if (strcmp(*argv, "dev") == 0) {
while (argc > 0) {
if (strcmp(*argv, "dev") == 0) {
.t.tcm_parent = TC_H_UNSPEC,
.t.tcm_family = AF_UNSPEC,
};
.t.tcm_parent = TC_H_UNSPEC,
.t.tcm_family = AF_UNSPEC,
};
__u32 prio = 0;
__u32 protocol = 0;
__u32 chain_index;
__u32 prio = 0;
__u32 protocol = 0;
__u32 chain_index;
struct tc_sizespec szopts;
__u16 *data;
} stab = {};
struct tc_sizespec szopts;
__u16 *data;
} stab = {};
- char d[16] = {};
- char k[16] = {};
+ char d[IFNAMSIZ] = {};
+ char k[FILTER_NAMESZ] = {};
struct {
struct nlmsghdr n;
struct tcmsg t;
struct {
struct nlmsghdr n;
struct tcmsg t;
static int tc_qdisc_list(int argc, char **argv)
{
struct tcmsg t = { .tcm_family = AF_UNSPEC };
static int tc_qdisc_list(int argc, char **argv)
{
struct tcmsg t = { .tcm_family = AF_UNSPEC };
bool dump_invisible = false;
while (argc > 0) {
bool dump_invisible = false;
while (argc > 0) {
#define MAX_MSG 16384
#include <limits.h>
#define MAX_MSG 16384
#include <limits.h>
#include <linux/pkt_sched.h>
#include <linux/pkt_cls.h>
#include <linux/gen_stats.h>
#include <linux/pkt_sched.h>
#include <linux/pkt_cls.h>
#include <linux/gen_stats.h>
#include "tc_core.h"
/* This is the deprecated multiqueue interface */
#include "tc_core.h"
/* This is the deprecated multiqueue interface */
#define TCA_PRIO_MAX (__TCA_PRIO_MAX - 1)
#endif
#define TCA_PRIO_MAX (__TCA_PRIO_MAX - 1)
#endif
+#define FILTER_NAMESZ 16
+
struct qdisc_util {
struct qdisc_util *next;
const char *id;
struct qdisc_util {
struct qdisc_util *next;
const char *id;
extern __u16 f_proto;
struct filter_util {
struct filter_util *next;
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 argc, char **argv, struct nlmsghdr *n);
int (*print_fopt)(struct filter_util *qu,
int (*parse_fopt)(struct filter_util *qu, char *fhandle,
int argc, char **argv, struct nlmsghdr *n);
int (*print_fopt)(struct filter_util *qu,
struct action_util {
struct action_util *next;
struct action_util {
struct action_util *next;
+ char id[FILTER_NAMESZ];
int (*parse_aopt)(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 (*parse_aopt)(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);
struct exec_util {
struct exec_util *next;
struct exec_util {
struct exec_util *next;
+ char id[FILTER_NAMESZ];
int (*parse_eopt)(struct exec_util *eu, int argc, char **argv);
};
int (*parse_eopt)(struct exec_util *eu, int argc, char **argv);
};