[Click] Problem when running click with adding a new element

yacine.djemaiel yacine.djemaiel at laposte.net
Mon Oct 18 04:26:30 EDT 2004


Hi Beyers,

Thank you very much for your help, i have added the element
after CheckIPHeader and the problem has been resolved.

Thanks again 
Yacine Djemaiel
 
> Hi Yacine,
>  
> Have a look at
http://www.pdos.lcs.mit.edu/click/doc/progman.html#Header%20Annotations
. The packet header annotations have to be set in order to use 
> p->ip_header and friends. CheckIPHeader element sets the IP
header annonations, so in your example put your element in the
config somewhere after CheckIPHeader in the config graph.
>  
> Alternatively you can use the following casts to gain a
pointer to the IP and TCP (same for UDP) header if the header
annotations haven't been set:
>  
> click_ip *ip = reinterpret_cast<click_ip *>(p->data());
> click_tcp *tcph = reinterpret_cast<click_tcp
*>(reinterpret_cast<unsigned char *>(ip) + (ip->ip_hl << 2));
>  
> Important, to use the above casts the packet should be an IP
packet with ethernet header removed, this can easily be
accomplished by using the Strip(14) element before your element.
>  
> Hope this helps.
>  
> Regards
>  
> Beyers Cronje
>  
> 
> ________________________________
> 
> From: click-bounces at amsterdam.lcs.mit.edu on behalf of
yacine.djemaiel
> Sent: Sat 10/16/2004 9:57 AM
> To: click
> Subject: [Click] Problem when running click with adding a
new element
> 
> 
> 
> Hi,
> I am trying to familiarize with click by building a new
> element. Following Mr. Eddie Kohler's thesis i have succeeded
> to add a new element that forward packets without handle them.
> In the next step, i have tried to manipulate the click_ip
> class so i call a new method in the pull method, the content
> of this method is :
> 
> Packet *
> NewElement::treat_packet(int port, Packet *p)
> {
> 
> const click_ip *iph = p->ip_header();
> if (iph->ip_p != IPPROTO_TCP) click_chatter("Non TCP
> trafic");
> else return p;
> return p;
> }
> 
> When running click with the following config, i obtain this
> error message :
> Segmentation fault
> 
> config used : FromDevice(eth0)->NewElement->Discard;
> 
> i have added a Queue, before the NewElement but i have
> received the same error.
> 
> Thanks in advance,
> 
> Yacine Djemail
> 
> 
> Accédez au courrier électronique de La Poste : www.laposte.net ;
> 3615 LAPOSTENET (0,34EUR/mn) ; tél : 08 92 68 13 50 (0,34EUR/mn)
> 
> 
> 
> 
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
> 
> 
> 
> This is an email from CS Holdings. It is confidential to the
ordinary user of the email address
> to which it is addressed and may contain copyright and/or
legally privileged information. No one
> else may read, print, store, copy, forward or act in
reliance upon all or any part of it or its 
> attachments. If you received this email in error please
notify its sender.
> 

Accédez au courrier électronique de La Poste : www.laposte.net ; 
3615 LAPOSTENET (0,34€/mn) ; tél : 08 92 68 13 50 (0,34€/mn)






More information about the click mailing list