Hello guys

 

I'm trying to ping from target board to my pc.

And I'll confirm ICMP packet by using wireshark.

 

I called this function when main function start 

This function make ICMP packet and send it. 

 

void

pingtest(void)

{

/* Set ICMP header */

ICMPBUF->type = ICMP_ECHO;

             ICMPBUF->icode = 0;

  

  if(ICMPBUF->icmpchksum >= HTONS(0xffff - (ICMP_ECHO << 8))) {

    ICMPBUF->icmpchksum += HTONS(ICMP_ECHO << 8) + 1;

  } else {

    ICMPBUF->icmpchksum += HTONS(ICMP_ECHO << 8);

  }

             ICMPBUF->id = 0x842f;

             ICMPBUF->seqno = 1;

  

 

             /* Set IP header */

             BUF->vhl = 0x45;

             BUF->tos = 0;

             BUF->len[0] = 0;

             BUF->len[1] = 0x54;

             BUF->ipid[0] = 0xf2;

             BUF->ipid[1] = 0x9c;

             BUF->ipoffset[0] = BUF->ipoffset[1] = 0;

             BUF->ttl = 128;

             BUF->proto = UIP_PROTO_ICMP;

             BUF->ipchksum = 0;

             uip_ipaddr(BUF->destipaddr, 128, 134, 64, 123);

             uip_ipaddr(BUF->srcipaddr, 128, 134, 64, 132);

  

             UIP_STAT(++uip_stat.icmp.sent);

uip_process(1);

}

 

this test is failed.

I think making ICMP header has no problem . 

if there is some data to send in uip_buf.. uIP send it automatically. right?


 

Reply via email to