]> rtime.felk.cvut.cz Git - lisovros/iproute2_canprio.git/commitdiff
em_can: Significant bug fixes
authorRostislav Lisovy <lisovy@gmail.com>
Mon, 11 Jun 2012 14:41:35 +0000 (16:41 +0200)
committerRostislav Lisovy <lisovy@gmail.com>
Mon, 11 Jun 2012 14:41:35 +0000 (16:41 +0200)
tc/em_can.c

index 4c0984daf4c690edab53451764b48d41ca27c93e..e0be32cefa0991f2d51fc3ccdec047fe231e9167 100644 (file)
@@ -48,7 +48,7 @@ static int can_parse_rule(struct can_filter *rule, struct bstr *a, int iseff)
                } else
                        can_mask = CAN_SFF_MASK;
        }
-       rule->can_id = can_id | (iseff) ? CAN_EFF_FLAG : 0 ;
+       rule->can_id = can_id | ((iseff) ? CAN_EFF_FLAG : 0) ;
        rule->can_mask = can_mask;
 
        return 0;
@@ -87,9 +87,10 @@ static int can_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr,
                return PARSE_ERR(a, "can: Improperly formed CAN ID & mask\n");
 
        for (i = 1; i < (sizeof(rules_raw)/sizeof(struct can_filter)); i++) {
-               a = bstr_next(args);
-               if (a == NULL)
+               a = bstr_next(a);
+               if (a == NULL) {
                        break;
+               }
 
                ret = can_parse_rule(&rules_raw[i], a, iseff);
                if (ret == -1)
@@ -104,8 +105,9 @@ static int can_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr,
 #endif
        }
 
-       if (a->next)
-               return PARSE_ERR(a->next, "can: unexpected trailer");
+       // FIX THIS !@#$%
+       //if (a->next)
+       //      return PARSE_ERR(a->next, "can: unexpected trailer");
 
        addraw_l(n, MAX_MSG, hdr, sizeof(*hdr));
        addraw_l(n, MAX_MSG, &rules_raw, sizeof(struct can_filter) * i); // FIXME is size ok