Re: PPPoE ip extraction

"[email protected]" <[email protected]>
Newsgroups gmane.linux.network.bridge.ebtables.devel
Message-ID <[email protected]>
>----- Oorspronkelijk bericht -----
>Van: Marek Jawurek [mailto:[email protected]]
>Verzonden: donderdag, juli 6, 2006 01:12 PM
>Aan: [email protected]
>CC: [email protected]
>Onderwerp: Re: [Ebtables-devel] PPPoE ip extraction
>
>Thx Bart, i figured it out yesterday the other way around.
>I moved the rest of the packet down in order to overwrite the ppp
>header.
>
>This is what I intended to write:
>
>The skb->data pointer just points to the start of the current protocol
>header. This is the first Layer encapsulated in the Ethernet packet for
>the ebtables code. As changing the data pointer apparantly does not help
>I just overwrote the pppoe+ppp header and copied the IP Proto field into
>the Ethernet header:
>
>memcpy(eth_hdr(*pskb)->h_dest, in->dev_addr, ETH_ALEN);
>eth_hdr(*pskb)->h_proto=htons(ETH_P_IP);
>memcpy((*pskb)->data,(*pskb)->datasizeof(pppoe),(*pskb)->end-(*pskb)->data);

I think the best thing you can do is to skb_pull the data and then copy the
Ethernet header. You must make sure that the packet length is decreased by the 
size of the ppp header.

>Ok this seems to work. In general, I see that I lack a great deal of
>kernel-programming-experience ;-)
>
>One question though, I manage to extract the IP packet but apparently it
>then (after the REDIRECT in ebtables) the INPUT table of the netfilter ?

?

>Would it be possible to direct it to the PREROUTING where I could use
>the iptables REDIRECT to a local port ? 

I don't know where you are doing this modification. But it's very likely you
need to change skb->protocol to htons(ETH_P_IP).

cheers,
Bart





-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.