pcsx2 icon indicating copy to clipboard operation
pcsx2 copied to clipboard

DEV9: MAC address fetch implementation for MacOS/FreeBSD

Open TellowKrinkle opened this issue 2 years ago • 10 comments

Description of Changes

Adds a function to read MAC addresses on macOS

With this, I can successfully ping my emulated PS2 with adapters in bridge mode, but not switched. Better than nothing at least.

Rationale behind Changes

Networking on macOS

Suggested Testing Steps

Test networking things on macOS. I've only tested pinging the ps2sdk's tcpip-basic sample code.

Note: I was unable to ping from the computer running PCSX2, but other devices on the network worked fine.

Note: You'll need write access to the /dev/bpf* system files. If you have wireshark (or homebrew's wireshark-chmodbpf package) installed, that should handle it for you. Otherwise, chgrp/chmod those so the user you're running PCSX2 as has access.

@kokroo

TellowKrinkle avatar Sep 11 '22 08:09 TellowKrinkle

Description of Changes

Adds a function to read MAC addresses on macOS

With this, I can successfully ping my emulated PS2 with adapters in bridge mode, but not switched. Better than nothing at least.

Rationale behind Changes

Networking on macOS

Suggested Testing Steps

Test networking things on macOS. I've only tested pinging the ps2sdk's tcpip-basic sample code.

Note: I was unable to ping from the computer running PCSX2, but other devices on the network worked fine.

Note: You'll need write access to the /dev/bpf* system files. If you have wireshark (or homebrew's wireshark-chmodbpf package) installed, that should handle it for you. Otherwise, chgrp/chmod those so the user you're running PCSX2 as has access.

@kokroo

Sweet, for some reason I cannot see this in my GitHub notifications. How may I help you with the testing and development, and how do I send you money for a pizza and beers?

Cheers!

kokroo avatar Sep 14 '22 20:09 kokroo

How may I help you with the testing and development

Can you test this PR with some actual online games and see if it works there?

Check the log viewer and make sure it says it successfully opened the interface before saying it doesn't work. If it fails it'll be printed in red in the log.

TellowKrinkle avatar Sep 14 '22 20:09 TellowKrinkle

Didn't think that failing to get the mac address would block pcap from working, seems I forgot it was needed for a pcap filter used in switched mode (and also a missing check that the getting the mac address succeeded)

I'll be interested to see if that was all that was needed to get network working on macOS

TheLastRar avatar Sep 15 '22 15:09 TheLastRar

Screen Shot 2022-09-15 at 11 36 45 PM

@tellowkrinkle No success. I am able to go to the last stage of the network configurator. I added the custom DNS entry "45.7.228.197" from ps2online.com and it shows the above. I can confirm the above server is working, and also accessible from my machine. My actual PS2 is on the same network and connects to this custom DNS server just fine.

Have I configured something wrong in the settings? If you want, you can see my screen on Teamviewer and experiment.

kokroo avatar Sep 15 '22 18:09 kokroo

@tellowkrinkle Okay, so I changed the settings to this (sockets, auto), and it worked! I have been able to enter the lobby! There are no players online on this game, so haven't been able to test multiplayer, but I guess it'll work. I will report back when I try multiplayer on another game. Cheers for this! Can I buy you a pizza now?

Screen Shot 2022-09-16 at 1 37 51 AM

kokroo avatar Sep 15 '22 20:09 kokroo

@tellowkrinkle So with sockets, I am able to enter lobbies on NFS Underground and Midnight Club 3 and see other games too. Whenever I try to join them, it fails. I have no other games to test online functionality with, but according to what AirGamer said on discord, PCAP Bridged mode will be needed for full functionality since socket connections don't have complete ethernet frames.

kokroo avatar Sep 16 '22 04:09 kokroo

On Underground 2 I am getting this screen:

Screenshot 2022-09-16 at 21 00 30

ppamorim avatar Sep 16 '22 20:09 ppamorim

ppamorim

@ppamorim Is this PCAP Bridged mode or Sockets?

kokroo avatar Sep 19 '22 02:09 kokroo

ppamorim

@ppamorim Is this PCAP Bridged mode or Sockets?

I tried both. No change.

ppamorim avatar Sep 19 '22 02:09 ppamorim

ppamorim

@ppamorim Is this PCAP Bridged mode or Sockets?

I tried both. No change.

What are your settings?

TheLastRar avatar Sep 20 '22 09:09 TheLastRar

ppamorim

@ppamorim Is this PCAP Bridged mode or Sockets?

I tried both. No change.

What are your settings?

I think they used the ps2online.com DNS.

I can confirm that in over 3 games that I own that work with that server, all of them allow me to get to the lobby, and see rooms/lobbies/matches, but it never lets me enter.

This only works with Sockets. PCAP bridged mode doesn't even allow me to go online. The only improvement I see over the previous versions of PCSX2, is that network configuration mode inside the emulator didn't even show the PS2 Network adapter in older builds, but now it does show that.

kokroo avatar Sep 25 '22 08:09 kokroo

Should we close this if not being worked on?

kokroo avatar Oct 24 '22 21:10 kokroo

@tellowkrinkle Hello, is there any way I could help you with this feature? I am available for testing any builds against the online games I possess.

kokroo avatar Nov 08 '22 20:11 kokroo

Hello @TellowKrinkle , any chance of rebasing or resuming this work?

Cheers

fjtrujy avatar Dec 21 '22 23:12 fjtrujy

Hello @TellowKrinkle , any chance of rebasing or resuming this work?

Cheers

I think no one is working on this right now. I tried to take a crack at it but looks like it's beyond my capabilities. It's quite unfortunate since we do have online PS2 servers these days, but Mac users cannot join them :(

I hope somebody capable takes this up in the future if they can contribute their time. Wishing for the best!

kokroo avatar Jan 02 '23 17:01 kokroo

I hope somebody capable takes this up in the future if they can contribute their time. Wishing for the best!

Me wishes the best too. We need more improvements for mac.

Uzarkis avatar Oct 25 '23 00:10 Uzarkis

First of all, thank you for working on and making PCSX2, it's really great to have game emulation on a computer.

After installing on macOS, I got this scary warning in Little Snitch with the Endpoint Security System Extension installed

PCSX2_bpf0

and I found this thread. According to Little Snitch firewall documentation about the Berkeley Packet Filter:

BPF allows injection of data packets at the network interface. This means that a (privileged) app which opens a BPF device can send any data packet to any destination. The packet is injected directly at the network interface layer, circumventing all firewalls.

I even have the automatic update check disabled, and this throws up a scary warning in Little Snitch

(this only seems to happen after opening the PCSX2 settings menu window the first time after launching the app)

after running sudo opensnoop -n PCSX2 I saw that PCSX2 tried to access both /dev/bpf and /dev/bpf0

using macOS Big Sur 11.7.10 PCSX2-v1.7.5637.app

Is there a way of making networking work without this bpf access? Thanks again for making PCSX2

checktext00 avatar Mar 24 '24 08:03 checktext00

Is there a way of making networking work without this bpf access?

Only the (not currently working) pcap-based backends should require bpf access

If you're getting that warning without a pcap adapter enabled, that's a bug and you can report it in a separate issue

TellowKrinkle avatar Mar 25 '24 04:03 TellowKrinkle

Is there a way of making networking work without this bpf access?

Only the (not currently working) pcap-based backends should require bpf access

If you're getting that warning without a pcap adapter enabled, that's a bug and you can report it in a separate issue

Ok, I don't think I have a pcap adapter enabled as I don't really know what that is, I have made a new issue here with some extra info at the bottom

checktext00 avatar Apr 16 '24 13:04 checktext00

I believe this pr can be closed now that #10937 is merged, which added the same functionality

TheLastRar avatar Apr 29 '24 15:04 TheLastRar

I believe this pr can be closed now that #10937 is merged, which added the same functionality

I was actually double checking it, but I saw how this PR was also changing other files, not sure if it is because it was a legacy implementation

fjtrujy avatar Apr 29 '24 15:04 fjtrujy

I believe this pr can be closed now that #10937 is merged, which added the same functionality

I was actually double checking it, but I saw how this PR was also changing other files, not sure if it is because it was a legacy implementation

That was mostly because the code for getting the mac address was duplicated over different files. That code was unified into AdapterUtils sometime between this pr and yours

TheLastRar avatar Apr 29 '24 15:04 TheLastRar

Aight gonna close if it's already integrated.

lightningterror avatar Apr 29 '24 15:04 lightningterror

Does this bring us a step closer to online play on PCSX2 for macOS? Thanks!

kokroo avatar May 02 '24 05:05 kokroo