libipq and ipq_packet_msg_t
Steven J Scott
sjscott at ra.rockwell.com
Mon Dec 13 19:27:22 CET 2004
Hello,
I am trying to parse the first two bytes of the payload of a TCP packet.
Am I casting the payload part of the TCP packet right? Below is the code
in question.
case IPQM_PACKET: {
ipq_packet_msg_t *m = ipq_get_packet(buf);
struct iphdr *ip = (struct iphdr*) m->payload;
struct tcphdr *tcp = (struct tcphdr*) (m->payload +
(4 * ip->ihl));
char *data = (char *)((int32_t *)tcp + tcp->doff);
__u16 command = *(__u16 *) data;
printf("COMMAND: %d\n",ntohs(command) );
printf("Len data : %d\n", ntohs(m->data_len));
status = ipq_set_verdict(h, m->packet_id, NF_ACCEPT,
0, NULL);
}
Thanks,
Steven Scott - CISSP, CISA, RHCT, LCP, MCSE
Rockwell Automation / Advanced Technology
sjscott at ra.rockwell.com
<---------------------------------------------------->
(This email was sent via Notes running on Linux)
More information about the netfilter-devel
mailing list