summaryrefslogtreecommitdiff
path: root/src/lbdecision.cc
diff options
context:
space:
mode:
authorslioch <slioch@eng-140.vyatta.com>2009-07-08 11:14:08 -0700
committerslioch <slioch@eng-140.vyatta.com>2009-07-08 11:20:51 -0700
commite04a3602d2be984a8ec71bf8b69d9b56665d1333 (patch)
treefd7ec7847f8ec754dd9a72ce268eb74bd7a61625 /src/lbdecision.cc
parent8fd0204c883ca175c754d96b83433f084a7cc2ee (diff)
downloadvyatta-wanloadbalance-e04a3602d2be984a8ec71bf8b69d9b56665d1333.tar.gz
vyatta-wanloadbalance-e04a3602d2be984a8ec71bf8b69d9b56665d1333.zip
fix for bug 4699. Note that dhcp nexthop detection was also broken due to changes in the location of the dhcp client information. this was also
fixed.
Diffstat (limited to 'src/lbdecision.cc')
-rw-r--r--src/lbdecision.cc29
1 files changed, 6 insertions, 23 deletions
diff --git a/src/lbdecision.cc b/src/lbdecision.cc
index 10fa12c..1c320ce 100644
--- a/src/lbdecision.cc
+++ b/src/lbdecision.cc
@@ -153,8 +153,9 @@ if so then this stuff goes here!
// insert_default(string("ip route replace table ") + buf + " default dev " + iface + " via " + iter->second._nexthop, ct);
//need to force the entry on restart as the configuration may have changed.
if (iter->second._nexthop == "dhcp") {
- string nexthop = fetch_iface_nexthop(iface);
- execute(string("ip route replace table ") + buf + " default dev " + iface + " via " + nexthop, stdout);
+ if (iter->second._dhcp_nexthop.empty() == false) {
+ execute(string("ip route replace table ") + buf + " default dev " + iface + " via " + iter->second._dhcp_nexthop, stdout);
+ }
}
else {
execute(string("ip route replace table ") + buf + " default dev " + iface + " via " + iter->second._nexthop, stdout);
@@ -196,8 +197,9 @@ LBDecision::update_paths(LBData &lbdata)
//now let's update the nexthop here in the route table
if (iter->second._nexthop == "dhcp") {
- string nexthop = fetch_iface_nexthop(iface);
- insert_default(string("ip route replace table ") + buf + " default dev " + iface + " via " + nexthop, iter->second._interface_index);
+ if (iter->second._dhcp_nexthop.empty() == false) {
+ insert_default(string("ip route replace table ") + buf + " default dev " + iface + " via " + iter->second._dhcp_nexthop, iter->second._interface_index);
+ }
}
else {
insert_default(string("ip route replace table ") + buf + " default dev " + iface + " via " + iter->second._nexthop, iter->second._interface_index);
@@ -589,25 +591,6 @@ LBDecision::insert_default(string cmd, int table)
}
/**
- * currently only reads the nexthop as maintained by the dhcp client
- **/
-string
-LBDecision::fetch_iface_nexthop(const string &iface)
-{
- string file("/var/run/vyatta/dhclient/dhclient-script-router-"+iface);
- FILE *fp = fopen(file.c_str(),"r");
- if (fp) {
- char str[1025];
- int ct = 0;
- if ((ct = fread(str, 1, 1024, fp)) > 0) {
- return string(str);
- }
- fclose(fp);
- }
- return string("");
-}
-
-/**
* Fetch interface configuration
**/
string