title: C - Cannot access saddr
body: <p>I am trying to handle simple packet inspection with netfilter hooks.</p>
  
  <p>Declaration seems fairly straightforward:</p>
  
  <pre><code>unsigned int hook_func(unsigned int hooknum, struct sk_buff *skb, 
              const struct net_device *in,
              const struct net_device *out, int (*okfn)(struct sk_buff *))
  {
  
       struct iphdr *iph = (struct iphdr *)skb_network_header(skb);
  
  }
  </code></pre>
  
  <p>And I can access the protocol portion of the network header</p>
  
  <p><code>iph-&gt;protocol == IPPROTO_TCP</code></p>
  
  <p>However</p>
  
  <p><code>iph-&gt;saddr</code> </p>
  
  <p>Fails. Any suggestions? I feel as this is a fairly simple error on my part, but all the examples follow either this method or they simply use</p>
  
  <p><code>struct iphdr *iph = ip_hdr(skb);</code></p>
  
  <p>I get the same behavior with both methods.  I have looked through skbuff.h for any clues but havn't had any luck.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Could this have to do with they way I am accessing it? Right now for debugging I am merely trying to print the value out using:</p>
  
  <p><code>printk(KERN_DEBUG "%pI4", iph-&gt;saddr);</code></p>