* [dpdk-users] SSL-Packet
@ 2018-08-01 10:20 Konstantinos Schoinas
2018-08-01 13:14 ` Matt Laswell
0 siblings, 1 reply; 3+ messages in thread
From: Konstantinos Schoinas @ 2018-08-01 10:20 UTC (permalink / raw)
To: users
Hello,
Can somebody tell me how to cast a tcp packet to an ssl packet?
I tried these lines but i dont things they are completely right.
Struct ssl_record {
uint8_t type;
uint16_t version;
uint16_t length;
}
tcp = (struct tcp_hdr *)(ip + 1);
ssl = (struct ssl_record *)(tcp + 1);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-users] SSL-Packet
2018-08-01 10:20 [dpdk-users] SSL-Packet Konstantinos Schoinas
@ 2018-08-01 13:14 ` Matt Laswell
2018-08-01 13:31 ` Shyam Shrivastav
0 siblings, 1 reply; 3+ messages in thread
From: Matt Laswell @ 2018-08-01 13:14 UTC (permalink / raw)
To: Konstantinos Schoinas; +Cc: users
At a minimum, you're going to want to account for options in the TCP and IP
headers. A better way would be to do a little parsing of the IP header to
get the header length field, then using that to find the start of the TCP
header, etc.
--
Matt Laswell
infinite io, inc.
On Wed, Aug 1, 2018 at 5:20 AM, Konstantinos Schoinas <ece8537@upnet.gr>
wrote:
> Hello,
>
> Can somebody tell me how to cast a tcp packet to an ssl packet?
>
> I tried these lines but i dont things they are completely right.
>
> Struct ssl_record {
> uint8_t type;
> uint16_t version;
> uint16_t length;
> }
>
>
> tcp = (struct tcp_hdr *)(ip + 1);
> ssl = (struct ssl_record *)(tcp + 1);
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-users] SSL-Packet
2018-08-01 13:14 ` Matt Laswell
@ 2018-08-01 13:31 ` Shyam Shrivastav
0 siblings, 0 replies; 3+ messages in thread
From: Shyam Shrivastav @ 2018-08-01 13:31 UTC (permalink / raw)
To: Matt Laswell; +Cc: Konstantinos Schoinas, users
Assuming mbuf data includes ethernet header
struct ipv4_hdr *iphdr = rte_pktmbuf_mtod_offset(pkt,
struct ipv4_hdr *,
sizeof(struct ether_hdr));
uint32_t ihlen = (iphdr->version_ihl & 0x0f)*4;
struct tcp_hdr *th = (struct tcp_hdr *)((char *)iphdr + ihlen);
uint32_t thlen = (th->data_off & 0xf0)*4;
struct ssl_recrod *ssl = ( struct ssl_recrod *) ((char *)th + thlen);
On Wed, Aug 1, 2018 at 6:44 PM, Matt Laswell <laswell@infinite.io> wrote:
> At a minimum, you're going to want to account for options in the TCP and IP
> headers. A better way would be to do a little parsing of the IP header to
> get the header length field, then using that to find the start of the TCP
> header, etc.
>
> --
> Matt Laswell
> infinite io, inc.
>
> On Wed, Aug 1, 2018 at 5:20 AM, Konstantinos Schoinas <ece8537@upnet.gr>
> wrote:
>
> > Hello,
> >
> > Can somebody tell me how to cast a tcp packet to an ssl packet?
> >
> > I tried these lines but i dont things they are completely right.
> >
> > Struct ssl_record {
> > uint8_t type;
> > uint16_t version;
> > uint16_t length;
> > }
> >
> >
> > tcp = (struct tcp_hdr *)(ip + 1);
> > ssl = (struct ssl_record *)(tcp + 1);
> >
> >
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-08-01 13:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-01 10:20 [dpdk-users] SSL-Packet Konstantinos Schoinas
2018-08-01 13:14 ` Matt Laswell
2018-08-01 13:31 ` Shyam Shrivastav
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).