]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5093] Stop createLinkLayerId at first Ethernet like + en3 -> en7
authorFrancis Dupont <fdupont@isc.org>
Thu, 22 Dec 2016 09:55:43 +0000 (10:55 +0100)
committerTomek Mrugalski <tomasz@isc.org>
Mon, 9 Jan 2017 17:17:52 +0000 (18:17 +0100)
src/lib/dhcp/duid_factory.cc
src/lib/dhcp/tests/iface_mgr_unittest.cc

index b5563f07c677e9c8ea0156c9dec20bab834829cd..bce45110d2b718ea49630d525d2ae335ef84ec1b 100644 (file)
@@ -285,6 +285,12 @@ DUIDFactory::createLinkLayerId(std::vector<uint8_t>& identifier,
         // Assign link layer address and type.
         identifier.assign(iface->getMac(), iface->getMac() + iface->getMacLen());
         htype = iface->getHWType();
+
+        // If it looks like an Ethernet interface we should be happy
+        if ((htype == static_cast<uint16_t>(HTYPE_ETHER)) &&
+            (iface->getMacLen() == 6)) {
+            break;
+        }
     }
 
     // We failed to find an interface which link layer address could be
index 5136a10ed3af006135ed050f9b8f6ce151bdf2d5..6276857d8eb9023b87904f418214ae30b93b776b 100644 (file)
@@ -641,10 +641,10 @@ TEST_F(IfaceMgrTest, getIface) {
     // Interface name, ifindex
     IfacePtr iface1(new Iface("lo1", 100));
     IfacePtr iface2(new Iface("eth9", 101));
-    IfacePtr iface3(new Iface("en3", 102));
+    IfacePtr iface3(new Iface("en7", 102));
     IfacePtr iface4(new Iface("e1000g4", 103));
     cout << "This test assumes that there are less than 100 network interfaces"
-         << " in the tested system and there are no lo1, eth9, en3, e1000g4"
+         << " in the tested system and there are no lo1, eth9, en7, e1000g4"
          << " or wifi15 interfaces present." << endl;
 
     // Note: real interfaces may be detected as well
@@ -666,7 +666,7 @@ TEST_F(IfaceMgrTest, getIface) {
     IfacePtr tmp = ifacemgr->getIface(102);
     ASSERT_TRUE(tmp);
 
-    EXPECT_EQ("en3", tmp->getName());
+    EXPECT_EQ("en7", tmp->getName());
     EXPECT_EQ(102, tmp->getIndex());
 
     // Check that interface can be retrieved by name