diff options
author | Jan Engelhardt <jengelh@medozas.de> | 2009-07-10 12:55:11 -0400 |
---|---|---|
committer | Jan Engelhardt <jengelh@medozas.de> | 2010-03-25 10:02:19 -0400 |
commit | d2a7b6bad2c38e41eddb0b24d03627d9e7aa3f7b (patch) | |
tree | 826eb9d112029819aa44925346a55f887b1c3baf | |
parent | ff67e4e42bd178b1179c4d8e5c1fde18758ce84f (diff) |
netfilter: xtables: make use of xt_request_find_target
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
-rw-r--r-- | net/bridge/netfilter/ebtables.c | 13 | ||||
-rw-r--r-- | net/ipv4/netfilter/arp_tables.c | 20 | ||||
-rw-r--r-- | net/ipv4/netfilter/ip_tables.c | 20 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6_tables.c | 20 | ||||
-rw-r--r-- | net/netfilter/x_tables.c | 4 | ||||
-rw-r--r-- | net/sched/act_ipt.c | 4 |
6 files changed, 29 insertions, 52 deletions
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index 989d72cc8148..6d3b256d2f61 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c | |||
@@ -395,13 +395,9 @@ ebt_check_watcher(struct ebt_entry_watcher *w, struct xt_tgchk_param *par, | |||
395 | left - sizeof(struct ebt_entry_watcher) < w->watcher_size) | 395 | left - sizeof(struct ebt_entry_watcher) < w->watcher_size) |
396 | return -EINVAL; | 396 | return -EINVAL; |
397 | 397 | ||
398 | watcher = try_then_request_module( | 398 | watcher = xt_request_find_target(NFPROTO_BRIDGE, w->u.name, 0); |
399 | xt_find_target(NFPROTO_BRIDGE, w->u.name, 0), | ||
400 | "ebt_%s", w->u.name); | ||
401 | if (IS_ERR(watcher)) | 399 | if (IS_ERR(watcher)) |
402 | return PTR_ERR(watcher); | 400 | return PTR_ERR(watcher); |
403 | if (watcher == NULL) | ||
404 | return -ENOENT; | ||
405 | w->u.watcher = watcher; | 401 | w->u.watcher = watcher; |
406 | 402 | ||
407 | par->target = watcher; | 403 | par->target = watcher; |
@@ -714,15 +710,10 @@ ebt_check_entry(struct ebt_entry *e, struct net *net, | |||
714 | t = (struct ebt_entry_target *)(((char *)e) + e->target_offset); | 710 | t = (struct ebt_entry_target *)(((char *)e) + e->target_offset); |
715 | gap = e->next_offset - e->target_offset; | 711 | gap = e->next_offset - e->target_offset; |
716 | 712 | ||
717 | target = try_then_request_module( | 713 | target = xt_request_find_target(NFPROTO_BRIDGE, t->u.name, 0); |
718 | xt_find_target(NFPROTO_BRIDGE, t->u.name, 0), | ||
719 | "ebt_%s", t->u.name); | ||
720 | if (IS_ERR(target)) { | 714 | if (IS_ERR(target)) { |
721 | ret = PTR_ERR(target); | 715 | ret = PTR_ERR(target); |
722 | goto cleanup_watchers; | 716 | goto cleanup_watchers; |
723 | } else if (target == NULL) { | ||
724 | ret = -ENOENT; | ||
725 | goto cleanup_watchers; | ||
726 | } | 717 | } |
727 | 718 | ||
728 | t->u.target = target; | 719 | t->u.target = target; |
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index f07d77f65751..e8e363d90365 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c | |||
@@ -523,13 +523,11 @@ find_check_entry(struct arpt_entry *e, const char *name, unsigned int size) | |||
523 | return ret; | 523 | return ret; |
524 | 524 | ||
525 | t = arpt_get_target(e); | 525 | t = arpt_get_target(e); |
526 | target = try_then_request_module(xt_find_target(NFPROTO_ARP, | 526 | target = xt_request_find_target(NFPROTO_ARP, t->u.user.name, |
527 | t->u.user.name, | 527 | t->u.user.revision); |
528 | t->u.user.revision), | 528 | if (IS_ERR(target)) { |
529 | "arpt_%s", t->u.user.name); | ||
530 | if (IS_ERR(target) || !target) { | ||
531 | duprintf("find_check_entry: `%s' not found\n", t->u.user.name); | 529 | duprintf("find_check_entry: `%s' not found\n", t->u.user.name); |
532 | ret = target ? PTR_ERR(target) : -ENOENT; | 530 | ret = PTR_ERR(target); |
533 | goto out; | 531 | goto out; |
534 | } | 532 | } |
535 | t->u.kernel.target = target; | 533 | t->u.kernel.target = target; |
@@ -1252,14 +1250,12 @@ check_compat_entry_size_and_hooks(struct compat_arpt_entry *e, | |||
1252 | entry_offset = (void *)e - (void *)base; | 1250 | entry_offset = (void *)e - (void *)base; |
1253 | 1251 | ||
1254 | t = compat_arpt_get_target(e); | 1252 | t = compat_arpt_get_target(e); |
1255 | target = try_then_request_module(xt_find_target(NFPROTO_ARP, | 1253 | target = xt_request_find_target(NFPROTO_ARP, t->u.user.name, |
1256 | t->u.user.name, | 1254 | t->u.user.revision); |
1257 | t->u.user.revision), | 1255 | if (IS_ERR(target)) { |
1258 | "arpt_%s", t->u.user.name); | ||
1259 | if (IS_ERR(target) || !target) { | ||
1260 | duprintf("check_compat_entry_size_and_hooks: `%s' not found\n", | 1256 | duprintf("check_compat_entry_size_and_hooks: `%s' not found\n", |
1261 | t->u.user.name); | 1257 | t->u.user.name); |
1262 | ret = target ? PTR_ERR(target) : -ENOENT; | 1258 | ret = PTR_ERR(target); |
1263 | goto out; | 1259 | goto out; |
1264 | } | 1260 | } |
1265 | t->u.kernel.target = target; | 1261 | t->u.kernel.target = target; |
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c index 73fdf20263ed..e24ec48ee8cd 100644 --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c | |||
@@ -701,13 +701,11 @@ find_check_entry(struct ipt_entry *e, struct net *net, const char *name, | |||
701 | } | 701 | } |
702 | 702 | ||
703 | t = ipt_get_target(e); | 703 | t = ipt_get_target(e); |
704 | target = try_then_request_module(xt_find_target(AF_INET, | 704 | target = xt_request_find_target(NFPROTO_IPV4, t->u.user.name, |
705 | t->u.user.name, | 705 | t->u.user.revision); |
706 | t->u.user.revision), | 706 | if (IS_ERR(target)) { |
707 | "ipt_%s", t->u.user.name); | ||
708 | if (IS_ERR(target) || !target) { | ||
709 | duprintf("find_check_entry: `%s' not found\n", t->u.user.name); | 707 | duprintf("find_check_entry: `%s' not found\n", t->u.user.name); |
710 | ret = target ? PTR_ERR(target) : -ENOENT; | 708 | ret = PTR_ERR(target); |
711 | goto cleanup_matches; | 709 | goto cleanup_matches; |
712 | } | 710 | } |
713 | t->u.kernel.target = target; | 711 | t->u.kernel.target = target; |
@@ -1547,14 +1545,12 @@ check_compat_entry_size_and_hooks(struct compat_ipt_entry *e, | |||
1547 | } | 1545 | } |
1548 | 1546 | ||
1549 | t = compat_ipt_get_target(e); | 1547 | t = compat_ipt_get_target(e); |
1550 | target = try_then_request_module(xt_find_target(AF_INET, | 1548 | target = xt_request_find_target(NFPROTO_IPV4, t->u.user.name, |
1551 | t->u.user.name, | 1549 | t->u.user.revision); |
1552 | t->u.user.revision), | 1550 | if (IS_ERR(target)) { |
1553 | "ipt_%s", t->u.user.name); | ||
1554 | if (IS_ERR(target) || !target) { | ||
1555 | duprintf("check_compat_entry_size_and_hooks: `%s' not found\n", | 1551 | duprintf("check_compat_entry_size_and_hooks: `%s' not found\n", |
1556 | t->u.user.name); | 1552 | t->u.user.name); |
1557 | ret = target ? PTR_ERR(target) : -ENOENT; | 1553 | ret = PTR_ERR(target); |
1558 | goto release_matches; | 1554 | goto release_matches; |
1559 | } | 1555 | } |
1560 | t->u.kernel.target = target; | 1556 | t->u.kernel.target = target; |
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index 1b2414e03a34..842bef374dcc 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c | |||
@@ -733,13 +733,11 @@ find_check_entry(struct ip6t_entry *e, struct net *net, const char *name, | |||
733 | } | 733 | } |
734 | 734 | ||
735 | t = ip6t_get_target(e); | 735 | t = ip6t_get_target(e); |
736 | target = try_then_request_module(xt_find_target(AF_INET6, | 736 | target = xt_request_find_target(NFPROTO_IPV6, t->u.user.name, |
737 | t->u.user.name, | 737 | t->u.user.revision); |
738 | t->u.user.revision), | 738 | if (IS_ERR(target)) { |
739 | "ip6t_%s", t->u.user.name); | ||
740 | if (IS_ERR(target) || !target) { | ||
741 | duprintf("find_check_entry: `%s' not found\n", t->u.user.name); | 739 | duprintf("find_check_entry: `%s' not found\n", t->u.user.name); |
742 | ret = target ? PTR_ERR(target) : -ENOENT; | 740 | ret = PTR_ERR(target); |
743 | goto cleanup_matches; | 741 | goto cleanup_matches; |
744 | } | 742 | } |
745 | t->u.kernel.target = target; | 743 | t->u.kernel.target = target; |
@@ -1581,14 +1579,12 @@ check_compat_entry_size_and_hooks(struct compat_ip6t_entry *e, | |||
1581 | } | 1579 | } |
1582 | 1580 | ||
1583 | t = compat_ip6t_get_target(e); | 1581 | t = compat_ip6t_get_target(e); |
1584 | target = try_then_request_module(xt_find_target(AF_INET6, | 1582 | target = xt_request_find_target(NFPROTO_IPV6, t->u.user.name, |
1585 | t->u.user.name, | 1583 | t->u.user.revision); |
1586 | t->u.user.revision), | 1584 | if (IS_ERR(target)) { |
1587 | "ip6t_%s", t->u.user.name); | ||
1588 | if (IS_ERR(target) || !target) { | ||
1589 | duprintf("check_compat_entry_size_and_hooks: `%s' not found\n", | 1585 | duprintf("check_compat_entry_size_and_hooks: `%s' not found\n", |
1590 | t->u.user.name); | 1586 | t->u.user.name); |
1591 | ret = target ? PTR_ERR(target) : -ENOENT; | 1587 | ret = PTR_ERR(target); |
1592 | goto release_matches; | 1588 | goto release_matches; |
1593 | } | 1589 | } |
1594 | t->u.kernel.target = target; | 1590 | t->u.kernel.target = target; |
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index 9a248d4a877f..bf2806afd920 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c | |||
@@ -250,9 +250,7 @@ struct xt_target *xt_request_find_target(u8 af, const char *name, u8 revision) | |||
250 | 250 | ||
251 | target = try_then_request_module(xt_find_target(af, name, revision), | 251 | target = try_then_request_module(xt_find_target(af, name, revision), |
252 | "%st_%s", xt_prefix[af], name); | 252 | "%st_%s", xt_prefix[af], name); |
253 | if (IS_ERR(target) || !target) | 253 | return (target != NULL) ? target : ERR_PTR(-ENOENT); |
254 | return NULL; | ||
255 | return target; | ||
256 | } | 254 | } |
257 | EXPORT_SYMBOL_GPL(xt_request_find_target); | 255 | EXPORT_SYMBOL_GPL(xt_request_find_target); |
258 | 256 | ||
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c index 082c520b0def..b9f79c251d75 100644 --- a/net/sched/act_ipt.c +++ b/net/sched/act_ipt.c | |||
@@ -46,8 +46,8 @@ static int ipt_init_target(struct ipt_entry_target *t, char *table, unsigned int | |||
46 | 46 | ||
47 | target = xt_request_find_target(AF_INET, t->u.user.name, | 47 | target = xt_request_find_target(AF_INET, t->u.user.name, |
48 | t->u.user.revision); | 48 | t->u.user.revision); |
49 | if (!target) | 49 | if (IS_ERR(target)) |
50 | return -ENOENT; | 50 | return PTR_ERR(target); |
51 | 51 | ||
52 | t->u.kernel.target = target; | 52 | t->u.kernel.target = target; |
53 | par.table = table; | 53 | par.table = table; |