diff options
author | Jan Engelhardt <jengelh@medozas.de> | 2010-03-19 12:32:59 -0400 |
---|---|---|
committer | Jan Engelhardt <jengelh@medozas.de> | 2010-03-25 11:56:09 -0400 |
commit | 4a5a5c73b7cfee46a0b1411903cfa0dea532deec (patch) | |
tree | 3f7ef0def4adf3a01e15ab3a2a7231967b87bfee /net/ipv4 | |
parent | d6b00a5345ce4e86e8b00a88bb84a2c0c1f69ddc (diff) |
netfilter: xtables: slightly better error reporting
When extended status codes are available, such as ENOMEM on failed
allocations, or subsequent functions (e.g. nf_ct_get_l3proto), passing
them up to userspace seems like a good idea compared to just always
EINVAL.
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/netfilter/ipt_CLUSTERIP.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c index 1302de2ae0a..1faf5fa06ac 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c | |||
@@ -351,8 +351,8 @@ static int clusterip_tg_check(const struct xt_tgchk_param *par) | |||
351 | { | 351 | { |
352 | struct ipt_clusterip_tgt_info *cipinfo = par->targinfo; | 352 | struct ipt_clusterip_tgt_info *cipinfo = par->targinfo; |
353 | const struct ipt_entry *e = par->entryinfo; | 353 | const struct ipt_entry *e = par->entryinfo; |
354 | |||
355 | struct clusterip_config *config; | 354 | struct clusterip_config *config; |
355 | int ret; | ||
356 | 356 | ||
357 | if (cipinfo->hash_mode != CLUSTERIP_HASHMODE_SIP && | 357 | if (cipinfo->hash_mode != CLUSTERIP_HASHMODE_SIP && |
358 | cipinfo->hash_mode != CLUSTERIP_HASHMODE_SIP_SPT && | 358 | cipinfo->hash_mode != CLUSTERIP_HASHMODE_SIP_SPT && |
@@ -387,7 +387,7 @@ static int clusterip_tg_check(const struct xt_tgchk_param *par) | |||
387 | if (!dev) { | 387 | if (!dev) { |
388 | pr_info("no such interface %s\n", | 388 | pr_info("no such interface %s\n", |
389 | e->ip.iniface); | 389 | e->ip.iniface); |
390 | return -EINVAL; | 390 | return -ENOENT; |
391 | } | 391 | } |
392 | 392 | ||
393 | config = clusterip_config_init(cipinfo, | 393 | config = clusterip_config_init(cipinfo, |
@@ -395,17 +395,18 @@ static int clusterip_tg_check(const struct xt_tgchk_param *par) | |||
395 | if (!config) { | 395 | if (!config) { |
396 | pr_info("cannot allocate config\n"); | 396 | pr_info("cannot allocate config\n"); |
397 | dev_put(dev); | 397 | dev_put(dev); |
398 | return -EINVAL; | 398 | return -ENOMEM; |
399 | } | 399 | } |
400 | dev_mc_add(config->dev,config->clustermac, ETH_ALEN, 0); | 400 | dev_mc_add(config->dev,config->clustermac, ETH_ALEN, 0); |
401 | } | 401 | } |
402 | } | 402 | } |
403 | cipinfo->config = config; | 403 | cipinfo->config = config; |
404 | 404 | ||
405 | if (nf_ct_l3proto_try_module_get(par->family) < 0) { | 405 | ret = nf_ct_l3proto_try_module_get(par->family); |
406 | if (ret < 0) { | ||
406 | pr_info("cannot load conntrack support for proto=%u\n", | 407 | pr_info("cannot load conntrack support for proto=%u\n", |
407 | par->family); | 408 | par->family); |
408 | return -EINVAL; | 409 | return ret; |
409 | } | 410 | } |
410 | 411 | ||
411 | return 0; | 412 | return 0; |