How to fetch address mask with ICMP
<p>RFC 950, page 11:</p>

<blockquote>
  <p>A gateway receiving an address mask request should return it with the
  address mask field set to the 32-bit mask of the bits identifying the
  subnet and network, for the subnet on which the request was received.</p>
</blockquote>

<p>I want to fetch a host address mask and build a ICMP address mask request packet to local gateway, and other IP. I use <code>tcpdump -i eth0 icmp</code> and find <code>ICMP address mask request</code> packet has been sent.But I haven't found any reponse. Is anything wrong? The main code is:</p>

<pre><code> struct icmp        *picmp;

 /* ICMP header */
 picmp = (icmp_t *)send_buf;
 picmp-&gt;icmp_type = ICMP_MASKREQ;    // Address Mask Request
 picmp-&gt;icmp_code = 0;
 picmp-&gt;icmp_id = pid;
 picmp-&gt;icmp_seq = npkt++;

 len = 12; // ICMP header length
 picmp-&gt;icmp_cksum = 0;
 picmp-&gt;icmp_cksum = in_cksum((u_short *)picmp, len);

 sendto(sock_fd, send_buf, len, 0, pr-&gt;p_addr, pr-&gt;addr_len);  
</code></pre>