title: ICMP request with data
body: <p>I want to send ICMP request message with some data on the end. I can only send simple ICMP request with no data yet. When i want add some characters at the end of icmp structure that is in buffer, no ICMP request is send. When I delete the ending character or change size of sending message in sendto function to sizeof(icmp), the message is send normally. What is wrong?</p>
  
  <p>Argument in the ping function is fine.</p>
  
  <pre><code>void ping(struct sockaddr_in *addr) {
      int sd;
      const int val=255;
      struct sockaddr_in r_addr;
      sd = socket(PF_INET, SOCK_RAW, IPPROTO_ICMP);
      if ( sd &lt; 0 ) {
          perror("socket");
          return;
      }
      if ( setsockopt(sd, SOL_IP, IP_TTL, &amp;val, sizeof(val)) != 0)
          perror("Set TTL option");
      if ( fcntl(sd, F_SETFL, O_NONBLOCK) != 0 )
          perror("Request nonblocking I/O");
      socklen_t len=sizeof(r_addr);
      struct icmp *icmp_send, *icmp_recv;
      icmp_send-&gt;icmp_type = ICMP_ECHO;
      icmp_send-&gt;icmp_code = 0;
      icmp_send-&gt;icmp_id = getpid();
      icmp_send-&gt;icmp_seq = 1;
      icmp_send-&gt;icmp_cksum = 0;
      icmp_send-&gt;icmp_cksum = checksum(icmp_send, sizeof(icmp_send));
      unsigned char buff[2000];
      unsigned char*p = buff;
      memcpy(buff, icmp_send, sizeof(icmp)); 
      p += sizeof(icmp);
      *p = 'A';
      if ( sendto(sd, (unsigned char*)buff, sizeof(icmp_send) + 1 , 0, (struct sockaddr*)addr, sizeof(*addr)) &lt;= 0 ) {
                  printf("Send err.\n");
      }
  }
  </code></pre>