]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - tc/q_dsmark.c
bridge: fdb: add support for src_vni option
[mirror_iproute2.git] / tc / q_dsmark.c
index 0aab387d6f3b4d4a912428fae9db49dd332a07cd..d3e8292d777cc2be5385cde5a13bdeb5c966aabc 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * q_dsmark.c          Differentiated Services field marking.
  *
@@ -25,7 +26,7 @@ static void explain(void)
 
 
 static int dsmark_parse_opt(struct qdisc_util *qu, int argc, char **argv,
-    struct nlmsghdr *n)
+       struct nlmsghdr *n, const char *dev)
 {
        struct rtattr *tail;
        __u16 ind;
@@ -63,16 +64,16 @@ static int dsmark_parse_opt(struct qdisc_util *qu, int argc, char **argv,
                explain();
                return -1;
        }
-       tail = NLMSG_TAIL(n);
-       addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+       tail = addattr_nest(n, 1024, TCA_OPTIONS);
        addattr_l(n, 1024, TCA_DSMARK_INDICES, &ind, sizeof(ind));
        if (dflt != -1) {
            __u16 tmp = dflt;
 
            addattr_l(n, 1024, TCA_DSMARK_DEFAULT_INDEX, &tmp, sizeof(tmp));
        }
-       if (set_tc_index) addattr_l(n, 1024, TCA_DSMARK_SET_TC_INDEX, NULL, 0);
-       tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+       if (set_tc_index)
+               addattr_l(n, 1024, TCA_DSMARK_SET_TC_INDEX, NULL, 0);
+       addattr_nest_end(n, tail);
        return 0;
 }
 
@@ -84,14 +85,13 @@ static void explain_class(void)
 
 
 static int dsmark_parse_class_opt(struct qdisc_util *qu, int argc, char **argv,
-   struct nlmsghdr *n)
+       struct nlmsghdr *n, const char *dev)
 {
        struct rtattr *tail;
        __u8 tmp;
        char *end;
 
-       tail = NLMSG_TAIL(n);
-       addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+       tail = addattr_nest(n, 1024, TCA_OPTIONS);
        while (argc > 0) {
                if (!strcmp(*argv, "mask")) {
                        NEXT_ARG();
@@ -116,7 +116,7 @@ static int dsmark_parse_class_opt(struct qdisc_util *qu, int argc, char **argv,
                argc--;
                argv++;
        }
-       tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+       addattr_nest_end(n, tail);
        return 0;
 }