|
@@ -463,7 +463,8 @@ static inline int check_target(struct arpt_entry *e, const char *name)
|
|
t = arpt_get_target(e);
|
|
t = arpt_get_target(e);
|
|
target = t->u.kernel.target;
|
|
target = t->u.kernel.target;
|
|
|
|
|
|
- ret = xt_check_target(target, NF_ARP, t->u.target_size - sizeof(*t),
|
|
|
|
|
|
+ ret = xt_check_target(target, NFPROTO_ARP,
|
|
|
|
+ t->u.target_size - sizeof(*t),
|
|
name, e->comefrom, 0, 0);
|
|
name, e->comefrom, 0, 0);
|
|
if (!ret && t->u.kernel.target->checkentry
|
|
if (!ret && t->u.kernel.target->checkentry
|
|
&& !t->u.kernel.target->checkentry(name, e, target, t->data,
|
|
&& !t->u.kernel.target->checkentry(name, e, target, t->data,
|
|
@@ -488,7 +489,8 @@ find_check_entry(struct arpt_entry *e, const char *name, unsigned int size,
|
|
return ret;
|
|
return ret;
|
|
|
|
|
|
t = arpt_get_target(e);
|
|
t = arpt_get_target(e);
|
|
- target = try_then_request_module(xt_find_target(NF_ARP, t->u.user.name,
|
|
|
|
|
|
+ target = try_then_request_module(xt_find_target(NFPROTO_ARP,
|
|
|
|
+ t->u.user.name,
|
|
t->u.user.revision),
|
|
t->u.user.revision),
|
|
"arpt_%s", t->u.user.name);
|
|
"arpt_%s", t->u.user.name);
|
|
if (IS_ERR(target) || !target) {
|
|
if (IS_ERR(target) || !target) {
|
|
@@ -788,7 +790,7 @@ static void compat_standard_from_user(void *dst, void *src)
|
|
int v = *(compat_int_t *)src;
|
|
int v = *(compat_int_t *)src;
|
|
|
|
|
|
if (v > 0)
|
|
if (v > 0)
|
|
- v += xt_compat_calc_jump(NF_ARP, v);
|
|
|
|
|
|
+ v += xt_compat_calc_jump(NFPROTO_ARP, v);
|
|
memcpy(dst, &v, sizeof(v));
|
|
memcpy(dst, &v, sizeof(v));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -797,7 +799,7 @@ static int compat_standard_to_user(void __user *dst, void *src)
|
|
compat_int_t cv = *(int *)src;
|
|
compat_int_t cv = *(int *)src;
|
|
|
|
|
|
if (cv > 0)
|
|
if (cv > 0)
|
|
- cv -= xt_compat_calc_jump(NF_ARP, cv);
|
|
|
|
|
|
+ cv -= xt_compat_calc_jump(NFPROTO_ARP, cv);
|
|
return copy_to_user(dst, &cv, sizeof(cv)) ? -EFAULT : 0;
|
|
return copy_to_user(dst, &cv, sizeof(cv)) ? -EFAULT : 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -815,7 +817,7 @@ static int compat_calc_entry(struct arpt_entry *e,
|
|
t = arpt_get_target(e);
|
|
t = arpt_get_target(e);
|
|
off += xt_compat_target_offset(t->u.kernel.target);
|
|
off += xt_compat_target_offset(t->u.kernel.target);
|
|
newinfo->size -= off;
|
|
newinfo->size -= off;
|
|
- ret = xt_compat_add_offset(NF_ARP, entry_offset, off);
|
|
|
|
|
|
+ ret = xt_compat_add_offset(NFPROTO_ARP, entry_offset, off);
|
|
if (ret)
|
|
if (ret)
|
|
return ret;
|
|
return ret;
|
|
|
|
|
|
@@ -866,9 +868,9 @@ static int get_info(struct net *net, void __user *user, int *len, int compat)
|
|
name[ARPT_TABLE_MAXNAMELEN-1] = '\0';
|
|
name[ARPT_TABLE_MAXNAMELEN-1] = '\0';
|
|
#ifdef CONFIG_COMPAT
|
|
#ifdef CONFIG_COMPAT
|
|
if (compat)
|
|
if (compat)
|
|
- xt_compat_lock(NF_ARP);
|
|
|
|
|
|
+ xt_compat_lock(NFPROTO_ARP);
|
|
#endif
|
|
#endif
|
|
- t = try_then_request_module(xt_find_table_lock(net, NF_ARP, name),
|
|
|
|
|
|
+ t = try_then_request_module(xt_find_table_lock(net, NFPROTO_ARP, name),
|
|
"arptable_%s", name);
|
|
"arptable_%s", name);
|
|
if (t && !IS_ERR(t)) {
|
|
if (t && !IS_ERR(t)) {
|
|
struct arpt_getinfo info;
|
|
struct arpt_getinfo info;
|
|
@@ -878,7 +880,7 @@ static int get_info(struct net *net, void __user *user, int *len, int compat)
|
|
if (compat) {
|
|
if (compat) {
|
|
struct xt_table_info tmp;
|
|
struct xt_table_info tmp;
|
|
ret = compat_table_info(private, &tmp);
|
|
ret = compat_table_info(private, &tmp);
|
|
- xt_compat_flush_offsets(NF_ARP);
|
|
|
|
|
|
+ xt_compat_flush_offsets(NFPROTO_ARP);
|
|
private = &tmp;
|
|
private = &tmp;
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
@@ -901,7 +903,7 @@ static int get_info(struct net *net, void __user *user, int *len, int compat)
|
|
ret = t ? PTR_ERR(t) : -ENOENT;
|
|
ret = t ? PTR_ERR(t) : -ENOENT;
|
|
#ifdef CONFIG_COMPAT
|
|
#ifdef CONFIG_COMPAT
|
|
if (compat)
|
|
if (compat)
|
|
- xt_compat_unlock(NF_ARP);
|
|
|
|
|
|
+ xt_compat_unlock(NFPROTO_ARP);
|
|
#endif
|
|
#endif
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
@@ -925,7 +927,7 @@ static int get_entries(struct net *net, struct arpt_get_entries __user *uptr,
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
- t = xt_find_table_lock(net, NF_ARP, get.name);
|
|
|
|
|
|
+ t = xt_find_table_lock(net, NFPROTO_ARP, get.name);
|
|
if (t && !IS_ERR(t)) {
|
|
if (t && !IS_ERR(t)) {
|
|
const struct xt_table_info *private = t->private;
|
|
const struct xt_table_info *private = t->private;
|
|
|
|
|
|
@@ -967,7 +969,7 @@ static int __do_replace(struct net *net, const char *name,
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
|
|
|
|
- t = try_then_request_module(xt_find_table_lock(net, NF_ARP, name),
|
|
|
|
|
|
+ t = try_then_request_module(xt_find_table_lock(net, NFPROTO_ARP, name),
|
|
"arptable_%s", name);
|
|
"arptable_%s", name);
|
|
if (!t || IS_ERR(t)) {
|
|
if (!t || IS_ERR(t)) {
|
|
ret = t ? PTR_ERR(t) : -ENOENT;
|
|
ret = t ? PTR_ERR(t) : -ENOENT;
|
|
@@ -1134,7 +1136,7 @@ static int do_add_counters(struct net *net, void __user *user, unsigned int len,
|
|
goto free;
|
|
goto free;
|
|
}
|
|
}
|
|
|
|
|
|
- t = xt_find_table_lock(net, NF_ARP, name);
|
|
|
|
|
|
+ t = xt_find_table_lock(net, NFPROTO_ARP, name);
|
|
if (!t || IS_ERR(t)) {
|
|
if (!t || IS_ERR(t)) {
|
|
ret = t ? PTR_ERR(t) : -ENOENT;
|
|
ret = t ? PTR_ERR(t) : -ENOENT;
|
|
goto free;
|
|
goto free;
|
|
@@ -1218,7 +1220,7 @@ check_compat_entry_size_and_hooks(struct compat_arpt_entry *e,
|
|
entry_offset = (void *)e - (void *)base;
|
|
entry_offset = (void *)e - (void *)base;
|
|
|
|
|
|
t = compat_arpt_get_target(e);
|
|
t = compat_arpt_get_target(e);
|
|
- target = try_then_request_module(xt_find_target(NF_ARP,
|
|
|
|
|
|
+ target = try_then_request_module(xt_find_target(NFPROTO_ARP,
|
|
t->u.user.name,
|
|
t->u.user.name,
|
|
t->u.user.revision),
|
|
t->u.user.revision),
|
|
"arpt_%s", t->u.user.name);
|
|
"arpt_%s", t->u.user.name);
|
|
@@ -1232,7 +1234,7 @@ check_compat_entry_size_and_hooks(struct compat_arpt_entry *e,
|
|
|
|
|
|
off += xt_compat_target_offset(target);
|
|
off += xt_compat_target_offset(target);
|
|
*size += off;
|
|
*size += off;
|
|
- ret = xt_compat_add_offset(NF_ARP, entry_offset, off);
|
|
|
|
|
|
+ ret = xt_compat_add_offset(NFPROTO_ARP, entry_offset, off);
|
|
if (ret)
|
|
if (ret)
|
|
goto release_target;
|
|
goto release_target;
|
|
|
|
|
|
@@ -1333,7 +1335,7 @@ static int translate_compat_table(const char *name,
|
|
|
|
|
|
duprintf("translate_compat_table: size %u\n", info->size);
|
|
duprintf("translate_compat_table: size %u\n", info->size);
|
|
j = 0;
|
|
j = 0;
|
|
- xt_compat_lock(NF_ARP);
|
|
|
|
|
|
+ xt_compat_lock(NFPROTO_ARP);
|
|
/* Walk through entries, checking offsets. */
|
|
/* Walk through entries, checking offsets. */
|
|
ret = COMPAT_ARPT_ENTRY_ITERATE(entry0, total_size,
|
|
ret = COMPAT_ARPT_ENTRY_ITERATE(entry0, total_size,
|
|
check_compat_entry_size_and_hooks,
|
|
check_compat_entry_size_and_hooks,
|
|
@@ -1383,8 +1385,8 @@ static int translate_compat_table(const char *name,
|
|
ret = COMPAT_ARPT_ENTRY_ITERATE(entry0, total_size,
|
|
ret = COMPAT_ARPT_ENTRY_ITERATE(entry0, total_size,
|
|
compat_copy_entry_from_user,
|
|
compat_copy_entry_from_user,
|
|
&pos, &size, name, newinfo, entry1);
|
|
&pos, &size, name, newinfo, entry1);
|
|
- xt_compat_flush_offsets(NF_ARP);
|
|
|
|
- xt_compat_unlock(NF_ARP);
|
|
|
|
|
|
+ xt_compat_flush_offsets(NFPROTO_ARP);
|
|
|
|
+ xt_compat_unlock(NFPROTO_ARP);
|
|
if (ret)
|
|
if (ret)
|
|
goto free_newinfo;
|
|
goto free_newinfo;
|
|
|
|
|
|
@@ -1420,8 +1422,8 @@ out:
|
|
COMPAT_ARPT_ENTRY_ITERATE(entry0, total_size, compat_release_entry, &j);
|
|
COMPAT_ARPT_ENTRY_ITERATE(entry0, total_size, compat_release_entry, &j);
|
|
return ret;
|
|
return ret;
|
|
out_unlock:
|
|
out_unlock:
|
|
- xt_compat_flush_offsets(NF_ARP);
|
|
|
|
- xt_compat_unlock(NF_ARP);
|
|
|
|
|
|
+ xt_compat_flush_offsets(NFPROTO_ARP);
|
|
|
|
+ xt_compat_unlock(NFPROTO_ARP);
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1607,8 +1609,8 @@ static int compat_get_entries(struct net *net,
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
- xt_compat_lock(NF_ARP);
|
|
|
|
- t = xt_find_table_lock(net, NF_ARP, get.name);
|
|
|
|
|
|
+ xt_compat_lock(NFPROTO_ARP);
|
|
|
|
+ t = xt_find_table_lock(net, NFPROTO_ARP, get.name);
|
|
if (t && !IS_ERR(t)) {
|
|
if (t && !IS_ERR(t)) {
|
|
const struct xt_table_info *private = t->private;
|
|
const struct xt_table_info *private = t->private;
|
|
struct xt_table_info info;
|
|
struct xt_table_info info;
|
|
@@ -1623,13 +1625,13 @@ static int compat_get_entries(struct net *net,
|
|
private->size, get.size);
|
|
private->size, get.size);
|
|
ret = -EAGAIN;
|
|
ret = -EAGAIN;
|
|
}
|
|
}
|
|
- xt_compat_flush_offsets(NF_ARP);
|
|
|
|
|
|
+ xt_compat_flush_offsets(NFPROTO_ARP);
|
|
module_put(t->me);
|
|
module_put(t->me);
|
|
xt_table_unlock(t);
|
|
xt_table_unlock(t);
|
|
} else
|
|
} else
|
|
ret = t ? PTR_ERR(t) : -ENOENT;
|
|
ret = t ? PTR_ERR(t) : -ENOENT;
|
|
|
|
|
|
- xt_compat_unlock(NF_ARP);
|
|
|
|
|
|
+ xt_compat_unlock(NFPROTO_ARP);
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1709,7 +1711,7 @@ static int do_arpt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
- try_then_request_module(xt_find_revision(NF_ARP, rev.name,
|
|
|
|
|
|
+ try_then_request_module(xt_find_revision(NFPROTO_ARP, rev.name,
|
|
rev.revision, 1, &ret),
|
|
rev.revision, 1, &ret),
|
|
"arpt_%s", rev.name);
|
|
"arpt_%s", rev.name);
|
|
break;
|
|
break;
|
|
@@ -1787,7 +1789,7 @@ void arpt_unregister_table(struct xt_table *table)
|
|
static struct xt_target arpt_standard_target __read_mostly = {
|
|
static struct xt_target arpt_standard_target __read_mostly = {
|
|
.name = ARPT_STANDARD_TARGET,
|
|
.name = ARPT_STANDARD_TARGET,
|
|
.targetsize = sizeof(int),
|
|
.targetsize = sizeof(int),
|
|
- .family = NF_ARP,
|
|
|
|
|
|
+ .family = NFPROTO_ARP,
|
|
#ifdef CONFIG_COMPAT
|
|
#ifdef CONFIG_COMPAT
|
|
.compatsize = sizeof(compat_int_t),
|
|
.compatsize = sizeof(compat_int_t),
|
|
.compat_from_user = compat_standard_from_user,
|
|
.compat_from_user = compat_standard_from_user,
|
|
@@ -1799,7 +1801,7 @@ static struct xt_target arpt_error_target __read_mostly = {
|
|
.name = ARPT_ERROR_TARGET,
|
|
.name = ARPT_ERROR_TARGET,
|
|
.target = arpt_error,
|
|
.target = arpt_error,
|
|
.targetsize = ARPT_FUNCTION_MAXNAMELEN,
|
|
.targetsize = ARPT_FUNCTION_MAXNAMELEN,
|
|
- .family = NF_ARP,
|
|
|
|
|
|
+ .family = NFPROTO_ARP,
|
|
};
|
|
};
|
|
|
|
|
|
static struct nf_sockopt_ops arpt_sockopts = {
|
|
static struct nf_sockopt_ops arpt_sockopts = {
|
|
@@ -1821,12 +1823,12 @@ static struct nf_sockopt_ops arpt_sockopts = {
|
|
|
|
|
|
static int __net_init arp_tables_net_init(struct net *net)
|
|
static int __net_init arp_tables_net_init(struct net *net)
|
|
{
|
|
{
|
|
- return xt_proto_init(net, NF_ARP);
|
|
|
|
|
|
+ return xt_proto_init(net, NFPROTO_ARP);
|
|
}
|
|
}
|
|
|
|
|
|
static void __net_exit arp_tables_net_exit(struct net *net)
|
|
static void __net_exit arp_tables_net_exit(struct net *net)
|
|
{
|
|
{
|
|
- xt_proto_fini(net, NF_ARP);
|
|
|
|
|
|
+ xt_proto_fini(net, NFPROTO_ARP);
|
|
}
|
|
}
|
|
|
|
|
|
static struct pernet_operations arp_tables_net_ops = {
|
|
static struct pernet_operations arp_tables_net_ops = {
|