summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorslioch <slioch@eng-140.vyatta.com>2009-04-30 12:56:11 -0700
committerslioch <slioch@eng-140.vyatta.com>2009-04-30 12:56:11 -0700
commit6d552072bdd2f168bd10e09a0bcfd435358ee671 (patch)
tree89e50e31fe841ab0a874911fa3b58d6bff998822 /src
parent04223f99677cb85c5cdcca9b2b56877756cd566f (diff)
downloadvyatta-wanloadbalance-6d552072bdd2f168bd10e09a0bcfd435358ee671.tar.gz
vyatta-wanloadbalance-6d552072bdd2f168bd10e09a0bcfd435358ee671.zip
On socket bind error return and do not attempt to send icmp packet
fix for bug 4333. Found by Gregor Jurgele.
Diffstat (limited to 'src')
-rw-r--r--src/lbpathtest.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lbpathtest.cc b/src/lbpathtest.cc
index a8ffbce..df29921 100644
--- a/src/lbpathtest.cc
+++ b/src/lbpathtest.cc
@@ -195,7 +195,10 @@ LBPathTest::send(const string &iface, const string &target_addr, int packet_id)
}
// bind a socket to a device name (might not work on all systems):
- setsockopt(_send_sock, SOL_SOCKET, SO_BINDTODEVICE, iface.c_str(), iface.size());
+ if (setsockopt(_send_sock, SOL_SOCKET, SO_BINDTODEVICE, iface.c_str(), iface.size()) != 0) {
+ syslog(LOG_ERR, "wan_lb: failure to bind to interface: %s", iface.c_str());
+ return; //will allow the test to time out then
+ }
//convert target_addr to ip addr
struct hostent *h = gethostbyname(target_addr.c_str());