title: Python Scapy nfqueue
body: <p>Im writing python code to interact with iptables nfqueue on linux systems. I am able to retrieve the queue packets and modify them as i wish however i am having trouble accepting them through the queue. </p>
  
  <pre><code>            payload.set_verdict_modified(nfqueue.NF_ACCEPT, str(p), len(p))
  </code></pre>
  
  <p>That is the line that to my understanding will allow it through the queue. p is the new packet that i have created and payload is the orginal queue packet.</p>
  
  <p>There really isnt too much documentation on this so any help will be appreciated.
  Thanks</p>
  
  <p>This is how i create the packet</p>
  
  <pre><code>def queue_callback(i, payload)
  
      data = payload.get_data()
      packet = IP(data)
  </code></pre>
  
  <p>This is where i create the packet. I do a little bit of packet manipulation and this is where i return it</p>
  
  <pre><code>    packet[TCP].payload = after;
  
      return packet;
  </code></pre>
  
  <p>After i return the packet i try to update the nfqueue in iptables using the previous command</p>
  
  <pre><code>            p = modify(packet)
              print p[TCP].payload
              payload.set_verdict_modified(nfqueue.NF_ACCEPT, str(p), len(p))
  </code></pre>
  
  <p>The modify function is where i create a new packet and return it.</p>