Abstract class for network support - #149
Conversation
Pull all libpcap code out of the Tulip emulator and place it into a "pcap" implementation. Also add a "tap" implementation that can work on Linux and *BSD. The initial patch was taken from lenticularis39/axpbox#124 and, afaict, was created by Claude AI. This is tested to work on Linux with a bridge. Need to test is on some BSD, and the pcap code is untested right now.
Added NetworkBackend.cpp and NetworkPcap.cpp to project.
|
We'll see if that lets it compile, then once I have it locally after I validate it works, I'll do the full VS proj file fixups as a separate commit to deal with the IDE views/filters etc. |
|
" Gotta love it. :) Yes, the totally relevant messages above! Hah. I'll figure that part out. |
|
Ah, I see! NIC config needs to specify a type now. I think I'll default it to pcap out of the box as that's what everyone's used to so config changes/confusion aren't needed. |
|
Alright, the pcap side looks good @jbglaw - this looks ready to go pretty much. Tested out all nice and fine. With the pcap default modification I made, no existing configs will need modification, so that's good there. Do you know if the TAP code is OS specific? I know qemu has separate TAP backend code for some kind of generic (i think? it's just tap.c) and AIX, BSD, Haiku, Linux, Win32, and Solaris (in tap-OS.c variants). tap-win32.c compiles fine without tap.c so I'm kind of unclear on that (not a side of qemu I've ever dug into) The build failures that remain were just workflow fetch errors, so nothing to worry about there. |
|
The BSDs and Linux are almost identical by just Solaris IIRC has |
|
@jbglaw Oh, I only asked so I know what to potentially write or document about, as long as this works for both, that's good enough. When I get to adding solaris and AIX support, I'll handle all that myself, I have the testing resources right next to me ;) |
|
Claude weighing in (Opus 5 this time — the WTINT PR was Fable; Scott is posting this for me) — You asked for a BSD tester for this. We ran it on FreeBSD 15.1 amd64 (razrez, a Proxmox guest) against an OpenVMS Alpha 8.4 guest, on the
One real bug while we were in there, in char *adapter = cfg->get_text_value("adapter");
const char *tap_name = adapter ? adapter : "tap0";
if (!tap_open(devid_string, adapter)) // <-- passes adapter, not tap_name
Also worth a line in the docs: Happy to test anything else on FreeBSD; it seems to be the platform with the fewest eyes on it. |
|
huh? We already knew it worked on BSD. I had just asked for clarification about the new code if it needed to be noted or documented that it behaved differently or not, we didn't need any testing or anything - that's why this is closed and complete. |
Pull all libpcap code out of the Tulip emulator and place it into a "pcap" implementation. Also add a "tap" implementation that can work on Linux and *BSD.
The initial patch was taken from lenticularis39/axpbox#124
and, afaict, was created by Claude AI.
This is tested to work on Linux with a bridge. Need to test is on some BSD,
and the pcap code is untested right now.