arpuefi

How to utilize ArpDxe driver in UEFI application


I'm trying to get ARP table with ArpDxe driver in UEFI application. Here is my code:

EFI_ARP_PROTOCOL* Arp;
EFI_STATUS Status;
UINT32 Count;
UINT32 Length;
EFI_ARP_FIND_DATA* Entries;
    
Status = gBS->LocateProtocol (
             &gEfiArpProtocolGuid,
             NULL,
             (VOID**)&Arp
             );

if (Status == EFI_SUCCESS) {
    Status = Arp->Find(Arp, true, NULL, &Length, &Count, &Entries, false);
    if (Status == EFI_SUCCESS) {
        //......
    }
}

The problem is, the ARP find function always returns EFI_NOT_FOUND. I try to ping a valid IP before running my application, try to call ARP request function before calling find function, and even try to call ARP add function to add a dummy data, but none of them causing something can be found. Can someone points me out what am I doing wrong?


Solution

  • Like most of the network protocols, ARP uses the service binding protocol to create new instances.

    You have to:

    When you search for the proctocol directly (without creating a new instance) you get an instance that belongs to some driver or app with unknown configuration.