From 20cbd15c9eb521c6ca21d446b5cdf060df4eb169 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Wed, 21 Sep 2011 09:19:30 +0200 Subject: 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" --- pingu_conf.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'pingu_conf.c') 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); -- cgit v1.2.3