Reply To: IP Checksum

Home Forums Discussions Support IP Checksum Reply To: IP Checksum

#5763
pavankvnaidu
Participant

    hi SerpentFly,
    Can you help me??
    I am trying to create the new packet based on the original (old) packet.
    I am sending the new packet instead of old packet. The packet is now modified and received other side also. Now the problem is the system is sending old packets continuesly. I mean its in the loop. Can you please suggest me some thing?

    The following is the part of the code.

    bool bModified = false;
    INTERMEDIATE_BUFFER pNewPacket;
    ZeroMemory(&pNewPacket,sizeof(INTERMEDIATE_BUFFER));
    pNewPacket.m_IBuffer[0] = 0;
    if (PacketBuffer.m_dwDeviceFlags == PACKET_FLAG_ON_SEND)
    {
    // Create a new packet
    CreateNewPacket(&PacketBuffer, &pNewPacket, bModified);
    }
    if(bModified)//if its modified
    {
    RecalculateIPChecksum(&pNewPacket);
    RecalculateTCPChecksum(&pNewPacket);
    PrintPacket(&pNewPacket);
    ETH_REQUEST newRequest;
    ZeroMemory ( &newRequest, sizeof(ETH_REQUEST) );
    newRequest.hAdapterHandle = (HANDLE)AdList.m_nAdapterHandle[iIndex];
    newRequest.EthPacket.Buffer = &pNewPacket;
    if (PacketBuffer.m_dwDeviceFlags == PACKET_FLAG_ON_SEND)
    {
    api.SendPacketToAdapter(&newRequest);
    }
    else
    {
    api.SendPacketToMstcp(&newRequest);
    }
    }
    else
    {
    PrintPacket(&PacketBuffer);
    if (PacketBuffer.m_dwDeviceFlags == PACKET_FLAG_ON_SEND)
    {
    api.SendPacketToAdapter(&Request);
    }
    else
    {
    api.SendPacketToMstcp(&Request);
    }
    }