[Click] Please help. TCP and UDP Headers problems.

Beyers Cronje bcronje at gmail.com
Mon Nov 26 09:21:24 EST 2007


The FromDump "STOP true" parameter will stop the router as soon as all
packets have been processed. So in your configuration as soon as one
of your FromDump elements have run out of packets it will stop the
router, irrespective of whether the other FromDump element has
finished or not.

I suppose the easiest would be to use "STOP true" only on the FromDump
element with the most packets in it. A much better solution would be
to use a script element, or "STOP false" and manually stop Click :)

As a sidenote, when "STOP true" and FromDump processed the last packet
it calls Router::please_stop_driver(), I'm not too sure about the
internals of this call so I'm not sure what happens when there are
still packets in your queue, I've got a feeling Click will stop and
all packets still in your queue will be dropped. If this is the case
you'll be better off running FromDump with a Pull output port, in
other words just drop your queue elements in your config.

Beyers

On Nov 26, 2007 3:54 PM, Josh Butler <tuna_armadillo at hotmail.com> wrote:
> Hi again,
>
> I have one last problem to overcome. My configuration script is as
> follows.
>
> FromDump(youtubedump.dump, STOP true) -> Align(4, 0) -> Queue(3000) ->
> [0]RoundRobinSched;
>
> FromDump(surfingdump.dump, STOP true) -> Align(4, 0) -> Queue(3000) ->
> [1]RoundRobinSched;
>
>         RoundRobinSched
>         -> Unqueue(-1)
>         -> CheckIPHeader(14)
>         -> Tee
>         Tee[0] -> Print(Elephant) -> Discard;
>         Tee[1] -> Print(Mouse) -> Discard;
>
>
> youtubedump contains approx 3500 packets.
> surfingdump contains approx 3100 packets.
>
> Upon processing all the packets from surfingdump, the configuration only
> processes about four more packets from youtubedump before stopping, when
> there should be another 400 or so packets from youtubedump to come.
>
> I've examined the dumps in wireshark, and there is no difference in the
> packets in youtubedump, they are all part of the same TCP sequence.
>
> Both dumps only contain IP packets.
>
> Any ideas why the configuration is stopping too early?
>
> Thanks,
> Josh
>
> On Thu, 2007-11-22 at 12:40 +0000, Josh Butler wrote:
> > On Thu, 2007-11-22 at 14:28 +0200, Beyers Cronje wrote:
> > > Did you include the tcp and udp header files?
> > >
> > > #include <clicknet/udp.h>
> > > #include <clicknet/tcp.h>
> >
> > HAHAHA! Schoolboy error. Problem solved. You guys definitely get an
> > acknowledgement in my write up.
> >
> >
> > On Thu, 2007-11-22 at 14:28 +0200, Beyers Cronje wrote:
> > > Did you include the tcp and udp header files?
> > >
> > > #include <clicknet/udp.h>
> > > #include <clicknet/tcp.h>
> > >
> > >
> > >
> > > On Nov 22, 2007 2:13 PM, Josh Butler <tuna_armadillo at hotmail.com> wrote:
> > > > Hi Bart,
> > > >
> > > > Many thanks for the reply. Modified the code, see below, but still
> > > > getting exactly the same errors... Getting really desperate now. Please
> > > > don't give up on me, I'm not usually this slow.
> > > >
> > > > void
> > > > MyTee::push(int, Packet *p_in)
> > > > {
> > > >
> > > >   WritablePacket *p = p_in->uniqueify();
> > > >   if (!p) //kill if no memory available.
> > > >   return 0;
> > > >
> > > >   click_ip *iph = p->ip_header(); // Get pointer to IP Header
> > > >
> > > >   if (!iph) // Make sure it's a valid header
> > > >   {
> > > >     p->kill(); // Kill if invalid to avoid memory leaks
> > > >     return;
> > > >   }
> > > >
> > > >   SrcIP = iph->ip_src;
> > > >   DstIP = iph->ip_dst;
> > > >   Protocol = iph->ip_p;
> > > >
> > > >   if (Protocol == 6)
> > > >   {
> > > >   click_tcp *tcph = p->tcp_header();
> > > >   SrcPort = tcph->th_sport;
> > > >   DstPort = tcph->th_dport;
> > > >   }
> > > >
> > > >   else if (Protocol == 17) {
> > > >   click_udp *udph = p->udp_header();
> > > >   SrcPort = udph->uh_sport;
> > > >   DstPort = udph->uh_dport;
> > > >   }
> > > >
> > > >
> > > > On Thu, 2007-11-22 at 09:12 +0100, Bart Braem wrote:
> > > > > On Thursday 22 November 2007 01:57:08 Josh Butler wrote:
> > > > > > //CODE\\
> > > > > >
> > > > > > 66  const click_ip *iph = p->ip_header(); // Get pointer to IP
> > > > Header
> > > > > > 67
> > > > > > 68   if (!iph) // Make sure it's a valid header
> > > > > > 69   {
> > > > > > 70     p->kill(); // Kill if invalid to avoid memory leaks
> > > > > > 71     return;
> > > > > > 72   }
> > > > > > 73
> > > > > > 74   SrcIP = iph->ip_src;
> > > > > > 75   DstIP = iph->ip_dst;
> > > > > > 76
> > > > > > 77   if (iph->ip_p == 6) //Is packet tcp?
> > > > > > 78   {
> > > > > > 79   click_tcp *tcph = p->tcp_header(); //get pointer to tcp header.
> > > > > > 80   SrcPort = tcph->th_sport;
> > > > > > 81   DstPort = tcph->th_dport;
> > > > > > 82   }
> > > > > > 83
> > > > > > 84   else if (iph->ip_p == 17){ //Is packet udp?
> > > > > > 85   click_udp *udph = p->udp_header(); //get pointer to udp header.
> > > > > > 86   SrcPort = udph->uh_sport;
> > > > > > 87   DstPort = udph->uh_dport;
> > > > > > 88   }
> > > > > >
> > > > > > //END CODE\\
> > > > > >
> > > > > > Terminal shows the following errors:
> > > > > >
> > > > > > ./elements/local/mytee.cc: In member function 'virtual void
> > > > > > MyTee::push(int, Packet*)':
> > > > > >
> > > > > > ./elements/local/mytee.cc:80: error: invalid conversion from 'const
> > > > > > click_tcp*' to 'click_tcp*'
> > > > > >
> > > > > Read the header file packet.hh in the include/click directory: in
> > > > Packet the
> > > > > function tcp_header(); returns a const pointer. So either use a
> > > > > WriteablePacket or change the type of the tcp header.
> > > > >
> > > > > > ./elements/local/mytee.cc:81: error: invalid use of undefined type
> > > > > > 'struct click_tcp'
> > > > > >
> > > > > > ./include/click/packet.hh:17: error: forward declaration of 'struct
> > > > > > click_tcp'
> > > > > >
> > > > > > ./elements/local/mytee.cc:82: error: invalid use of undefined type
> > > > > > 'struct click_tcp'
> > > > > >
> > > > > > ./include/click/packet.hh:17: error: forward declaration of 'struct
> > > > > > click_tcp'
> > > > > >
> > > > > All these errors result from the previous one.
> > > > >
> > > > > > ./elements/local/mytee.cc:86: error: invalid conversion from 'const
> > > > > > click_udp*' to 'click_udp*'
> > > > > >
> > > > > This is the same problem of the return type of that function.
> > > > >
> > > > > > ./elements/local/mytee.cc:87: error: invalid use of undefined type
> > > > > > 'struct click_udp'
> > > > > >
> > > > > > ./include/click/packet.hh:18: error: forward declaration of 'struct
> > > > > > click_udp'
> > > > > >
> > > > > > ./elements/local/mytee.cc:88: error: invalid use of undefined type
> > > > > > 'struct click_udp'
> > > > > >
> > > > > > ./include/click/packet.hh:18: error: forward declaration of 'struct
> > > > > > click_udp'
> > > > >
> > > > > These errors also result from the previous ones.
> > > > >
> > > > > Regards,
> > > > > Bart
> > > > > _______________________________________________
> > > > > click mailing list
> > > > > click at amsterdam.lcs.mit.edu
> > > > > https://amsterdam.lcs.mit.edu/mailman/listinfo/click
> > > >
> > > >
> > > > _______________________________________________
> > > > click mailing list
> > > > click at amsterdam.lcs.mit.edu
> > > > https://amsterdam.lcs.mit.edu/mailman/listinfo/click
> > > >
> > >
> >
> >
> > _______________________________________________
> > click mailing list
> > click at amsterdam.lcs.mit.edu
> > https://amsterdam.lcs.mit.edu/mailman/listinfo/click
> >
>
>
>


More information about the click mailing list