/* Filter the received packet using the source Ip. */
BOOLEAN PxeBcFilterBySrcIp(IN EFI_PXE_BASE_CODE_MODE *Mode, IN VOID *Session, IN OUT EFI_IP_ADDRESS *SrcIp, IN UINT16 OpFlags)
/* Filter the received packet using the source Ip. */
BOOLEAN PxeBcFilterBySrcIp(IN EFI_PXE_BASE_CODE_MODE *Mode, IN VOID *Session, IN OUT EFI_IP_ADDRESS *SrcIp, IN UINT16 OpFlags)
{
  if ((OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP) != 0) {
    if (SrcIp != NULL) {
      if (Mode->UsingIpv6) {
        CopyMem (
          SrcIp,
          &((EFI_UDP6_SESSION_DATA *)Session)->SourceAddress,
          sizeof (EFI_IPv6_ADDRESS)
          );
      } else {
        ZeroMem (SrcIp, sizeof (EFI_IP_ADDRESS));
        CopyMem (
          SrcIp,
          &((EFI_UDP4_SESSION_DATA *)Session)->SourceAddress,
          sizeof (EFI_IPv4_ADDRESS)
          );
      }
    }
    return TRUE;
  } else if ((SrcIp != NULL) &&
             (EFI_IP4_EQUAL (SrcIp, &((EFI_UDP4_SESSION_DATA *)Session)->SourceAddress) ||
              EFI_IP6_EQUAL (SrcIp, &((EFI_UDP6_SESSION_DATA *)Session)->SourceAddress)))
  {
    return TRUE;
  }
  return FALSE;
}