You can also take a look here how to access the headers if the annotations have not been set
https://github.com/kohler/click/blob/master/elements/analysis/storeudptimeseqrecord.cc Roman On 05/13/2011 07:05 AM, Beyers Cronje wrote: > You probably forgot to convert to host byte order: > > src_port = ntohs(tcp->th_sport); > > The way you are assigning your pointers are also prone to errors. > > A better way would be something in the lines of: > > const click_ip6 *ip6h = p->ip6_header(); > const click_tcp *tcph = p->tcp_header(); > > if (!p->has_network_header()) { > p->kill(); > return; > } > > // Do your stuff here > > > The above code assumes that you have used the proper Click configuration to > ensure IPv6 packets via Classifier and that the packets are passed through > MarkIP6Header or CheckIP6Header so that the proper packet header annotations > are set. > > Beyers > > > > On Fri, May 13, 2011 at 3:33 PM, milos rovcanin<[email protected]> wrote: > >> Greetings, >> >> Like it's said in the subject, this code: >> >> click_ether * eth = (click_ether *)p->data(); >> click_ip6 * ip6 = (click_ip6 *)(eth+1); >> >> if(ip6->ip6_nxt == 6) { >> click_tcp* tcp = (click_tcp*)(ip6+1); >> src_port = tcp->th_sport; >> dst_port = tcp->th_dport; >> } >> >> just won't return correct values for dst_port and src_port! I have checked >> it in Wireshark too. >> What am I doing wrong? >> >> Thanks in advance! >> -- >> Milos Rovcanin >> Department of Information Technology >> Internet Based Communication Networks and Services research group (IBCN) >> Ghent University - IBBT >> Gaston Crommenlaan 8 (Bus 201), B-9050 Gent, Belgium >> T: +32 9 33 14946 ; T Secr: +32 9 33 14900 >> E: [email protected] >> W: www.ibcn.intec.UGent.be >> _______________________________________________ >> click mailing list >> [email protected] >> https://amsterdam.lcs.mit.edu/mailman/listinfo/click >> > _______________________________________________ > click mailing list > [email protected] > https://amsterdam.lcs.mit.edu/mailman/listinfo/click > _______________________________________________ click mailing list [email protected] https://amsterdam.lcs.mit.edu/mailman/listinfo/click
