Print MAC address from Ethernet header
<p>I want to check the Ethernet header of packet that is porececed by iptables (1.4), so i need to write a module that catch packet and apply my function. I am looking for the mac destination value in the Ethernet header (just for test purpose), so the code should be like this:</p>

<pre><code>static bool match(const struct sk_buff *skb, struct xt_action_param *par)
{
    struct ethhdr *hdr;        
    hdr = eth_hdr(skb);
    printk(KERN_INFO "hdr-&gt;h_dest 0x%x\n", hdr-&gt;h_dest);
    printk(KERN_INFO "MACPROTO=%04x\n", hdr-&gt;h_proto);
</code></pre>

<p>The problem is that i cant get the correct value, i have some thing that is not even in the real frame (i checked that with Wireshark), so is it the right function to get Ethernet header attributs?</p>

<p><strong>update:</strong>
i used the solution presented in the post, but still have wrong output, it's like if the structure point to wrong place
<a href="https://i.stack.imgur.com/wv1AT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wv1AT.png" alt="enter image description here"></a></p>

<p>This image show result when i use nc to send "aaa" string, the ethernet header should be the same in the to frame, but as present in the result, it's not.</p>