aboutsummaryrefslogtreecommitdiffstats
path: root/pingu_conf.c
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-09-21 09:19:30 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2011-09-21 09:19:30 +0200
commit20cbd15c9eb521c6ca21d446b5cdf060df4eb169 (patch)
tree0440b2baf8e5ef6d561ef3bccfa3d2ad398ae5f8 /pingu_conf.c
parent50d9faf2d2c5ddcf9a0bd6591d73d4e45d09641b (diff)
downloadpingu-20cbd15c9eb521c6ca21d446b5cdf060df4eb169.tar.bz2
pingu-20cbd15c9eb521c6ca21d446b5cdf060df4eb169.tar.xz
pingu_iface: only load-balance if 2 or more interfaces are configured for it
We should not try load-balance at all if there are only 1 or less interfaces configured with "load-balance"
Diffstat (limited to 'pingu_conf.c')
-rw-r--r--pingu_conf.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/pingu_conf.c b/pingu_conf.c
index 9a63aaf..30dec9a 100644
--- a/pingu_conf.c
+++ b/pingu_conf.c
@@ -131,16 +131,16 @@ static int pingu_conf_read_iface(struct pingu_conf *conf, char *ifname)
if (strcmp(key, "route-table") == 0) {
pingu_iface_set_route_table(iface, atoi(value));
} else if (strcmp(key, "load-balance") == 0) {
- iface->balance = 1;
+ int weight = 0;
if (value != NULL) {
- iface->balance_weight = atoi(value);
- if (iface->balance_weight <= 0 || iface->balance_weight > 256) {
+ weight = atoi(value);
+ if (weight <= 0 || weight > 256) {
log_error("Invalid load-balance weight %i on line %i",
- iface->balance_weight,
- conf->lineno);
+ weight, conf->lineno);
return -1;
}
}
+ pingu_iface_set_balance(iface, weight);
} else {
log_error("Unknown keyword '%s' on line %i", key,
conf->lineno);