ETH_P_ALL and tcp ports

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, someone might try to tell me what I'm doing wrong, please?

I have a simple module and I registered one packet handler, in init function:
---
     pseudo_proto.type = htons(ETH_P_ALL);
     pseudo_proto.dev = NULL;
     pseudo_proto.func = packet_handler;
     dev_add_pack(&pseudo_proto);
---

My packet_handler, is a simple function just to print in dmesg info
about the packet, its check if protocol is TCP or UDP before.

The problem is with TCP headers. I'm trying to get tcp ports with:

ntohs(tcp_hdr(skb)->dest);

But always come strange ports numbers.

My question is: Are the TCP headers filled at this stage ?
Or I have to register another packet_handler with dev_add_pack() after
TCP code have done the heavy work?

Best regards,
Felipe
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs




[Index of Archives]     [Audio]     [Hams]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Fedora Users]

  Powered by Linux