Hi..
Now, how should I comapare the value of daddr (which is __be32) in my
module
to that specified ip : "192.168.0.103"?
I tried the following:
...
struct iphdr *iph;
iph = skb->nh.iph;
if (iph)
{
if (htonl(0xC0A80067) == daddr)
printk("got daddr=192.168.0.103\n");
else
printk("did not get daddr=192.168.0.103\n");
}
And I get **wrong** answer , namely it prints: "did not get daddr" , even
though I know for sure that the daddr of the ip header is 192.168.0.103.
Interesting. May we know, what does "daddr" refer to? I mean, clearly
that seems like local variable or local variable and the real "daddr" is
in the skb. So, are you sure it had pointed to the correct "daddr" ?
I think that the hex representation for
192.168.0.103 is 0xC0A80067; am I right in this ? (I caclulated this
thus:
C0=192, A8=168, 00=0, 67=103).
But maybe the order of the bytes should be different ? something like:
if (htonl(0x6700A8C0) == daddr)
printk("got daddr=192.168.0.103\n");
Or is there another way I should do this ?
AFAIK, you're correct. However, it won't hurt if you try some ordering
possibility like you said above. Please notice that I absolutely know
nothing about x86_64 byte ordering.
Good luck.
regards,
Mulyadi
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ