From antoniehenning at yahoo.com Mon Oct 1 21:32:35 2012 From: antoniehenning at yahoo.com (Antonie Henning) Date: Mon, 1 Oct 2012 18:32:35 -0700 (PDT) Subject: [Click] ToDevice(ppp0) In-Reply-To: <1348783120.38385.YahooMailNeo@web125303.mail.ne1.yahoo.com> References: <1348783120.38385.YahooMailNeo@web125303.mail.ne1.yahoo.com> Message-ID: <1349141555.73370.YahooMailNeo@web125305.mail.ne1.yahoo.com> Using RawSocket as a replacement for ToDevice accomplishes this goal. While not exactly?eloquent,?its infinitely faster than libnetfilter_queue ________________________________ From: Antonie Henning To: "click at pdos.csail.mit.edu" Sent: Thursday, September 27, 2012 11:58 PM Subject: [Click] ToDevice(ppp0) Hi, Has anyone ever been successful in sending packets out a ppp interface with userlevel ToDevice?? ToDevice(ppp0,METHOD LINUX) attempts to send the packets but they are dropped by the kernel. METHOD PCAP fails with "Invalid Argument". The PPPencap element appears not to address the CRC16 and Flags to complete the PPP encapsulation. I've created elements to add these but the drops persist. Any advise will be appreciated. A _______________________________________________ click mailing list click at amsterdam.lcs.mit.edu https://amsterdam.lcs.mit.edu/mailman/listinfo/click From yuanbo.cn at 163.com Mon Oct 8 21:56:26 2012 From: yuanbo.cn at 163.com (yuanbo.cn) Date: Tue, 9 Oct 2012 09:56:26 +0800 (CST) Subject: [Click] How to debug the element? Message-ID: <149bafad.360b.13a433cc256.Coremail.yuanbo.cn@163.com> Hi, when I write my own element, I meet some wrong. How can I take efficient ways to debug the element. May I use the click_chatter(message) or set breakpoint ? and whether I must run the click scripts to print the message? Thanks. From Markku.Savela at vtt.fi Wed Oct 10 08:06:35 2012 From: Markku.Savela at vtt.fi (Markku Savela) Date: Wed, 10 Oct 2012 15:06:35 +0300 Subject: [Click] Functions htonq and ntohq in Message-ID: <507564CB.6040905@vtt.fi> hi, integers.hh defines functions ntohq/htonq, but to me they look identical? To me it looks like, in ntohq, the return return (((uint64_t)ntohl(lo)) << 32) | ntohl(hi); should be replaced by return (((uint64_t)ntohl(hi)) << 32) | ntohl(lo); ??? From ekohler at gmail.com Wed Oct 10 19:45:04 2012 From: ekohler at gmail.com (Eddie Kohler) Date: Wed, 10 Oct 2012 19:45:04 -0400 Subject: [Click] Functions htonq and ntohq in In-Reply-To: <507564CB.6040905@vtt.fi> References: <507564CB.6040905@vtt.fi> Message-ID: Nope, the current version is correct, as you can see by actually running it. Eddie On Wed, Oct 10, 2012 at 8:06 AM, Markku Savela wrote: > hi, > > integers.hh defines functions ntohq/htonq, but to me they > look identical? To me it looks like, in ntohq, the return > > return (((uint64_t)ntohl(lo)) << 32) | ntohl(hi); > > should be replaced by > > return (((uint64_t)ntohl(hi)) << 32) | ntohl(lo); > > ??? > _______________________________________________ > click mailing list > click at amsterdam.lcs.mit.edu > https://amsterdam.lcs.mit.edu/mailman/listinfo/click From Markku.Savela at vtt.fi Thu Oct 11 02:37:36 2012 From: Markku.Savela at vtt.fi (Markku Savela) Date: Thu, 11 Oct 2012 09:37:36 +0300 Subject: [Click] Functions htonq and ntohq in In-Reply-To: References: <507564CB.6040905@vtt.fi> Message-ID: <50766930.7050006@vtt.fi> On 10/11/2012 02:45 AM, Eddie Kohler wrote: > Nope, the current version is correct, as you can see by actually running it. Well, what I was doing was - using on one machine (64 bit MISP) htonq (click) - decoding on another (x86) using ntonq (Qt Application) Didn't get the right results until I changed the ntonq return on x86 machine. Oh well, must have some error in my thought process then... will explore more. From Markku.Savela at vtt.fi Thu Oct 11 02:42:04 2012 From: Markku.Savela at vtt.fi (Markku Savela) Date: Thu, 11 Oct 2012 09:42:04 +0300 Subject: [Click] Functions htonq and ntohq in In-Reply-To: <50766930.7050006@vtt.fi> References: <507564CB.6040905@vtt.fi> <50766930.7050006@vtt.fi> Message-ID: <50766A3C.70203@vtt.fi> .... sigh, I've some dyslexia apparently... On 10/11/2012 09:37 AM, Markku Savela wrote: > On 10/11/2012 02:45 AM, Eddie Kohler wrote: > - using on one machine (64 bit MISP) htonq (click) MIPS > - decoding on another (x86) using ntonq (Qt Application) ntohq ! From Markku.Savela at vtt.fi Thu Oct 11 03:08:38 2012 From: Markku.Savela at vtt.fi (Markku Savela) Date: Thu, 11 Oct 2012 10:08:38 +0300 Subject: [Click] Functions htonq and ntohq in In-Reply-To: <50766930.7050006@vtt.fi> References: <507564CB.6040905@vtt.fi> <50766930.7050006@vtt.fi> Message-ID: <50767076.5070502@vtt.fi> On 10/11/2012 09:37 AM, Markku Savela wrote: > On 10/11/2012 02:45 AM, Eddie Kohler wrote > Oh well, must have some > error in my thought process then... will explore more. Ok, something fishy on the MIPS (Octeon) side of my code I've in packet payload... uint64_t in_packets; and before sending the packet out, I do something like x.in_packets = htonq(x.in_packets) when the in_packets is 7, the wireshark shows it as ... 00 00 00 07 00 00 00 00 ... Apparently MIPS in big endian mode and calling htonq is not correct. I was using htonq in same sense as "htonl", which always works, whether host is big or little endian. From Markku.Savela at vtt.fi Thu Oct 11 04:02:06 2012 From: Markku.Savela at vtt.fi (Markku Savela) Date: Thu, 11 Oct 2012 11:02:06 +0300 Subject: [Click] Functions htonq and ntohq in In-Reply-To: <50767076.5070502@vtt.fi> References: <507564CB.6040905@vtt.fi> <50766930.7050006@vtt.fi> <50767076.5070502@vtt.fi> Message-ID: <50767CFE.3090208@vtt.fi> On 10/11/2012 10:08 AM, Markku Savela wrote: > Apparently MIPS in big endian mode and calling htonq is not > correct. I was using htonq in same sense as "htonl", which > always works, whether host is big or little endian. If anyone is insterested, following diff is my attempt to make htonq/ntohq safe to call regardless of the host endianness? (works for my MIPS -> x86 case, but of course, these things are tricky, so some one needs to check this, or think a better implementation). -------------- next part -------------- A non-text attachment was scrubbed... Name: htonq.diff Type: text/x-patch Size: 1068 bytes Desc: not available Url : http://amsterdam.lcs.mit.edu/pipermail/click/attachments/20121011/c84bed11/attachment.bin From ekohler at gmail.com Thu Oct 11 11:43:29 2012 From: ekohler at gmail.com (Eddie Kohler) Date: Thu, 11 Oct 2012 11:43:29 -0400 Subject: [Click] Functions htonq and ntohq in In-Reply-To: <50767CFE.3090208@vtt.fi> References: <507564CB.6040905@vtt.fi> <50766930.7050006@vtt.fi> <50767076.5070502@vtt.fi> <50767CFE.3090208@vtt.fi> Message-ID: Ouch! Does the diff I just checked in work for you? E On Thu, Oct 11, 2012 at 4:02 AM, Markku Savela wrote: > On 10/11/2012 10:08 AM, Markku Savela wrote: > >> Apparently MIPS in big endian mode and calling htonq is not >> correct. I was using htonq in same sense as "htonl", which >> always works, whether host is big or little endian. > > > If anyone is insterested, following diff is my attempt to make > htonq/ntohq safe to call regardless of the host endianness? > (works for my MIPS -> x86 case, but of course, these things > are tricky, so some one needs to check this, or think a > better implementation). > > > From Markku.Savela at vtt.fi Fri Oct 12 02:56:13 2012 From: Markku.Savela at vtt.fi (Markku Savela) Date: Fri, 12 Oct 2012 09:56:13 +0300 Subject: [Click] Functions htonq and ntohq in In-Reply-To: References: <507564CB.6040905@vtt.fi> <50766930.7050006@vtt.fi> <50767076.5070502@vtt.fi> <50767CFE.3090208@vtt.fi> Message-ID: <5077BF0D.9010807@vtt.fi> On 10/11/2012 06:43 PM, Eddie Kohler wrote: > Ouch! Does the diff I just checked in work for you? Seems to work (just copied the integers.hh, as I didn't want to start messing up with git merges at this point). Just wondering: what about machines where endiannes can be chosen dynamically (ARM?). Now you must at cross-compile time know what endiannes your target is set for? Would it be even possible for gcc to compile "endiannes independent" code (e.g. not knowing the endiannes at compile time)? From ekohler at gmail.com Fri Oct 12 07:54:47 2012 From: ekohler at gmail.com (Eddie Kohler) Date: Fri, 12 Oct 2012 07:54:47 -0400 Subject: [Click] Functions htonq and ntohq in In-Reply-To: <5077BF0D.9010807@vtt.fi> References: <507564CB.6040905@vtt.fi> <50766930.7050006@vtt.fi> <50767076.5070502@vtt.fi> <50767CFE.3090208@vtt.fi> <5077BF0D.9010807@vtt.fi> Message-ID: GCC could potentially do it but Click is certainly not set up for such things and neither I believe is the Linux kernel (__constant_htons) E On Fri, Oct 12, 2012 at 2:56 AM, Markku Savela wrote: > On 10/11/2012 06:43 PM, Eddie Kohler wrote: >> >> Ouch! Does the diff I just checked in work for you? > > > Seems to work (just copied the integers.hh, as I didn't want > to start messing up with git merges at this point). > > Just wondering: what about machines where endiannes can be > chosen dynamically (ARM?). Now you must at cross-compile time > know what endiannes your target is set for? > > Would it be even possible for gcc to compile "endiannes > independent" code (e.g. not knowing the endiannes at > compile time)? > > From j.herzen at gmail.com Sun Oct 14 08:57:41 2012 From: j.herzen at gmail.com (Julien Herzen) Date: Sun, 14 Oct 2012 14:57:41 +0200 Subject: [Click] Memory allocation for Click elements Message-ID: Dear all, I'm writing my own elements (in userspace), and I compile everything with "make". It works fine most of the time. It can happen, however, that adding a single class variable to an element (e.g., a Timer) causes click to systematically segfault (even before calling the constructors). When I do a "make clean" before "make", I don't have this problem. Therefore, it seems that there is more to re-compile than only my own element. There's probably something missing in the default Makefile, but I didn't figure out what yet. Is it a known issue? Or am I the only one to have this problem? I should perhaps mention that I'm cross-compiling for openWrt. Many thanks for your help, Julien From christian at icir.org Mon Oct 15 18:31:06 2012 From: christian at icir.org (Christian Kreibich) Date: Mon, 15 Oct 2012 15:31:06 -0700 Subject: [Click] Click as a router between real interface and loopback Message-ID: <507C8EAA.6060702@icir.org> I have a pretty standard Click setup in which a user-space Click running on Linux realizes a basic router between two interfaces (eth0 and eth1), grabbing and sending packets via FromDevice and ToDevice. When testing this setup with a client process located on machine A, a server process located on machine B, and the machine running Click sitting in between, everything works as expected. For various reasons it would be handy to run the server process and the Click instance on the same host, with the server listening on loopback. When I try this, packets appear on lo in tcpdump, but the server process doesn't see them. I seem to recall that packets sent via ToDevice will not be processed by the local kernel. Is that in fact the case, and if so, what's a good way to make this work? Do I need to go the KernelTun or ToHost route? Thanks, -C. From j.herzen at gmail.com Tue Oct 16 04:11:22 2012 From: j.herzen at gmail.com (Julien Herzen) Date: Tue, 16 Oct 2012 10:11:22 +0200 Subject: [Click] Click as a router between real interface and loopback In-Reply-To: <507C8EAA.6060702@icir.org> References: <507C8EAA.6060702@icir.org> Message-ID: You can use FromHost / ToHost. These elements create a new TUN/TAP network interface, on which your server can be listening to. You just need to be careful to set the ip and netmasks correctly (i.e., so that Linux routes traffic to that new interface instead of the real one). You will also need to reply to the ARP requests coming from Linux, and take care of the actual ARP requests/replies from Click (see FromHost documentation). Best, Julien On Tue, Oct 16, 2012 at 12:31 AM, Christian Kreibich wrote: > I have a pretty standard Click setup in which a user-space Click running > on Linux realizes a basic router between two interfaces (eth0 and eth1), > grabbing and sending packets via FromDevice and ToDevice. When testing > this setup with a client process located on machine A, a server process > located on machine B, and the machine running Click sitting in between, > everything works as expected. > > For various reasons it would be handy to run the server process and the > Click instance on the same host, with the server listening on loopback. > When I try this, packets appear on lo in tcpdump, but the server process > doesn't see them. I seem to recall that packets sent via ToDevice will > not be processed by the local kernel. Is that in fact the case, and if > so, what's a good way to make this work? Do I need to go the KernelTun > or ToHost route? > > Thanks, > -C. > _______________________________________________ > click mailing list > click at amsterdam.lcs.mit.edu > https://amsterdam.lcs.mit.edu/mailman/listinfo/click From Markku.Savela at vtt.fi Wed Oct 17 06:19:39 2012 From: Markku.Savela at vtt.fi (Markku Savela) Date: Wed, 17 Oct 2012 13:19:39 +0300 Subject: [Click] Input flush action for userspace FromDevice? Message-ID: <507E863B.9080109@vtt.fi> I run into a problem while using userspace FromDevice for WLAN monitor socket: when I reconfigure WIFI interface, I need to ignore all before reconfiguration messages queued in the kernel for the click FromDevice element. Apparently there is no such "native flush" action for a socket, and flushing input is just reading and discarding until socket indicates "no data". I cannot find such function in FromDevice or is there? First that comes to mind is some kind of flush handler that would read and discard input, until none... (there is, of course, a small concern of reading forever and never seeing "no data" if new data for socket is generated faster than click can read). Any thoughts? Should handler been written or is there another way to trigger the "input flush" for FromDevice from another click element? Would handler be "read" or "write" handler? From sandeep048 at gmail.com Wed Oct 17 10:55:39 2012 From: sandeep048 at gmail.com (sandeep) Date: Wed, 17 Oct 2012 15:55:39 +0100 Subject: [Click] click netmap(20120813) patch Message-ID: Hi, netmap_if structure is changed in netmap v3 (20120813). I am attaching a patch to fix netmap's integration. This assumes that updated netmap.h and netmap_user.h files are copied to /usr/include/net directory. ---------------------------------- --- /home/pathivas/click/elements/userlevel/netmapinfo.cc 2012-06-25 13:09:29.375014693 +0100 +++ ../elements/userlevel/netmapinfo.cc 2012-10-17 17:18:11.216540166 +0100 @@ -16,8 +16,6 @@ * legally binding. */ -#include - #include #include #include "netmapinfo.hh" @@ -94,7 +91,7 @@ NetmapInfo::ring::initialize_rings_rx(in { ring_begin = 0; // 0 means "same count as the converse direction" - ring_end = nifp->ni_rx_queues ? nifp->ni_rx_queues : nifp->ni_tx_queues; + ring_end = nifp->ni_rx_rings ? nifp->ni_rx_rings : nifp->ni_tx_rings; if (timestamp >= 0) { int flags = (timestamp > 0 ? NR_TIMESTAMP : 0); for (unsigned i = ring_begin; i != ring_end; ++i) @@ -106,7 +103,7 @@ void NetmapInfo::ring::initialize_rings_tx() { ring_begin = 0; - ring_end = nifp->ni_tx_queues ? nifp->ni_tx_queues : nifp->ni_rx_queues; + ring_end = nifp->ni_tx_rings ? nifp->ni_tx_rings : nifp->ni_rx_rings; } ---------------------------------- Kind Regards, Sandeep, PhD Student, CTVR - Trinity College Dublin From Markku.Savela at vtt.fi Fri Oct 19 01:47:37 2012 From: Markku.Savela at vtt.fi (Markku Savela) Date: Fri, 19 Oct 2012 08:47:37 +0300 Subject: [Click] Input flush action for userspace FromDevice? In-Reply-To: <507E863B.9080109@vtt.fi> References: <507E863B.9080109@vtt.fi> Message-ID: <5080E979.40505@vtt.fi> On 10/17/2012 01:19 PM, Markku Savela wrote: > I cannot find such function in FromDevice or is there? First > that comes to mind is some kind of flush handler that > would read and discard input, until none... (there is, of > course, a small concern of reading forever and never seeing > "no data" if new data for socket is generated faster than > click can read). Ok, here is my test for such handler. This is not anything that could be incorporated as is: it is hard coded to assume the linux method for reading -- I didn't have time to study how to achieve same with PCAP or NETMAP... I suppose I should have wrapped this in FROMDEVICE_ALLOW_LINUX and check the selected _method too. -------------- next part -------------- A non-text attachment was scrubbed... Name: flush.diff Type: text/x-patch Size: 1124 bytes Desc: not available Url : http://amsterdam.lcs.mit.edu/pipermail/click/attachments/20121019/f668aada/attachment.bin From zaykalov at gmail.com Thu Oct 25 08:22:12 2012 From: zaykalov at gmail.com (Konstantin Zaykalov) Date: Thu, 25 Oct 2012 13:22:12 +0100 Subject: [Click] kernel patching elimination Message-ID: Hi, I've got a few questions regarding the design of Click router: 1) Why does Click do kernel patching (and fixing include files via fixincludes.pl script) for g++ compiler instead of providing wrapper functions, surrounded by "extern "C" "? Or even some abstraction layer written in C? 2) Why doesn't Click use netfilter hooks for intercepting packets? 3) Why doesn't Click use NAPI for device polling? Basically I am looking into possibilities to eliminate kernel patching altogether and make it more independent/standalone. Thank you, Konstantin