libipq and ipq_packet_msg_t (desperate)

Steven J Scott sjscott at ra.rockwell.com
Wed Dec 15 15:22:27 CET 2004


I am really struggling to extract the payload from the ipq_packet_msg_t 
structure...  Does anyone have experience in this area???  Or could point 
me to the docs, or people? 

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)




Steven J Scott <sjscott at ra.rockwell.com>
Sent by: netfilter-devel-bounces at lists.netfilter.org
13/12/2004 12:27 PM

 
        To:     netfilter-devel at lists.netfilter.org
        cc: 
        Subject:        libipq and ipq_packet_msg_t


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