* Porting the RTSP module to 2.6.22
@ 2007-07-29 20:12 Michael Guntsche
2007-07-29 20:21 ` Jan Engelhardt
2007-07-29 20:27 ` Michael Guntsche
0 siblings, 2 replies; 5+ messages in thread
From: Michael Guntsche @ 2007-07-29 20:12 UTC (permalink / raw)
To: netfilter-devel
Hello,
I am trying to forward port the RTSP module from 2.6.21 to 2.6.22 and
I am nearly done. All there is missing is a helper function. I had a
look at the skbuff struct but I could not find out what needed to be
changed.
Here is the short original helper function.
static void
get_skb_tcpdata(struct sk_buff* skb, char** pptcpdata, uint*
ptcpdatalen)
{
struct iphdr* iph = (struct iphdr*)skb->nh.iph;
struct tcphdr* tcph = (struct tcphdr*)((char*)iph + iph->ihl*4);
*pptcpdata = (char*)tcph + tcph->doff*4;
*ptcpdatalen = ((char*)skb->h.raw + skb->len) - *pptcpdata;
}
I changed this to
static void
get_skb_tcpdata(struct sk_buff** skb, char** pptcpdata, uint*
ptcpdatalen)
{
struct iphdr* iph = ip_hdr(*skb);
struct tcphdr* tcph = (void *)iph + iph->ihl*4;
*pptcpdata = (char*)tcph + tcph->doff*4;
*ptcpdatalen = ((char*)skb->h.raw + skb->len) - *pptcpdata;
}
I am pretty sure, that the first three lines are ok. But the last one
is giving me some problems, since "h" is no longer in the skb struct.
Maybe someone with a little bit more knowledge about the changes can
help me here.
Kind regards,
Michael
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Porting the RTSP module to 2.6.22
2007-07-29 20:12 Porting the RTSP module to 2.6.22 Michael Guntsche
@ 2007-07-29 20:21 ` Jan Engelhardt
2007-07-30 15:52 ` Michael Guntsche
2007-07-29 20:27 ` Michael Guntsche
1 sibling, 1 reply; 5+ messages in thread
From: Jan Engelhardt @ 2007-07-29 20:21 UTC (permalink / raw)
To: Michael Guntsche; +Cc: netfilter-devel
On Jul 29 2007 22:12, Michael Guntsche wrote:
>
> I changed this to
>
> static void
> get_skb_tcpdata(struct sk_buff** skb, char** pptcpdata, uint* ptcpdatalen)
> {
> struct iphdr* iph = ip_hdr(*skb);
> struct tcphdr* tcph = (void *)iph + iph->ihl*4;
Use (void *)iph + ip_hdrlen(*skb)
> *pptcpdata = (char*)tcph + tcph->doff*4;
> *ptcpdatalen = ((char*)skb->h.raw + skb->len) - *pptcpdata;
> }
h.raw is now skb_transport_header(skb);
Also, skb-> should be (*skb)->, since it is a double pointer (which you
can also get rid of)
> I am pretty sure, that the first three lines are ok. But the last one is giving
> me some problems, since "h" is no longer in the skb struct.
> Maybe someone with a little bit more knowledge about the changes can help me
> here.
Jan
--
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Porting the RTSP module to 2.6.22
2007-07-29 20:21 ` Jan Engelhardt
@ 2007-07-30 15:52 ` Michael Guntsche
0 siblings, 0 replies; 5+ messages in thread
From: Michael Guntsche @ 2007-07-30 15:52 UTC (permalink / raw)
To: netfilter-devel
On Jul 29, 2007, at 22:21, Jan Engelhardt wrote:
>
>
> Use (void *)iph + ip_hdrlen(*skb)
>
>> *pptcpdata = (char*)tcph + tcph->doff*4;
>> *ptcpdatalen = ((char*)skb->h.raw + skb->len) - *pptcpdata;
>> }
>
> h.raw is now skb_transport_header(skb);
> Also, skb-> should be (*skb)->, since it is a double pointer (which
> you
> can also get rid of)
>
Thank you very very much Jan. With your tips and some poking in the
other modules I was able to get a compiling and more suprisingly
running version of the RTSP module.
The new and working function looks like this.
static void
get_skb_tcpdata(struct sk_buff* skb, char** pptcpdata, uint*
ptcpdatalen)
{
struct iphdr* iph = ip_hdr(skb);
struct tcphdr* tcph = (void *)iph + ip_hdrlen(skb);
*pptcpdata = (char*)tcph + tcph->doff*4;
*ptcpdatalen = ((char*)skb_transport_header(skb) + skb->len) -
*pptcpdata;
}
I am in the process of creating and updated patch against 2.6.22.1
and will put it up on my site this evening.
http://mike.it-loops.com/rtsp/
It is working for me right now, but maybe someone can give it a quick
check and tell me if there are any problems or bugs.
Kind regards,
Michael
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Porting the RTSP module to 2.6.22
2007-07-29 20:12 Porting the RTSP module to 2.6.22 Michael Guntsche
2007-07-29 20:21 ` Jan Engelhardt
@ 2007-07-29 20:27 ` Michael Guntsche
2007-07-30 12:38 ` Patrick McHardy
1 sibling, 1 reply; 5+ messages in thread
From: Michael Guntsche @ 2007-07-29 20:27 UTC (permalink / raw)
To: netfilter-devel
Answering my own post.
I already fixed the obvious mistake I made.
On Jul 29, 2007, at 22:12, Michael Guntsche wrote:
<snip>
> I changed this to
>
> static void
> get_skb_tcpdata(struct sk_buff** skb, char** pptcpdata, uint*
> ptcpdatalen)
> {
> struct iphdr* iph = ip_hdr(*skb);
> struct tcphdr* tcph = (void *)iph + iph->ihl*4;
>
> *pptcpdata = (char*)tcph + tcph->doff*4;
> *ptcpdatalen = ((char*)skb->h.raw + skb->len) - *pptcpdata;
> }
>
Of course there is no need to change skb.
Sorry for not checking this before sending the first E-Mail.
static void
get_skb_tcpdata(struct sk_buff* skb, char** pptcpdata, uint*
ptcpdatalen)
{
struct iphdr* iph = ip_hdr(skb);
struct tcphdr* tcph = (void *)iph + iph->ihl*4;
*pptcpdata = (char*)tcph + tcph->doff*4;
*ptcpdatalen = ((char*)skb->h.raw + skb->len) - *pptcpdata;
}
The problem remains though that the "h" member is no longer existing.
Kind regards,
Michael
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Porting the RTSP module to 2.6.22
2007-07-29 20:27 ` Michael Guntsche
@ 2007-07-30 12:38 ` Patrick McHardy
0 siblings, 0 replies; 5+ messages in thread
From: Patrick McHardy @ 2007-07-30 12:38 UTC (permalink / raw)
To: Michael Guntsche; +Cc: netfilter-devel
Michael Guntsche wrote:
> Answering my own post.
> I already fixed the obvious mistake I made.
> On Jul 29, 2007, at 22:12, Michael Guntsche wrote:
> <snip>
>
>> I changed this to
>>
>> static void
>> get_skb_tcpdata(struct sk_buff** skb, char** pptcpdata, uint*
>> ptcpdatalen)
>> {
>> struct iphdr* iph = ip_hdr(*skb);
>> struct tcphdr* tcph = (void *)iph + iph->ihl*4;
>>
>> *pptcpdata = (char*)tcph + tcph->doff*4;
>> *ptcpdatalen = ((char*)skb->h.raw + skb->len) - *pptcpdata;
>> }
>>
>
> Of course there is no need to change skb.
> Sorry for not checking this before sending the first E-Mail.
>
> static void
> get_skb_tcpdata(struct sk_buff* skb, char** pptcpdata, uint* ptcpdatalen)
> {
> struct iphdr* iph = ip_hdr(skb);
> struct tcphdr* tcph = (void *)iph + iph->ihl*4;
>
> *pptcpdata = (char*)tcph + tcph->doff*4;
> *ptcpdatalen = ((char*)skb->h.raw + skb->len) - *pptcpdata;
> }
>
> The problem remains though that the "h" member is no longer existing.
That shouldn't be a problem since netfilter modules should basically
never use it anyway since its only valid for locally generated packets.
Use Jan's suggestion (or look at other modules) and skb_header_pointer.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-07-30 15:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-29 20:12 Porting the RTSP module to 2.6.22 Michael Guntsche
2007-07-29 20:21 ` Jan Engelhardt
2007-07-30 15:52 ` Michael Guntsche
2007-07-29 20:27 ` Michael Guntsche
2007-07-30 12:38 ` Patrick McHardy
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.