Commit 5be5e6a6 authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰
Browse files

[1239] lo/lo0 interface detection fix in DHCPv4/DHCPv6 server tests.

parent e722aee2
...@@ -56,9 +56,13 @@ public: ...@@ -56,9 +56,13 @@ public:
class Dhcpv4SrvTest : public ::testing::Test { class Dhcpv4SrvTest : public ::testing::Test {
public: public:
Dhcpv4SrvTest() { Dhcpv4SrvTest() {
unlink(INTERFACE_FILE); unlink(INTERFACE_FILE);
fstream fakeifaces(INTERFACE_FILE, ios::out|ios::trunc); fstream fakeifaces(INTERFACE_FILE, ios::out|ios::trunc);
fakeifaces << "lo ::1"; if (if_nametoindex("lo")>0) {
fakeifaces << "lo ::1";
} else if (if_nametoindex("lo0")>0) {
fakeifaces << "lo0 ::1";
}
fakeifaces.close(); fakeifaces.close();
} }
......
...@@ -53,9 +53,12 @@ public: ...@@ -53,9 +53,12 @@ public:
Dhcpv6SrvTest() { Dhcpv6SrvTest() {
unlink(INTERFACE_FILE); unlink(INTERFACE_FILE);
fstream fakeifaces(INTERFACE_FILE, ios::out|ios::trunc); fstream fakeifaces(INTERFACE_FILE, ios::out|ios::trunc);
fakeifaces << "lo ::1"; if (if_nametoindex("lo")>0) {
fakeifaces << "lo ::1";
} else if (if_nametoindex("lo0")>0) {
fakeifaces << "lo0 ::1";
}
fakeifaces.close(); fakeifaces.close();
} }
~Dhcpv6SrvTest() { ~Dhcpv6SrvTest() {
unlink(INTERFACE_FILE); unlink(INTERFACE_FILE);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment