title: How do you use socket.ntohs(0x0003) protocol with python SOCK_RAW on Ubuntu?
body: <p>I get an OSError from Python when I use <code>ntohs(0x0003)</code> as the protocol argument for a SOCK_RAW socket on Ubuntu. </p>
  
  <pre><code>  File "sniffer_all.py", line 44, in main
      s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.ntohs(0x0003))
    File "/usr/lib/python3.5/socket.py", line 134, in __init__
      _socket.socket.__init__(self, family, type, proto, fileno)
  OSError: [Errno 22] Invalid argument
  </code></pre>
  
  <p>I checked the /etc/protocols file, and it lists 3 as the GGP :</p>
  
  <pre><code>...
  ggp 3   GGP     # gateway-gateway protocol
  </code></pre>
  
  <p>I do not know why this error occurs if the protocol is configured. I am running python with sudo, so I should have no access issues.</p>
  
  <p>Replacing <code>socket.ntohs(0x0003)</code> with another protocol, such as <code>socket.IPPROTO_UDP</code>, fixes the error, but limits which traffic the socket can handle.</p>