static const struct nla_policy canprio_policy[TCA_CANPRIO_MAX + 1] = {
[TCA_CANPRIO_CLASSID] = { .type = NLA_U32 },
//FIXME Be aware of possible problems with 64bit kernel and 32bit userspace etc.
- [TCA_CANPRIO_RULES] = { .len = sizeof(canprio_rules) },
+ [TCA_CANPRIO_RULES] = { .len = sizeof(canprio_rules) }, /* FIXME */
[TCA_CANPRIO_INV_EN] = { .type = NLA_U32 },
};
canid = canprio_get_id(skb);
list_for_each_entry(f, &head->flist, link) {
- int match = 0;
+ bool match = false;
printk(" canprio_classify() can ID of received frame = 0x%x\n", canid);
if (canid & CAN_EFF_FLAG) {
rcu_read_lock();
hlist_for_each_entry_rcu(effi, next, &f->match_eff, list) {
- if((effi->canid ^ canid) & effi->mask) {
- match = 1;
+ if ((effi->canid ^ canid) & effi->mask) {
+ match = true;
break;
}
}
rcu_read_unlock();
} else {
- if(test_bit(canid, f->match_sff)) {
- match = 1;
- }
+ match = test_bit(canid, f->match_sff);
}
if (f->inv_match_en)
printk(" rules_count = %u\n", canprio_rules_count);
for (i = 0; i < canprio_rules_count; i++) {
+ /* FIXME: shouldn't use here the same logic as in
+ * can_rcv_filter() to filter for various combination
+ * of flags (EFF, RTR) */
if (canprio_rules[i].canid & CAN_EFF_FLAG) {
err = eff_match_add(f, canprio_rules[i].canid, canprio_rules[i].canid_mask);
if (err < 0)
return -ENOBUFS;
INIT_LIST_HEAD(&head->flist);
tp->root = head;
+ tp->protocol = htons(ETH_P_CAN); /* Work only on AF_CAN packets - not tested! */
return 0;
}