]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
add action
authorosdl.net!shemminger <osdl.net!shemminger>
Fri, 13 Aug 2004 23:54:55 +0000 (23:54 +0000)
committerosdl.net!shemminger <osdl.net!shemminger>
Fri, 13 Aug 2004 23:54:55 +0000 (23:54 +0000)
(Logical change 1.66)

tc/f_fw.c

index 3c5e3e2fafaf66683598f08e59a2c5e06b7460b4..66371268377e866779cc832ab0376de9ea10b2dd 100644 (file)
--- a/tc/f_fw.c
+++ b/tc/f_fw.c
@@ -19,7 +19,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <string.h>
-
+#include <linux/if.h> /* IFNAMSIZ */
 #include "utils.h"
 #include "tc_util.h"
 
@@ -70,6 +70,24 @@ static int fw_parse_opt(struct filter_util *qu, char *handle, int argc, char **a
                                return -1;
                        }
                        continue;
+               } else if (matches(*argv, "action") == 0) {
+                       NEXT_ARG();
+                       if (parse_action(&argc, &argv, TCA_FW_ACT, n)) {
+                               fprintf(stderr, "Illegal fw \"action\"\n");
+                               return -1;
+                       }
+                       continue;
+               } else if (strcmp(*argv, "indev") == 0) {
+                       char d[IFNAMSIZ+1];
+                       memset(d, 0, sizeof (d));
+                       argc--;
+                       argv++;
+                       if (argc < 1) {
+                               fprintf(stderr, "Illegal indev\n");
+                               return -1;
+                       }
+                       strncpy(d, *argv, sizeof (d) - 1);
+                       addattr_l(n, MAX_MSG, TCA_FW_INDEV, d, strlen(d) + 1);
                } else if (strcmp(*argv, "help") == 0) {
                        explain();
                        return -1;
@@ -105,6 +123,15 @@ static int fw_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt, __u
 
        if (tb[TCA_FW_POLICE])
                tc_print_police(f, tb[TCA_FW_POLICE]);
+       if (tb[TCA_FW_INDEV]) {
+               struct rtattr *idev = tb[TCA_FW_INDEV];
+               fprintf(f, "input dev %s ",(char *)RTA_DATA(idev));
+       }
+       
+       if (tb[TCA_FW_ACT]) {
+               fprintf(f, "\n");
+               tc_print_action(f, tb[TCA_FW_ACT]);
+       }
        return 0;
 }