mirror of https://github.com/PCSX2/pcsx2.git
DEV9: Prefix PCAP log messages
This commit is contained in:
parent
4ad1355af3
commit
c68d31f8f0
|
@ -100,7 +100,7 @@ bool load_pcap()
|
|||
if (fp_##name == nullptr) \
|
||||
{ \
|
||||
FreeLibrary(hpcap); \
|
||||
Console.Error("DEV9: %s not found", #name); \
|
||||
Console.Error("DEV9: PCAP: %s not found", #name); \
|
||||
hpcap = nullptr; \
|
||||
return false; \
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ PCAPAdapter::PCAPAdapter()
|
|||
|
||||
if (!InitPCAP(pcapAdapter, switched))
|
||||
{
|
||||
Console.Error("DEV9: Can't open Device '%s'", EmuConfig.DEV9.EthDevice.c_str());
|
||||
Console.Error("DEV9: PCAP: Can't open Device '%s'", EmuConfig.DEV9.EthDevice.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ PCAPAdapter::PCAPAdapter()
|
|||
if (foundAdapter)
|
||||
adMAC = AdapterUtils::GetAdapterMAC(&adapter);
|
||||
else
|
||||
Console.Error("DEV9: Failed to get adapter information");
|
||||
Console.Error("DEV9: PCAP: Failed to get adapter information");
|
||||
|
||||
if (adMAC.has_value())
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ PCAPAdapter::PCAPAdapter()
|
|||
}
|
||||
else
|
||||
{
|
||||
Console.Error("DEV9: Failed to get MAC address for adapter");
|
||||
Console.Error("DEV9: PCAP: Failed to get MAC address for adapter");
|
||||
pcap_close(hpcap);
|
||||
hpcap = nullptr;
|
||||
return;
|
||||
|
@ -88,7 +88,7 @@ PCAPAdapter::PCAPAdapter()
|
|||
{
|
||||
pcap_close(hpcap);
|
||||
hpcap = nullptr;
|
||||
Console.Error("DEV9: Can't open Device '%s'", EmuConfig.DEV9.EthDevice.c_str());
|
||||
Console.Error("DEV9: PCAP: Can't open Device '%s'", EmuConfig.DEV9.EthDevice.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ bool PCAPAdapter::recv(NetPacket* pkt)
|
|||
// This includes the FCS, which should be trimmed (PS2 SDK dosn't allow extra space for this).
|
||||
if (header->len > 1518)
|
||||
{
|
||||
Console.Error("DEV9: Dropped jumbo frame of size: %u", header->len);
|
||||
Console.Error("DEV9: PCAP: Dropped jumbo frame of size: %u", header->len);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ bool PCAPAdapter::recv(NetPacket* pkt)
|
|||
// FCS (if present) has been removed, apply correct limit
|
||||
if (pkt->size > 1514)
|
||||
{
|
||||
Console.Error("DEV9: Dropped jumbo frame of size: %u", pkt->size);
|
||||
Console.Error("DEV9: PCAP: Dropped jumbo frame of size: %u", pkt->size);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ std::vector<AdapterEntry> PCAPAdapter::GetAdapters()
|
|||
//guid
|
||||
if (!std::string_view(d->name).starts_with(PCAPPREFIX))
|
||||
{
|
||||
Console.Error("PCAP: Unexpected Device: ", d->name);
|
||||
Console.Error("DEV9: PCAP: Unexpected Device: ", d->name);
|
||||
d = d->next;
|
||||
continue;
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ std::vector<AdapterEntry> PCAPAdapter::GetAdapters()
|
|||
bool PCAPAdapter::InitPCAP(const std::string& adapter, bool promiscuous)
|
||||
{
|
||||
char errbuf[PCAP_ERRBUF_SIZE];
|
||||
Console.WriteLn("DEV9: Opening adapter '%s'...", adapter.c_str());
|
||||
Console.WriteLn("DEV9: PCAP: Opening adapter '%s'...", adapter.c_str());
|
||||
|
||||
// Open the adapter.
|
||||
if ((hpcap = pcap_open_live(adapter.c_str(), // Name of the device.
|
||||
|
@ -279,15 +279,15 @@ bool PCAPAdapter::InitPCAP(const std::string& adapter, bool promiscuous)
|
|||
errbuf // Error buffer.
|
||||
)) == nullptr)
|
||||
{
|
||||
Console.Error("DEV9: %s", errbuf);
|
||||
Console.Error("DEV9: Unable to open the adapter. %s is not supported by pcap", adapter.c_str());
|
||||
Console.Error("DEV9: PCAP: %s", errbuf);
|
||||
Console.Error("DEV9: PCAP: Unable to open the adapter. %s is not supported by pcap", adapter.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pcap_setnonblock(hpcap, 1, errbuf) == -1)
|
||||
{
|
||||
Console.Error("DEV9: Error setting non-blocking: %s", pcap_geterr(hpcap));
|
||||
Console.Error("DEV9: Continuing in blocking mode");
|
||||
Console.Error("DEV9: PCAP: Error setting non-blocking: %s", pcap_geterr(hpcap));
|
||||
Console.Error("DEV9: PCAP: Continuing in blocking mode");
|
||||
blocking = true;
|
||||
}
|
||||
else
|
||||
|
@ -297,20 +297,20 @@ bool PCAPAdapter::InitPCAP(const std::string& adapter, bool promiscuous)
|
|||
const int dlt = pcap_datalink(hpcap);
|
||||
const char* dlt_name = pcap_datalink_val_to_name(dlt);
|
||||
|
||||
Console.WriteLn("DEV9: Device uses DLT %d: %s", dlt, dlt_name);
|
||||
Console.WriteLn("DEV9: PCAP: Device uses DLT %d: %s", dlt, dlt_name);
|
||||
switch (dlt)
|
||||
{
|
||||
case DLT_EN10MB:
|
||||
//case DLT_IEEE802_11:
|
||||
break;
|
||||
default:
|
||||
Console.Error("ERROR: Unsupported DataLink Type (%d): %s", dlt, dlt_name);
|
||||
Console.Error("DEV9: PCAP: Error, unsupported data link type (%d): %s", dlt, dlt_name);
|
||||
pcap_close(hpcap);
|
||||
hpcap = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
Console.WriteLn("DEV9: Adapter Ok.");
|
||||
Console.WriteLn("DEV9: PCAP: Adapter Ok.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -324,13 +324,13 @@ bool PCAPAdapter::SetMACSwitchedFilter(MAC_Address mac)
|
|||
|
||||
if (pcap_compile(hpcap, &fp, filter, 1, PCAP_NETMASK_UNKNOWN) == -1)
|
||||
{
|
||||
Console.Error("DEV9: Error calling pcap_compile: %s", pcap_geterr(hpcap));
|
||||
Console.Error("DEV9: PCAP: Error calling pcap_compile: %s", pcap_geterr(hpcap));
|
||||
return false;
|
||||
}
|
||||
|
||||
int setFilterRet;
|
||||
if ((setFilterRet = pcap_setfilter(hpcap, &fp)) == -1)
|
||||
Console.Error("DEV9: Error setting filter: %s", pcap_geterr(hpcap));
|
||||
Console.Error("DEV9: PCAP: Error setting filter: %s", pcap_geterr(hpcap));
|
||||
|
||||
pcap_freecode(&fp);
|
||||
return setFilterRet != -1;
|
||||
|
|
Loading…
Reference in New Issue