summaryrefslogtreecommitdiff
path: root/src/dev/net/etherswitch.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/dev/net/etherswitch.cc')
-rw-r--r--src/dev/net/etherswitch.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/dev/net/etherswitch.cc b/src/dev/net/etherswitch.cc
index c03b59435..99e0621a2 100644
--- a/src/dev/net/etherswitch.cc
+++ b/src/dev/net/etherswitch.cc
@@ -62,16 +62,15 @@ EtherSwitch::~EtherSwitch()
interfaces.clear();
}
-EtherInt*
-EtherSwitch::getEthPort(const std::string &if_name, int idx)
+Port &
+EtherSwitch::getPort(const std::string &if_name, PortID idx)
{
- if (idx < 0 || idx >= interfaces.size())
- return nullptr;
-
- Interface *interface = interfaces.at(idx);
- panic_if(interface->getPeer(), "interface already connected\n");
+ if (if_name == "interface") {
+ panic_if(idx < 0 || idx >= interfaces.size(), "index out of bounds");
+ return *interfaces.at(idx);
+ }
- return interface;
+ return SimObject::getPort(if_name, idx);
}
bool