]> rtime.felk.cvut.cz Git - lisovros/iproute2_canprio.git/blobdiff - tc/em_meta.c
Convert to use rta_getattr_ functions
[lisovros/iproute2_canprio.git] / tc / em_meta.c
index bec9db03083ab0df1cb82254ae7dfdebb5c8d8c4..fad6b1222adfb8af98eed135f54c0a3dcd3ab1de 100644 (file)
@@ -18,7 +18,6 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <string.h>
-#include <dlfcn.h>
 #include <errno.h>
 
 #include "m_ematch.h"
@@ -34,9 +33,8 @@ static void meta_print_usage(FILE *fd)
            "       META_ID := id [ shift SHIFT ] [ mask MASK ]\n" \
            "\n" \
            "Example: meta(nfmark gt 24)\n" \
-           "         meta(indev shift 1 eq \"ppp\"\n" \
+           "         meta(indev shift 1 eq \"ppp\")\n" \
            "         meta(tcindex mask 0xf0 eq 0xf0)\n" \
-           "         meta(dev eq indev)\n" \
            "\n" \
            "For a list of meta identifiers, use meta(list).\n");
 }
@@ -89,6 +87,7 @@ struct meta_entry {
                                "Routing ClassID (cls_route)"),
        __A(RTIIF,              "rt_iif",       "i",
                                "Incoming interface index"),
+       __A(VLAN_TAG,           "vlan",         "i",    "Vlan tag"),
 
        __A(SECTION,            "Sockets", "", ""),
        __A(SK_FAMILY,          "sk_family",    "i",    "Address family"),
@@ -109,7 +108,6 @@ struct meta_entry {
        __A(SK_ERR_QLEN,        "sk_err_queue", "i",    "Error queue length"),
        __A(SK_FORWARD_ALLOCS,  "sk_fwd_alloc", "i",    "Forward allocations"),
        __A(SK_SNDBUF,          "sk_sndbuf",    "i",    "Send buffer size"),
-       __A(VLAN_TAG,           "vlan",         "i",    "Vlan tag"),
 #undef __A
 };
 
@@ -263,7 +261,7 @@ parse_object(struct bstr *args, struct bstr *arg, struct tcf_meta_val *obj,
        }
 
        num = bstrtoul(arg);
-       if (num != LONG_MAX) {
+       if (num != ULONG_MAX) {
                obj->kind = TCF_META_TYPE_INT << 12;
                obj->kind |= TCF_META_ID_VALUE;
                *dst = (unsigned long) num;
@@ -321,7 +319,7 @@ compatible:
                        a = bstr_next(a);
 
                        shift = bstrtoul(a);
-                       if (shift == LONG_MAX) {
+                       if (shift == ULONG_MAX) {
                                PARSE_ERR(a, "meta: invalid shift, must " \
                                    "be numeric");
                                return PARSE_FAILURE;
@@ -339,7 +337,7 @@ compatible:
                        a = bstr_next(a);
 
                        mask = bstrtoul(a);
-                       if (mask == LONG_MAX) {
+                       if (mask == ULONG_MAX) {
                                PARSE_ERR(a, "meta: invalid mask, must be " \
                                    "numeric");
                                return PARSE_FAILURE;
@@ -450,7 +448,7 @@ static inline int print_value(FILE *fd, int type, struct rtattr *rta)
                                    "size mismatch.\n");
                                return -1;
                        }
-                       fprintf(fd, "%d", *(__u32 *) RTA_DATA(rta));
+                       fprintf(fd, "%d", rta_getattr_u32(rta));
                        break;
 
                case TCF_META_TYPE_VAR:
@@ -487,7 +485,7 @@ static int print_object(FILE *fd, struct tcf_meta_val *obj, struct rtattr *rta)
                                        goto size_mismatch;
 
                                fprintf(fd, " mask 0x%08x",
-                                   *(__u32*) RTA_DATA(rta));
+                                   rta_getattr_u32(rta));
                        }
                        break;
        }