Q:

why the raw socket changed my tcp checksum

i write a program to test the raw socket sento function,and i found when i write a tcp message with a wrong checksum, i observed a right checksum in wireshark,the following is my program:
int main()
{
    int sock_raw_fd,len;
    struct sockaddr_ll sll;

    struct ifreq ethreq;

    strncpy (ethreq.ifr_name, "eth0", (sizeof(ethreq.ifr_name) - 1));
    ethreq.ifr_name[sizeof(ethreq.ifr_name)-1] = '\0';
    sock_raw_fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));

    if(sock_raw_fd < 0){
        perror("socket");
        exit(1);
    }

    if(-1 == ioctl(sock_raw_fd, SIOCGIFINDEX, &ethreq)){
        perror("ioctl");
        close(sock_raw_fd);
        exit(1);
    }

    bzero(&sll, sizeof(sll));
    sll.sll_ifindex = ethreq.ifr_ifindex;

     unsigned char buf[size] = {0xF0,0xDE,0xF1,0x06,0x71,0x3A,0x00,0xE0,0x66,0xE2,0xEA,0xC0,0x08,0x00,0x45,0x00,0x05,0xDC,0x2B,0x5E,0x40,0x00,0x40,0x06,0x85,0xE9,0xC0,0xA8,0x01,0x0A,0xC0,0xA8,0x01,0x7A,0x09,0x79,0xD8,0xB7,0x27,0x6C,0x4C,0x2C,0xF5,0x9C,0xAB,0xC9,0x50,0x10,0x01,0x00,0xAB,0xC9,0x00,0x00,0x7C,0xC8,0xE8,0x89,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFD,0xFF,0xFD,0xFE,0xFF,0xFE,0xFE,0xFE,0xFE,0xFE,0xFD,0xFE,0xFF,0xFD,0xFE,0xFF,0xFF,0xFC,0xFF,0xFF,0xFD,0xFF,0xFE,0xFE,0xFF,0xFD,0xFE,0xFF,0xFE,0xFC,0xFE,0xFE,0xFD,0xFE,0xFE,0xFD,0xFF,0xFE,0xFC,0xFD,0xFE,0xFD,0xFE,0xFE,0xFC,0xFF,0xFE,0xFC,0xFE,0xFE,0xFC,0xFD,0xFE,0xFB,0xFF,0xFE,0xFC,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F,0xFC,0xF5,0xDF,0xFA,0xF3,0xDF,0xFB,0xF4,0xDE,0xFB,0xF3,0xDD,0xFB,0xF2,0xDE,0xFB,0xF3,0xDE,0xFB,0xF2,0xDE,0xFB,0xF3,0xDE,0xFB,0xF4,0xDD,0xFB,0xF4,0xDC,0xFB,0xF4,0xDD,0xFB,0xF4,0xDD,0xFB,0xF3,0xDC,0xFB,0xF2,0xDB,0xF9,0xF3,0xDC,0xFA,0xF3,0xDB,0xFA,0xF3,0xDA,0xF9,0xF3,0xDB,0xFA,0xF3,0xDA,0xFA,0xF3,0xDA,0xFA,0xF3,0xDA,0xFA,0xF3,0xDA,0xFA,0xF3,0xDA,0xC8,0xE8,0x89,0xC2,0xE6,0x7C,0x7A,0x92,0x4B,0x47,0x50,0x82,0x47,0x50,0x82,0x47,0x50,0x82,0x47,0x50,0x82,0x47,0x50,0x82,0x47,0x50,0x82,0x47,0x50,0x82,0x47,0x50,0x82,0x47,0x50,0x82,0x47,0x50,0x82,0x48,0x51,0x83,0x47,0x50,0x82,0x47,0x50,0x82,0x46,0x4F,0x81,0x46,0x4F,0x81,0x46,0x4F,0x81,0x46,0x4F,0x81,0x46,0x4F,0x81,0x46,0x4F,0x81,0x46,0x4F,0x81,0x46,0x4F,0x81,0x46,0x4F,0x81,0x46,0x4F,0x81,0x46,0x4F,0x81,0x46,0x4F,0x81,0x46,0x4F,0x81,0x48,0x4F,0x81,0x48,0x4F,0x81,0x48,0x4F,0x81,0x48,0x4F,0x81,0x47,0x4E,0x80,0x47,0x4E,0x80,0x47,0x4E,0x80,0x47,0x4E,0x80,0x47,0x4E,0x80,0x47,0x4E,0x80,0x47,0x4E,0x80,0x47,0x4E,0x80,0x47,0x4E,0x80,0x47,0x4E,0x80,0x47,0x4E,0x80,0x48,0x4F,0x81,0x48,0x4F,0x81,0x48,0x4F,0x81,0x48,0x4F,0x81,0x48,0x4F,0x81,0x48,0x4F,0x81,0x48,0x4F,0x81,0x47,0x4E,0x80,0x47,0x4E,0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xF9,0xF1,0xF1,0xF9,0xF1,0xF1,0xF9,0xF1,0xF1,0xF9,0xF1,0xF1,0xF9,0xF1,0xF1,0xF9,0xF1,0xF1,0xF9,0xF1,0xF1,0xF9,0xF1,0xF1,0xF9,0xF1,0xF1,0xF9,0xF1,0xF1,0xF9,0xF1,0xF1,0xF9,0xF1,0xF1,0xF9,0xF1,0xF1,0xF9,0xF1,0xF1,0xF9,0xF1,0xF1,0xF9,0xF1,0xF1,0xF9,0xF1,0xF1,0xF9,0xF1,0xF1,0xF9,0xF1,0xF1,0xF9,0xF1,0xF1,0xF9,0xF1,0xF1,0xF9,0xF1,0xF1,0xF9,0xF1,0xF1,0xF9,0xF1,0xF1,0xF9,0xF1,0xC2,0xE6,0x7C,0x7A,0x92,0x4B,0x4E,0x54,0x81,0x4E,0x54,0x83,0x4E,0x54,0x83,0x4E,0x54,0x83,0x4E,0x54,0x83,0x4E,0x54,0x83,0x4E,0x54,0x83,0x4E,0x54,0x83,0x4E,0x54,0x83,0x4F,0x55,0x84,0x4E,0x54,0x83,0x4E,0x54,0x83,0x4E,0x54,0x83,0x4E,0x54,0x83,0x4F,0x55,0x84,0x4F,0x55,0x84,0x4F,0x55,0x84,0x4F,0x55,0x84,0x4F,0x55,0x84,0x4F,0x55,0x84,0x4F,0x55,0x84,0x4E,0x54,0x83,0x4E,0x54,0x83,0x4E,0x54,0x83,0x4E,0x54,0x83,0x4E,0x54,0x83,0x4E,0x54,0x83,0x4E,0x54,0x83,0x4E,0x54,0x83,0x4F,0x55,0x84,0x4F,0x55,0x84,0x4F,0x55,0x84,0x4F,0x55,0x84,0x51,0x55,0x85,0x51,0x55,0x85,0x50,0x56,0x85,0x50,0x56,0x85,0x50,0x56,0x85,0x50,0x56,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4C,0x56,0x85,0x4C,0x56,0x85,0x4C,0x56,0x85,0x4C,0x56,0x85,0x4A,0x57,0x85,0x4A,0x57,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4E,0xF2,0xF2,0xF2,0xF2,0xF2,0xF2,0xF2,0xF2,0xF2,0xF2,0xF2,0xF2,0xF2,                        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

    len = sendto(sock_raw_fd, &buf[0], size, 0, (struct sockaddr*)&sll, sizeof(sll));

    printf("send succeed: %d bytes\n",len);
    return 0;
}

the checksum i send is ABC9
but i got this message in wireshark is
wireshark message
the checksum is DEEA, and it is correct, i want to see the checksum is ABC9 and not correct,but i don't know how to set the raw socket do not chang my checksum. 
thank you!

A:

I assume that the wireshark dump is from the receiving machine, not from the sender and this is probably due to your network card doing checksum offloading.
You can disable that behaviour with ethtool:
ethtool -K eth0 tx-checksum-ipv4 off
ethtool -K eth0 tx-checksum-ip-generic off

You can check if your settings are correct now with
ethtool -k eth0

