UDP checksum calculation

前端 未结 3 1366
灰色年华
灰色年华 2020-12-28 14:52

The UDP header struct defined at /usr/include/netinet/udp.h is as follows

struct udphdr
{
  u_int16_t source;
  u_int16_t dest;
  u_int16_t len;
  u_int16_t          


        
3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-28 15:22

    I was searching the net for some code which will calculate the udp header (with the pseudo ip header as mentioned above).

    Finally I found the open-bsd dhclient packet.c:

    https://github.com/openbsd/src/blob/master/sbin/dhclient/packet.c

    check out the function assemble_udp_ip_header()

提交回复
热议问题