]> rtime.felk.cvut.cz Git - lisovros/iproute2_canprio.git/blobdiff - tc/m_ipt.c
Convert to use rta_getattr_ functions
[lisovros/iproute2_canprio.git] / tc / m_ipt.c
index 5b9842867eec4a8880a383052bb966dc1faad18a..dc2dedc0dd9ce7b481b462b797f29f1edf36798d 100644 (file)
@@ -30,7 +30,6 @@
 #include <stdlib.h>
 #include <ctype.h>
 #include <stdarg.h>
-#include <limits.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/wait.h>
@@ -227,6 +226,10 @@ get_target_name(const char *name)
        struct iptables_target *m;
        char path[strlen(lib_dir) + sizeof ("/libipt_.so") + strlen(name)];
 
+#ifdef NO_SHARED_LIBS
+       return NULL;
+#endif
+
        new_name = malloc(strlen(name) + 1);
        lname = malloc(strlen(name) + 1);
        if (new_name)
@@ -278,6 +281,7 @@ get_target_name(const char *name)
                        fputs(dlerror(), stderr);
                        printf("\n");
                        free(new_name);
+                       free(lname);
                        return NULL;
                }
        }
@@ -294,6 +298,7 @@ get_target_name(const char *name)
                                        fprintf(stderr, "\n");
                                        dlclose(handle);
                                        free(new_name);
+                                       free(lname);
                                        return NULL;
                                }
                        }
@@ -301,6 +306,7 @@ get_target_name(const char *name)
        }
 
        free(new_name);
+       free(lname);
        return m;
 }
 
@@ -390,11 +396,9 @@ static int parse_ipt(struct action_util *a,int *argc_p,
        char **argv = *argv_p;
        int argc = 0, iargc = 0;
        char k[16];
-       int res = -1;
        int size = 0;
        int iok = 0, ok = 0;
        __u32 hook = 0, index = 0;
-       res = 0;
 
        lib_dir = getenv("IPTABLES_LIB_DIR");
        if (!lib_dir)
@@ -548,7 +552,7 @@ print_ipt(struct action_util *au,FILE * f, struct rtattr *arg)
                fprintf(f, "[NULL ipt table name ] assuming mangle ");
        } else {
                fprintf(f, "tablename: %s ",
-                       (char *) RTA_DATA(tb[TCA_IPT_TABLE]));
+                       rta_getattr_str(tb[TCA_IPT_TABLE]));
        }
 
        if (tb[TCA_IPT_HOOK] == NULL) {
@@ -556,7 +560,7 @@ print_ipt(struct action_util *au,FILE * f, struct rtattr *arg)
                return -1;
        } else {
                __u32 hook;
-               hook = *(__u32 *) RTA_DATA(tb[TCA_IPT_HOOK]);
+               hook = rta_getattr_u32(tb[TCA_IPT_HOOK]);
                fprintf(f, " hook: %s \n", ipthooks[hook]);
        }
 
@@ -587,7 +591,7 @@ print_ipt(struct action_util *au,FILE * f, struct rtattr *arg)
                        fprintf(f, " [NULL ipt target index ]\n");
                } else {
                        __u32 index;
-                       index = *(__u32 *) RTA_DATA(tb[TCA_IPT_INDEX]);
+                       index = rta_getattr_u32(tb[TCA_IPT_INDEX]);
                        fprintf(f, " \n\tindex %d", index);
                }