aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/xt_mark.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/net/netfilter/xt_mark.c b/net/netfilter/xt_mark.c
index e8059cd17275..934dddfbcd23 100644
--- a/net/netfilter/xt_mark.c
+++ b/net/netfilter/xt_mark.c
@@ -50,6 +50,37 @@ checkentry(const char *tablename,
50 return 1; 50 return 1;
51} 51}
52 52
53#ifdef CONFIG_COMPAT
54struct compat_xt_mark_info {
55 compat_ulong_t mark, mask;
56 u_int8_t invert;
57 u_int8_t __pad1;
58 u_int16_t __pad2;
59};
60
61static void compat_from_user(void *dst, void *src)
62{
63 struct compat_xt_mark_info *cm = src;
64 struct xt_mark_info m = {
65 .mark = cm->mark,
66 .mask = cm->mask,
67 .invert = cm->invert,
68 };
69 memcpy(dst, &m, sizeof(m));
70}
71
72static int compat_to_user(void __user *dst, void *src)
73{
74 struct xt_mark_info *m = src;
75 struct compat_xt_mark_info cm = {
76 .mark = m->mark,
77 .mask = m->mask,
78 .invert = m->invert,
79 };
80 return copy_to_user(dst, &cm, sizeof(cm)) ? -EFAULT : 0;
81}
82#endif /* CONFIG_COMPAT */
83
53static struct xt_match xt_mark_match[] = { 84static struct xt_match xt_mark_match[] = {
54 { 85 {
55 .name = "mark", 86 .name = "mark",
@@ -57,6 +88,11 @@ static struct xt_match xt_mark_match[] = {
57 .checkentry = checkentry, 88 .checkentry = checkentry,
58 .match = match, 89 .match = match,
59 .matchsize = sizeof(struct xt_mark_info), 90 .matchsize = sizeof(struct xt_mark_info),
91#ifdef CONFIG_COMPAT
92 .compatsize = sizeof(struct compat_xt_mark_info),
93 .compat_from_user = compat_from_user,
94 .compat_to_user = compat_to_user,
95#endif
60 .me = THIS_MODULE, 96 .me = THIS_MODULE,
61 }, 97 },
62 { 98 {