12 #include <linux/module.h>
13 #include <linux/types.h>
14 #include <linux/kernel.h>
17 #include <asm/unaligned.h>
20 static inline int cmp_needs_transformation(
struct tcf_em_cmp *cmp)
25 static int em_cmp_match(
struct sk_buff *
skb,
struct tcf_ematch *
em,
29 unsigned char *
ptr = tcf_get_base_ptr(skb, cmp->
layer) + cmp->
off;
32 if (!tcf_valid_offset(skb,
ptr, cmp->
align))
41 val = get_unaligned_be16(
ptr);
43 if (cmp_needs_transformation(cmp))
53 if (cmp_needs_transformation(cmp))
66 return val == cmp->
val;
68 return val < cmp->
val;
70 return val > cmp->
val;
76 static struct tcf_ematch_ops em_cmp_ops = {
79 .
match = em_cmp_match,
84 static int __init init_em_cmp(
void)
89 static void __exit exit_em_cmp(
void)