// $Id$
//
// Copyright (C) 2007
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
-// Thorsten Horstmann <thorsten.horstmann@fokus.fraunhofer.de>
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+// Thorsten Horstmann <tho@berlios.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// Custom includes
#include "NetdeviceController.hh"
+#include "Protocols/Raw/MACAddress.hh"
#include "../Utils/auto_unit_test.hh"
#include <boost/test/test_tools.hpp>
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
-BOOST_AUTO_UNIT_TEST(NetdeviceController)
-{
-// senf::NetdeviceController ctrl ("eth0");
+BOOST_AUTO_UNIT_TEST(NetdeviceController) {
+
+ senf::NetdeviceController ctrl ("lo");
+ std::cout << "name: " << ctrl.interfaceName() << "\n";
+
+ senf::MACAddress oldAddr(ctrl.hardwareAddress());
+ int oldMTU = ctrl.mtu();
+
+ std::cout << "hw addr: " << oldAddr << "\n";
+ std::cout << "mtu: " << oldMTU << "\n";
+
+ if (getuid() != 0) {
+ BOOST_WARN_MESSAGE(false, "Cannot run some tests of senf::NetdeviceController as non-root user");
+ return;
+ }
+
+ ctrl.mtu(oldMTU - 16);
+ std::cout << "new mtu: " << ctrl.mtu() << "\n";
+ ctrl.mtu(oldMTU);
+
+ senf::MACAddress newAddr(senf::MACAddress::from_string("00:18:de:2e:ec:00"));
+ ctrl.hardwareAddress(newAddr);
+ std::cout << "new hw addr: " << ctrl.hardwareAddress() << "\n";
+ ctrl.hardwareAddress(oldAddr);
}
///////////////////////////////cc.e////////////////////////////////////////