summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorRyan Houdek <Sonicadvance1@gmail.com>2016-01-01 02:51:31 -0600
committerRyan Houdek <Sonicadvance1@gmail.com>2016-01-01 02:51:31 -0600
commit4e22bab71ded5ba6cf8125f98c96a9f08f70208f (patch)
tree473212906ba62b5d61747d7214d64e19a11653cb /Source/Core
parent787bf156f02c61e0812e8afe673d3bc670dfe717 (diff)
Support multiple bridge interfaces in Linux.
This allows you to run multiple instances of Dolphin that touch the BBA (Up to a 32 interface limit)
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/HW/BBA-TAP/TAP_Unix.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/Source/Core/Core/HW/BBA-TAP/TAP_Unix.cpp b/Source/Core/Core/HW/BBA-TAP/TAP_Unix.cpp
index 0c8de9f20f..f13103196d 100644
--- a/Source/Core/Core/HW/BBA-TAP/TAP_Unix.cpp
+++ b/Source/Core/Core/HW/BBA-TAP/TAP_Unix.cpp
@@ -45,15 +45,26 @@ bool CEXIETHERNET::Activate()
memset(&ifr, 0, sizeof(ifr));
ifr.ifr_flags = IFF_TAP | IFF_NO_PI | IFF_ONE_QUEUE;
- strncpy(ifr.ifr_name, "Dolphin", IFNAMSIZ);
-
- int err;
- if ((err = ioctl(fd, TUNSETIFF, (void*)&ifr)) < 0)
+ const int MAX_INTERFACES = 32;
+ for (int i = 0; i < MAX_INTERFACES; ++i)
{
- close(fd);
- fd = -1;
- ERROR_LOG(SP1, "TUNSETIFF failed: err=%d", err);
- return false;
+ strncpy(ifr.ifr_name, StringFromFormat("Dolphin%d", i).c_str(), IFNAMSIZ);
+
+ int err;
+ if ((err = ioctl(fd, TUNSETIFF, (void*)&ifr)) < 0)
+ {
+ if (i == (MAX_INTERFACES - 1))
+ {
+ close(fd);
+ fd = -1;
+ ERROR_LOG(SP1, "TUNSETIFF failed: Interface=%s err=%d", ifr.ifr_name, err);
+ return false;
+ }
+ }
+ else
+ {
+ break;
+ }
}
ioctl(fd, TUNSETNOCSUM, 1);