iproute2: Fixup NSS patches for GCC 14.x

Signed-off-by: Sean Khan <datapronix@protonmail.com>
This commit is contained in:
Sean Khan 2024-06-01 17:16:21 -04:00
parent 9609bb1e10
commit 08362e886f
2 changed files with 36 additions and 37 deletions

View File

@ -264,7 +264,7 @@
--- /dev/null --- /dev/null
+++ b/tc/q_nss.c +++ b/tc/q_nss.c
@@ -0,0 +1,1826 @@ @@ -0,0 +1,1825 @@
+/* +/*
+ ************************************************************************** + **************************************************************************
+ * Copyright (c) 2015, 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2015, 2018 The Linux Foundation. All rights reserved.
@ -310,7 +310,7 @@
+ fprintf(stderr, " nsswred limit BYTES DP NUMBER min BYTES max BYTES avpkt BYTES dscp NUMBER [ probability VALUE ] [ burst PACKETS ]\n"); + fprintf(stderr, " nsswred limit BYTES DP NUMBER min BYTES max BYTES avpkt BYTES dscp NUMBER [ probability VALUE ] [ burst PACKETS ]\n");
+} +}
+ +
+static int nsswred_setup(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) +static int nsswred_setup(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
+{ +{
+ struct rtattr *tail; + struct rtattr *tail;
+ struct tc_nsswred_qopt opt; + struct tc_nsswred_qopt opt;
@ -385,7 +385,7 @@
+ return 0; + return 0;
+} +}
+ +
+static int nsswred_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) +static int nsswred_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev)
+{ +{
+ struct rtattr *tail; + struct rtattr *tail;
+ struct tc_nsswred_qopt opt; + struct tc_nsswred_qopt opt;
@ -534,7 +534,7 @@
+ return 0; + return 0;
+} +}
+ +
+static int nsswred_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int nsswred_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+{ +{
+ struct rtattr *tb[TCA_NSSWRED_MAX + 1]; + struct rtattr *tb[TCA_NSSWRED_MAX + 1];
+ struct tc_nsswred_qopt *qopt; + struct tc_nsswred_qopt *qopt;
@ -602,7 +602,7 @@
+ fprintf(stderr, "Usage: ... nsspfifo [ limit PACKETS ] [ set_default ] [ accel_mode ]\n"); + fprintf(stderr, "Usage: ... nsspfifo [ limit PACKETS ] [ set_default ] [ accel_mode ]\n");
+} +}
+ +
+static int nssfifo_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) +static int nssfifo_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev)
+{ +{
+ struct rtattr *tail; + struct rtattr *tail;
+ struct tc_nssfifo_qopt opt; + struct tc_nssfifo_qopt opt;
@ -652,7 +652,7 @@
+ return 0; + return 0;
+} +}
+ +
+static int nssfifo_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int nssfifo_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+{ +{
+ struct rtattr *tb[TCA_NSSFIFO_MAX + 1]; + struct rtattr *tb[TCA_NSSFIFO_MAX + 1];
+ struct tc_nssfifo_qopt *qopt; + struct tc_nssfifo_qopt *qopt;
@ -709,7 +709,7 @@
+ fprintf(stderr, "Value of target and interval should be greater than 1ms\n"); + fprintf(stderr, "Value of target and interval should be greater than 1ms\n");
+} +}
+ +
+static int nssfq_codel_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) +static int nssfq_codel_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev)
+{ +{
+ struct rtattr *tail; + struct rtattr *tail;
+ struct tc_nsscodel_qopt opt; + struct tc_nsscodel_qopt opt;
@ -797,7 +797,7 @@
+ return 0; + return 0;
+} +}
+ +
+static int nssfq_codel_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int nssfq_codel_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+{ +{
+ struct rtattr *tb[TCA_NSSCODEL_MAX + 1]; + struct rtattr *tb[TCA_NSSCODEL_MAX + 1];
+ struct tc_nsscodel_qopt *qopt; + struct tc_nsscodel_qopt *qopt;
@ -835,7 +835,7 @@
+ return 0; + return 0;
+} +}
+ +
+static int nssfq_codel_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats) +static int nssfq_codel_print_xstats(const struct qdisc_util *qu, FILE *f, struct rtattr *xstats)
+{ +{
+ struct tc_nssfq_codel_xstats *st; + struct tc_nssfq_codel_xstats *st;
+ +
@ -872,7 +872,7 @@
+ fprintf(stderr, "Value of target and interval should be greater than 1ms\n"); + fprintf(stderr, "Value of target and interval should be greater than 1ms\n");
+} +}
+ +
+static int nsscodel_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) +static int nsscodel_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev)
+{ +{
+ struct rtattr *tail; + struct rtattr *tail;
+ struct tc_nsscodel_qopt opt; + struct tc_nsscodel_qopt opt;
@ -944,7 +944,7 @@
+ return 0; + return 0;
+} +}
+ +
+static int nsscodel_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int nsscodel_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+{ +{
+ struct rtattr *tb[TCA_NSSCODEL_MAX + 1]; + struct rtattr *tb[TCA_NSSCODEL_MAX + 1];
+ struct tc_nsscodel_qopt *qopt; + struct tc_nsscodel_qopt *qopt;
@ -977,7 +977,7 @@
+ return 0; + return 0;
+} +}
+ +
+static int nsscodel_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats) +static int nsscodel_print_xstats(const struct qdisc_util *qu, FILE *f, struct rtattr *xstats)
+{ +{
+ struct tc_nsscodel_xstats *st; + struct tc_nsscodel_xstats *st;
+ +
@ -1008,7 +1008,7 @@
+ fprintf(stderr, "Usage: ... nsstbl burst BYTES rate BPS [ mtu BYTES ] [ accel_mode ]\n"); + fprintf(stderr, "Usage: ... nsstbl burst BYTES rate BPS [ mtu BYTES ] [ accel_mode ]\n");
+} +}
+ +
+static int nsstbl_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) +static int nsstbl_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev)
+{ +{
+ int ok = 0; + int ok = 0;
+ struct rtattr *tail; + struct rtattr *tail;
@ -1108,7 +1108,7 @@
+ return 0; + return 0;
+} +}
+ +
+static int nsstbl_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int nsstbl_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+{ +{
+ struct rtattr *tb[TCA_NSSTBL_MAX + 1]; + struct rtattr *tb[TCA_NSSTBL_MAX + 1];
+ struct tc_nsstbl_qopt *qopt; + struct tc_nsstbl_qopt *qopt;
@ -1147,7 +1147,7 @@
+ fprintf(stderr, "Usage: ... nssprio [ bands NUMBER (default 256) ] [ accel_mode ]\n"); + fprintf(stderr, "Usage: ... nssprio [ bands NUMBER (default 256) ] [ accel_mode ]\n");
+} +}
+ +
+static int nssprio_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) +static int nssprio_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev)
+{ +{
+ int ok = 0; + int ok = 0;
+ struct rtattr *tail; + struct rtattr *tail;
@ -1204,7 +1204,7 @@
+ return 0; + return 0;
+} +}
+ +
+static int nssprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int nssprio_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+{ +{
+ struct rtattr *tb[TCA_NSSPRIO_MAX + 1]; + struct rtattr *tb[TCA_NSSPRIO_MAX + 1];
+ struct tc_nssprio_qopt *qopt; + struct tc_nssprio_qopt *qopt;
@ -1254,7 +1254,7 @@
+ fprintf(stderr, "NSSBF: Illegal \"%s\"\n", arg); + fprintf(stderr, "NSSBF: Illegal \"%s\"\n", arg);
+} +}
+ +
+static int nssbf_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) +static int nssbf_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev)
+{ +{
+ struct tc_nssbf_qopt opt; + struct tc_nssbf_qopt opt;
+ struct rtattr *tail; + struct rtattr *tail;
@ -1306,7 +1306,7 @@
+ return 0; + return 0;
+} +}
+ +
+static int nssbf_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int nssbf_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+{ +{
+ struct rtattr *tb[TCA_NSSBF_MAX + 1]; + struct rtattr *tb[TCA_NSSBF_MAX + 1];
+ struct tc_nssbf_qopt *qopt; + struct tc_nssbf_qopt *qopt;
@ -1329,7 +1329,7 @@
+ return 0; + return 0;
+} +}
+ +
+static int nssbf_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) +static int nssbf_parse_class_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev)
+{ +{
+ int ok = 0; + int ok = 0;
+ struct rtattr *tail; + struct rtattr *tail;
@ -1413,7 +1413,7 @@
+ return 0; + return 0;
+} +}
+ +
+static int nssbf_print_class_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int nssbf_print_class_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+{ +{
+ struct rtattr *tb[TCA_NSSBF_MAX + 1]; + struct rtattr *tb[TCA_NSSBF_MAX + 1];
+ struct tc_nssbf_class_qopt *qopt; + struct tc_nssbf_class_qopt *qopt;
@ -1459,7 +1459,7 @@
+ fprintf(stderr, "Usage (class): ... nsswrr quantum PACKETS ]\n"); + fprintf(stderr, "Usage (class): ... nsswrr quantum PACKETS ]\n");
+} +}
+ +
+static int nsswrr_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) +static int nsswrr_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev)
+{ +{
+ struct tc_nsswrr_qopt opt; + struct tc_nsswrr_qopt opt;
+ bool accel_mode = false; + bool accel_mode = false;
@ -1501,7 +1501,7 @@
+ return 0; + return 0;
+} +}
+ +
+static int nsswrr_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int nsswrr_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+{ +{
+ struct rtattr *tb[TCA_NSSWRR_MAX + 1]; + struct rtattr *tb[TCA_NSSWRR_MAX + 1];
+ struct tc_nsswrr_qopt *qopt; + struct tc_nsswrr_qopt *qopt;
@ -1523,7 +1523,7 @@
+ return 0; + return 0;
+} +}
+ +
+static int nsswrr_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) +static int nsswrr_parse_class_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev)
+{ +{
+ int ok = 0; + int ok = 0;
+ struct rtattr *tail; + struct rtattr *tail;
@ -1563,7 +1563,7 @@
+ return 0; + return 0;
+} +}
+ +
+static int nsswrr_print_class_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int nsswrr_print_class_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+{ +{
+ struct rtattr *tb[TCA_NSSWRR_MAX + 1]; + struct rtattr *tb[TCA_NSSWRR_MAX + 1];
+ struct tc_nsswrr_class_qopt *qopt; + struct tc_nsswrr_class_qopt *qopt;
@ -1605,7 +1605,7 @@
+ fprintf(stderr, "Usage (class): ... nsswfq quantum BYTES ]\n"); + fprintf(stderr, "Usage (class): ... nsswfq quantum BYTES ]\n");
+} +}
+ +
+static int nsswfq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) +static int nsswfq_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev)
+{ +{
+ struct tc_nsswfq_qopt opt; + struct tc_nsswfq_qopt opt;
+ bool accel_mode = false; + bool accel_mode = false;
@ -1647,7 +1647,7 @@
+ return 0; + return 0;
+} +}
+ +
+static int nsswfq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int nsswfq_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+{ +{
+ struct rtattr *tb[TCA_NSSWFQ_MAX + 1]; + struct rtattr *tb[TCA_NSSWFQ_MAX + 1];
+ struct tc_nsswfq_qopt *qopt; + struct tc_nsswfq_qopt *qopt;
@ -1669,7 +1669,7 @@
+ return 0; + return 0;
+} +}
+ +
+static int nsswfq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) +static int nsswfq_parse_class_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev)
+{ +{
+ int ok = 0; + int ok = 0;
+ struct rtattr *tail; + struct rtattr *tail;
@ -1709,7 +1709,7 @@
+ return 0; + return 0;
+} +}
+ +
+static int nsswfq_print_class_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int nsswfq_print_class_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+{ +{
+ struct rtattr *tb[TCA_NSSWFQ_MAX + 1]; + struct rtattr *tb[TCA_NSSWFQ_MAX + 1];
+ struct tc_nsswfq_class_qopt *qopt; + struct tc_nsswfq_class_qopt *qopt;
@ -1761,7 +1761,7 @@
+ fprintf(stderr, "NSSHTB: Illegal \"%s\"\n", arg); + fprintf(stderr, "NSSHTB: Illegal \"%s\"\n", arg);
+} +}
+ +
+static int nsshtb_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) +static int nsshtb_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev)
+{ +{
+ struct tc_nsshtb_qopt opt; + struct tc_nsshtb_qopt opt;
+ struct rtattr *tail; + struct rtattr *tail;
@ -1813,7 +1813,7 @@
+ return 0; + return 0;
+} +}
+ +
+static int nsshtb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int nsshtb_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+{ +{
+ struct rtattr *tb[TCA_NSSHTB_MAX + 1]; + struct rtattr *tb[TCA_NSSHTB_MAX + 1];
+ struct tc_nsshtb_qopt *qopt; + struct tc_nsshtb_qopt *qopt;
@ -1839,7 +1839,7 @@
+ return 0; + return 0;
+} +}
+ +
+static int nsshtb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) +static int nsshtb_parse_class_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev)
+{ +{
+ int ok = 0; + int ok = 0;
+ struct rtattr *tail; + struct rtattr *tail;
@ -1971,11 +1971,10 @@
+ return 0; + return 0;
+} +}
+ +
+static int nsshtb_print_class_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int nsshtb_print_class_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+{ +{
+ struct rtattr *tb[TCA_NSSHTB_MAX + 1]; + struct rtattr *tb[TCA_NSSHTB_MAX + 1];
+ struct tc_nsshtb_class_qopt *qopt; + struct tc_nsshtb_class_qopt *qopt;
+ SPRINT_BUF(b1);
+ +
+ if (opt == NULL) + if (opt == NULL)
+ return 0; + return 0;
@ -2016,7 +2015,7 @@
+ fprintf(stderr, "Usage: ... nssblackhole [ set_default ] [ accel_mode ]\n"); + fprintf(stderr, "Usage: ... nssblackhole [ set_default ] [ accel_mode ]\n");
+} +}
+ +
+static int nssblackhole_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) +static int nssblackhole_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev)
+{ +{
+ struct rtattr *tail; + struct rtattr *tail;
+ struct tc_nssblackhole_qopt opt; + struct tc_nssblackhole_qopt opt;
@ -2060,7 +2059,7 @@
+ return 0; + return 0;
+} +}
+ +
+static int nssblackhole_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) +static int nssblackhole_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+{ +{
+ struct rtattr *tb[TCA_NSSBLACKHOLE_MAX + 1]; + struct rtattr *tb[TCA_NSSBLACKHOLE_MAX + 1];
+ struct tc_nssblackhole_qopt *qopt; + struct tc_nssblackhole_qopt *qopt;

View File

@ -68,7 +68,7 @@
+ * parse_nss_mirred() + * parse_nss_mirred()
+ * Parse and validate the nssmirred action statement. + * Parse and validate the nssmirred action statement.
+ */ + */
+static int parse_nss_mirred(struct action_util *a, int *argc_p, char ***argv_p, +static int parse_nss_mirred(const struct action_util *a, int *argc_p, char ***argv_p,
+ int tca_id, struct nlmsghdr *n) + int tca_id, struct nlmsghdr *n)
+{ +{
+ int idx, argc = *argc_p; + int idx, argc = *argc_p;
@ -142,7 +142,7 @@
+ * print_nss_mirred() + * print_nss_mirred()
+ * Print information related to nssmirred action. + * Print information related to nssmirred action.
+ */ + */
+static int print_nss_mirred(struct action_util *au, FILE * f, struct rtattr *arg) +static int print_nss_mirred(const struct action_util *au, FILE * f, struct rtattr *arg)
+{ +{
+ struct tc_nss_mirred *p; + struct tc_nss_mirred *p;
+ struct rtattr *tb[TCA_NSS_MIRRED_MAX + 1]; + struct rtattr *tb[TCA_NSS_MIRRED_MAX + 1];