* libnetfilter_queue: extracting TCP options.
@ 2010-11-14 4:13 Igor 'Lo' (И.L.)
2010-11-14 5:05 ` Yechiel Levi
0 siblings, 1 reply; 4+ messages in thread
From: Igor 'Lo' (И.L.) @ 2010-11-14 4:13 UTC (permalink / raw)
To: netfilter-devel
Hi all,
How one can get TCP packet's options (especially timestamp and MD5)
using only libnetfilter_queue in userspace?
Having a callback routine(struct nfq_q_handle *qh, struct nfgenmsg
*nfmsg, struct nfq_data *nfa, void *data) - which structure may
contain the desired options set?
Most adequate Netfilter-based code to solve this problem was found in
linux/net/netfilter/nf_conntrack_proto_tcp.c - not a best kind of
documentation, but provided a nice method of reading a structure. Now
just need to get a bytes to read.
cheers,
Igor
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: libnetfilter_queue: extracting TCP options.
2010-11-14 4:13 libnetfilter_queue: extracting TCP options Igor 'Lo' (И.L.)
@ 2010-11-14 5:05 ` Yechiel Levi
2010-11-14 15:45 ` Igor 'Lo' (И.L.)
0 siblings, 1 reply; 4+ messages in thread
From: Yechiel Levi @ 2010-11-14 5:05 UTC (permalink / raw)
To: Igor 'Lo' (И.L.), netfilter-devel
Hi,
You should use the nfq_handle_packet method, and in the callback it
activates use a casting of tcp struct on the payload (nfq_get_payload
method)
timestamp can be achieved from netfilter using the :
nfq_get_timestamp (struct nfq_data *nfad, struct timeval *tv)
2010/11/14 Igor 'Lo' (И.L.) <bombsiteunrested@gmail.com>:
> Hi all,
>
> How one can get TCP packet's options (especially timestamp and MD5)
> using only libnetfilter_queue in userspace?
> Having a callback routine(struct nfq_q_handle *qh, struct nfgenmsg
> *nfmsg, struct nfq_data *nfa, void *data) - which structure may
> contain the desired options set?
>
> Most adequate Netfilter-based code to solve this problem was found in
> linux/net/netfilter/nf_conntrack_proto_tcp.c - not a best kind of
> documentation, but provided a nice method of reading a structure. Now
> just need to get a bytes to read.
>
> cheers,
> Igor
> --
> To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Kind Regards,
Yechiel Levi
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: libnetfilter_queue: extracting TCP options.
2010-11-14 5:05 ` Yechiel Levi
@ 2010-11-14 15:45 ` Igor 'Lo' (И.L.)
2010-11-14 18:11 ` Yechiel Levi
0 siblings, 1 reply; 4+ messages in thread
From: Igor 'Lo' (И.L.) @ 2010-11-14 15:45 UTC (permalink / raw)
To: Yechiel Levi; +Cc: netfilter-devel
Hi,
which .h contains a correct struct tcp? I guess it is tcphdr from
netinet/tcp.h, which only gives a doff (whole header length), so have
to get payload, skip header length and read the options by byte?
2010/11/14 Yechiel Levi <gmistick@gmail.com>:
> Hi,
>
> You should use the nfq_handle_packet method, and in the callback it
> activates use a casting of tcp struct on the payload (nfq_get_payload
> method)
>
> timestamp can be achieved from netfilter using the :
> nfq_get_timestamp (struct nfq_data *nfad, struct timeval *tv)
>
cheer,
Igor.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: libnetfilter_queue: extracting TCP options.
2010-11-14 15:45 ` Igor 'Lo' (И.L.)
@ 2010-11-14 18:11 ` Yechiel Levi
0 siblings, 0 replies; 4+ messages in thread
From: Yechiel Levi @ 2010-11-14 18:11 UTC (permalink / raw)
To: Igor 'Lo' (И.L.), netfilter-devel
Hi,
You said you want the Checksum and Timestamp.
1. Timestamp as i said could be achieved from nfq_get_timestamp,
2. Checksum could be achieved from the tcphdr,
3. Data length could be computed with iphdr(get the data length - tcp
header length ) ...
I guess that if you want to get the other options, you could just use
the tcphdr, and address the wanted members of the struct...
2010/11/14 Igor 'Lo' (И.L.) <bombsiteunrested@gmail.com>:
> Hi,
> which .h contains a correct struct tcp? I guess it is tcphdr from
> netinet/tcp.h, which only gives a doff (whole header length), so have
> to get payload, skip header length and read the options by byte?
>
> 2010/11/14 Yechiel Levi <gmistick@gmail.com>:
>> Hi,
>>
>> You should use the nfq_handle_packet method, and in the callback it
>> activates use a casting of tcp struct on the payload (nfq_get_payload
>> method)
>>
>> timestamp can be achieved from netfilter using the :
>> nfq_get_timestamp (struct nfq_data *nfad, struct timeval *tv)
>>
> cheer,
> Igor.
>
--
Kind Regards,
Yechiel Levi
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-11-14 18:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-14 4:13 libnetfilter_queue: extracting TCP options Igor 'Lo' (И.L.)
2010-11-14 5:05 ` Yechiel Levi
2010-11-14 15:45 ` Igor 'Lo' (И.L.)
2010-11-14 18:11 ` Yechiel Levi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).