diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2011-08-16 16:47:15 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2011-08-16 16:59:56 +0200 |
commit | a6a0c88823b42e4c789b156106d64002b387d291 (patch) | |
tree | 82bda92f338e527d3b5eba25fbebc3a2574bc43b /pingu_conf.c | |
parent | 04fefe45f6223381df6fbcb7ee7cb72742552fd7 (diff) | |
download | pingu-a6a0c88823b42e4c789b156106d64002b387d291.tar.bz2 pingu-a6a0c88823b42e4c789b156106d64002b387d291.tar.xz |
pingu: add config option 'load-balance'
Add a config option to tell pingu that we want the interface to be
load balanced. We also have an optional value to tell the weight.
Diffstat (limited to 'pingu_conf.c')
-rw-r--r-- | pingu_conf.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pingu_conf.c b/pingu_conf.c index e9e3b60..9a63aaf 100644 --- a/pingu_conf.c +++ b/pingu_conf.c @@ -130,6 +130,17 @@ static int pingu_conf_read_iface(struct pingu_conf *conf, char *ifname) break; if (strcmp(key, "route-table") == 0) { pingu_iface_set_route_table(iface, atoi(value)); + } else if (strcmp(key, "load-balance") == 0) { + iface->balance = 1; + if (value != NULL) { + iface->balance_weight = atoi(value); + if (iface->balance_weight <= 0 || iface->balance_weight > 256) { + log_error("Invalid load-balance weight %i on line %i", + iface->balance_weight, + conf->lineno); + return -1; + } + } } else { log_error("Unknown keyword '%s' on line %i", key, conf->lineno); |