* (c) 2011 Volkswagen Group Research
* Authors: Michal Sojka <sojkam1@fel.cvut.cz>
* Pavel Pisa <pisa@cmp.felk.cvut.cz>
- * Rostislav Lisovy <lisovy@kormus.cz>
+ * Rostislav Lisovy <lisovy@gmail.cz>
* Funded by: Volkswagen Group Research
*
* Some function descriptions are heavily inspired by article "Linux Network
ID (11 bit) there is one record in this
bitfield */
#endif
- int inv_match_en; /* Inverted match flag */
int rules_count;
int eff_rules_count;
int sff_rules_count;
* TC_POLICE_OK if succesfully classified (without regard to policing rules)
* TC_POLICE_UNSPEC if no matching rule was found
*/
-static int canfltr_classify(struct sk_buff *skb, struct tcf_proto *tp,
+static int canfltr_classify(struct sk_buff *skb, const struct tcf_proto *tp,
struct tcf_result *res)
{
struct canfltr_head *head = (struct canfltr_head *)tp->root;
rules_tmp = kzalloc(sizeof(*rules_tmp), GFP_KERNEL);
if (rules_tmp == NULL)
- return -ENOBUFS; /* XXX: Why not -ENOMEM? */
+ return -ENOBUFS;
err = -EINVAL;
if (tb[TCA_CANFLTR_CLASSID] == NULL)
{
struct canfltr_head *head;
+ if ((tp->protocol != htons(ETH_P_ALL)) && (tp->protocol != htons(ETH_P_CAN)))
+ return -1;
+
+ /* Work only on CAN frames */
+ if (tp->protocol == htons(ETH_P_ALL))
+ tp->protocol = htons(ETH_P_CAN);
+
head = kzalloc(sizeof(*head), GFP_KERNEL);
if (head == NULL)
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;
}
module_init(init_canfltr);
module_exit(exit_canfltr);
MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Rostislav Lisovy <lisovy@kormus.cz>");
+MODULE_AUTHOR("Rostislav Lisovy <lisovy@gmail.cz>");
MODULE_DESCRIPTION("Controller Area Network classifier");