title: Modify header of a captured packet
body: <p>I am trying to modify the IP header to include more IP options with the use of the <code>libnetfiletr_queue</code>. So far I have managed to come to the point where I obtain the packet as shown below.</p>
  
  <pre><code>if (nfq_set_mode(qh, NFQNL_COPY_PACKET, 0xffff) &lt; 0) {
      fprintf(stderr, "Unable to set nfq_set_mode\n");
      exit(1);
  }
  </code></pre>
  
  <p>Then I managed to go far as shown below,</p>
  
  <pre><code>static int my_callBack(struct nfq_q_handle *qh, struct nfgenmsg *nfmsg,struct nfq_data *tb)
  {   
      int id = 0;
      int packet_len;
      unsigned char *data;
      struct nfqnl_msg_packet_hdr *packet_hdr;
      unsigned char *data;
  
      packet_hdr = nfq_get_msg_packet_hdr(tb);
  
      if (packet_hdr) {
          id = ntohl(packet_hdr-&gt;packet_id);          
      }
  
      packet_len = nfq_get_payload(tb, &amp;data);
  
      if (packet_len &gt;= 0) {
          //print payload length
          printf("payload_length = %d ", packet_len);
          //modify packet ip header  
      }
  
      return nfq_set_verdict(qh, id, NF_ACCEPT, 0, NULL);
  }
  </code></pre>
  
  <p>But from here onwards I am a bit confused on how to proceed on modifying the <code>IP header</code> of the captured packet at <code>//modify packet ip header</code> comment.Example on a modification to the IP header (such as traffic class(IPV6)/ IP options/ version/ flags/ destination address) is ok since I only need to understand how the modification works :). </p>
  
  <p>I have tried many resources and could not succeed in proceeding any further. You expert advice and help on this query will be very much appreciated. :)</p>
  
  <p>Thank you very much :)</p>