From qq119512 at iii.u-tokyo.ac.jp Tue Nov 5 06:55:29 2013 From: qq119512 at iii.u-tokyo.ac.jp (Hamid Farhadi) Date: Tue, 05 Nov 2013 20:55:29 +0900 Subject: [Click] many compile errors on etc/samplepackage In-Reply-To: <525383C7.6020100@iii.u-tokyo.ac.jp> References: <5252A652.2060206@iii.u-tokyo.ac.jp> <525383C7.6020100@iii.u-tokyo.ac.jp> Message-ID: <5278DCB1.1060606@iii.u-tokyo.ac.jp> for archiving purposes: using --disable-linuxmodule for click configuration plus using the default --prefix=/usr/local in package configuration solved the issue --H. On 10/8/13 1:02 PM, Hamid Farhadi wrote: > Sorry for my bad explanation, > ofcourse i can comment out that line like previous errors and finish the > compilation. but I am saying the compilation scripts look old. am I right? > also the Click ./configure seems does not accept --with-PACKAGE switch > or maybe I do not know how to use it. > > > any idea please? > --Hamid > > On 10/7/13 9:17 PM, Hamid Farhadi wrote: >> Hi >> >> I tried compiling etc/samplepackage but it fires many errors on many >> different elements in share/click/src ? >> >> I just run autoconfig in the folder then ./configure and make which goes >> through compiling all the elements. I know at least a couple of them >> that work in the Click main installation without problem. I kept >> deleting elements woth errors till I got this error: >> >> /usr/local/bin/click-buildtool -C /usr/local elem2package sample < >> uelements.conf > upackage.cc >> CXX upackage.cc >> upackage.cc: In function ?Element* beetlemonkey(uintptr_t)?: >> upackage.cc:828:25: error: expected type-specifier before ?MyNothingElement? >> upackage.cc:828:25: error: cannot convert ?int*? to ?Element*? in return >> upackage.cc:828:25: error: expected ?;? before ?MyNothingElement? >> upackage.cc:828:25: error: ?MyNothingElement? was not declared in this scope >> make[1]: *** [upackage.uo] Error 1 >> make[1]: *** Waiting for unfinished jobs.... >> make[1]: Leaving directory >> `/home/yilong/Desktop/kohler-click-d3e8e31/etc/samplepackage' >> make: *** [sample.uo] Error 2 >> >> Whats wrong please? >> >> >> --Hamid >> >> >> >> _______________________________________________ >> 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 > From ekohler at gmail.com Sun Nov 10 22:54:58 2013 From: ekohler at gmail.com (Eddie Kohler) Date: Sun, 10 Nov 2013 22:54:58 -0500 Subject: [Click] many compile errors on etc/samplepackage In-Reply-To: <5278DCB1.1060606@iii.u-tokyo.ac.jp> References: <5252A652.2060206@iii.u-tokyo.ac.jp> <525383C7.6020100@iii.u-tokyo.ac.jp> <5278DCB1.1060606@iii.u-tokyo.ac.jp> Message-ID: Hi Hamid, Thanks for this report. I have checked in a fix that I believe would allow you to compile the package for linuxmodule again. That said, if you don't need linuxmodule, then don't compile it. Eddie On Tue, Nov 5, 2013 at 6:55 AM, Hamid Farhadi wrote: > for archiving purposes: > using --disable-linuxmodule for click configuration plus using the > default --prefix=/usr/local in package configuration solved the issue > > --H. > > On 10/8/13 1:02 PM, Hamid Farhadi wrote: >> Sorry for my bad explanation, >> ofcourse i can comment out that line like previous errors and finish the >> compilation. but I am saying the compilation scripts look old. am I right? >> also the Click ./configure seems does not accept --with-PACKAGE switch >> or maybe I do not know how to use it. >> >> >> any idea please? >> --Hamid >> >> On 10/7/13 9:17 PM, Hamid Farhadi wrote: >>> Hi >>> >>> I tried compiling etc/samplepackage but it fires many errors on many >>> different elements in share/click/src ? >>> >>> I just run autoconfig in the folder then ./configure and make which goes >>> through compiling all the elements. I know at least a couple of them >>> that work in the Click main installation without problem. I kept >>> deleting elements woth errors till I got this error: >>> >>> /usr/local/bin/click-buildtool -C /usr/local elem2package sample < >>> uelements.conf > upackage.cc >>> CXX upackage.cc >>> upackage.cc: In function ?Element* beetlemonkey(uintptr_t)?: >>> upackage.cc:828:25: error: expected type-specifier before ?MyNothingElement? >>> upackage.cc:828:25: error: cannot convert ?int*? to ?Element*? in return >>> upackage.cc:828:25: error: expected ?;? before ?MyNothingElement? >>> upackage.cc:828:25: error: ?MyNothingElement? was not declared in this scope >>> make[1]: *** [upackage.uo] Error 1 >>> make[1]: *** Waiting for unfinished jobs.... >>> make[1]: Leaving directory >>> `/home/yilong/Desktop/kohler-click-d3e8e31/etc/samplepackage' >>> make: *** [sample.uo] Error 2 >>> >>> Whats wrong please? >>> >>> >>> --Hamid >>> >>> >>> >>> _______________________________________________ >>> 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 From arazmj at gmail.com Tue Nov 12 17:23:18 2013 From: arazmj at gmail.com (Amir Razmjou) Date: Wed, 13 Nov 2013 01:53:18 +0330 Subject: [Click] Looking for idea Message-ID: Hello Folks I?m just looking for some new idea contributing Click. Performance running, debugging is my expert. Do you have an idea. Email me. Amir From matteo at openwrt.org Thu Nov 14 05:03:00 2013 From: matteo at openwrt.org (Matteo Croce) Date: Thu, 14 Nov 2013 11:03:00 +0100 Subject: [Click] [PATCH] Fix configure error Message-ID: <1384423380-17584-1-git-send-email-matteo@openwrt.org> Strip special characters like $ or " from CFLAGS which causes all configure test to fail --- configure | 2 +- configure.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 83632c5..d422f4e 100755 --- a/configure +++ b/configure @@ -10693,7 +10693,7 @@ $as_echo_n "checking for Linux kernel compilation flags... " >&6; } echo >conftest.c make -C $linux_builddir M="`pwd`" $linux_makeargs --no-print-directory -p conftest.o >conftest.dat 2>&1 for v in KBUILD_CPPFLAGS KBUILD_CFLAGS CPPFLAGS CFLAGS LINUXINCLUDE debug_flags; do - eval l$v="'""`grep ^$v' *:*=' conftest.dat | sed s/^$v' *:*= *//'`""'" + eval l$v="'""`grep ^$v' *:*=' conftest.dat | sed -e s/^$v' *:*= *//' -e 's/\$\(.*\)//' -e 's/"//g'`""'" done if test -z "$lKBUILD_CPPFLAGS$lKBUILD_CFLAGS$lCPPFLAGS$lCFLAGS$lLINUXINCLUDE"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 diff --git a/configure.in b/configure.in index 869cacb..2f699e1 100644 --- a/configure.in +++ b/configure.in @@ -1224,7 +1224,7 @@ if test $ac_have_linux_kernel = y; then echo >conftest.c make -C $linux_builddir M="`pwd`" $linux_makeargs --no-print-directory -p conftest.o >conftest.dat 2>&1 for v in KBUILD_CPPFLAGS KBUILD_CFLAGS CPPFLAGS CFLAGS LINUXINCLUDE debug_flags; do - eval l$v="'""`grep ^$v' *:*=' conftest.dat | sed s/^$v' *:*= *//'`""'" + eval l$v="'""`grep ^$v' *:*=' conftest.dat | sed -e s/^$v' *:*= *//' -e 's/\$\(.*\)//' -e 's/"//g'`""'" done if test -z "$lKBUILD_CPPFLAGS$lKBUILD_CFLAGS$lCPPFLAGS$lCFLAGS$lLINUXINCLUDE"; then AC_MSG_RESULT([not found]) -- 1.8.3.2 From ekohler at gmail.com Thu Nov 14 12:35:10 2013 From: ekohler at gmail.com (Eddie Kohler) Date: Thu, 14 Nov 2013 12:35:10 -0500 Subject: [Click] [PATCH] Fix configure error In-Reply-To: <1384423380-17584-1-git-send-email-matteo@openwrt.org> References: <1384423380-17584-1-git-send-email-matteo@openwrt.org> Message-ID: Hi Matteo, Argh, the process of extracting flags from Linux. Can you give a sample of the flags that were causing a problem? Getting rid of the special characters might not be good enough; we might need to recursively expand the make variables. Eddie On Thu, Nov 14, 2013 at 5:03 AM, Matteo Croce wrote: > Strip special characters like $ or " from CFLAGS which causes all configure test to fail > --- > configure | 2 +- > configure.in | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/configure b/configure > index 83632c5..d422f4e 100755 > --- a/configure > +++ b/configure > @@ -10693,7 +10693,7 @@ $as_echo_n "checking for Linux kernel compilation flags... " >&6; } > echo >conftest.c > make -C $linux_builddir M="`pwd`" $linux_makeargs --no-print-directory -p conftest.o >conftest.dat 2>&1 > for v in KBUILD_CPPFLAGS KBUILD_CFLAGS CPPFLAGS CFLAGS LINUXINCLUDE debug_flags; do > - eval l$v="'""`grep ^$v' *:*=' conftest.dat | sed s/^$v' *:*= *//'`""'" > + eval l$v="'""`grep ^$v' *:*=' conftest.dat | sed -e s/^$v' *:*= *//' -e 's/\$\(.*\)//' -e 's/"//g'`""'" > done > if test -z "$lKBUILD_CPPFLAGS$lKBUILD_CFLAGS$lCPPFLAGS$lCFLAGS$lLINUXINCLUDE"; then > { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 > diff --git a/configure.in b/configure.in > index 869cacb..2f699e1 100644 > --- a/configure.in > +++ b/configure.in > @@ -1224,7 +1224,7 @@ if test $ac_have_linux_kernel = y; then > echo >conftest.c > make -C $linux_builddir M="`pwd`" $linux_makeargs --no-print-directory -p conftest.o >conftest.dat 2>&1 > for v in KBUILD_CPPFLAGS KBUILD_CFLAGS CPPFLAGS CFLAGS LINUXINCLUDE debug_flags; do > - eval l$v="'""`grep ^$v' *:*=' conftest.dat | sed s/^$v' *:*= *//'`""'" > + eval l$v="'""`grep ^$v' *:*=' conftest.dat | sed -e s/^$v' *:*= *//' -e 's/\$\(.*\)//' -e 's/"//g'`""'" > done > if test -z "$lKBUILD_CPPFLAGS$lKBUILD_CFLAGS$lCPPFLAGS$lCFLAGS$lLINUXINCLUDE"; then > AC_MSG_RESULT([not found]) > -- > 1.8.3.2 > > _______________________________________________ > click mailing list > click at amsterdam.lcs.mit.edu > https://amsterdam.lcs.mit.edu/mailman/listinfo/click From matteo at openwrt.org Thu Nov 14 13:31:23 2013 From: matteo at openwrt.org (Matteo Croce) Date: Thu, 14 Nov 2013 19:31:23 +0100 Subject: [Click] [PATCH] speedup radiotap parser Message-ID: <1384453883-5559-1-git-send-email-matteo@openwrt.org> Scan the radiotap header once per packet thus reducing the parser complexity from O(n^2) to O(n) --- elements/wifi/radiotapdecap.cc | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/elements/wifi/radiotapdecap.cc b/elements/wifi/radiotapdecap.cc index e30f84d..ab91788 100644 --- a/elements/wifi/radiotapdecap.cc +++ b/elements/wifi/radiotapdecap.cc @@ -50,6 +50,8 @@ static const int radiotap_elem_to_bytes[NUM_RADIOTAP_ELEMENTS] = 1, /* IEEE80211_RADIOTAP_DATA_RETRIES */ }; +static u_int8_t *offsets[NUM_RADIOTAP_ELEMENTS]; + static int rt_el_present(struct ieee80211_radiotap_header *th, u_int32_t element) { if (element > NUM_RADIOTAP_ELEMENTS) @@ -61,6 +63,8 @@ static int rt_check_header(struct ieee80211_radiotap_header *th, int len) { int bytes = 0; int x = 0; + u_int8_t *ptr = (u_int8_t *)(th + 1); + if (th->it_version != 0) { return 0; } @@ -70,8 +74,10 @@ static int rt_check_header(struct ieee80211_radiotap_header *th, int len) } for (x = 0; x < NUM_RADIOTAP_ELEMENTS; x++) { - if (rt_el_present(th, x)) + if (rt_el_present(th, x)) { + offsets[x] = ptr + bytes; bytes += radiotap_elem_to_bytes[x]; + } } if (le16_to_cpu(th->it_len) < sizeof(struct ieee80211_radiotap_header) + bytes) { @@ -85,17 +91,6 @@ static int rt_check_header(struct ieee80211_radiotap_header *th, int len) return 1; } -static u_int8_t *rt_el_offset(struct ieee80211_radiotap_header *th, u_int32_t element) { - unsigned int x = 0; - u_int8_t *offset = ((u_int8_t *) th) + sizeof(ieee80211_radiotap_header); - for (x = 0; x < NUM_RADIOTAP_ELEMENTS && x < element; x++) { - if (rt_el_present(th, x)) - offset += radiotap_elem_to_bytes[x]; - } - - return offset; -} - RadiotapDecap::RadiotapDecap() { } @@ -121,7 +116,7 @@ RadiotapDecap::simple_action(Packet *p) ceh->magic = WIFI_EXTRA_MAGIC; if (rt_el_present(th, IEEE80211_RADIOTAP_FLAGS)) { - u_int8_t flags = *((u_int8_t *) rt_el_offset(th, IEEE80211_RADIOTAP_FLAGS)); + u_int8_t flags = *offsets[IEEE80211_RADIOTAP_FLAGS]; if (flags & IEEE80211_RADIOTAP_F_DATAPAD) { ceh->pad = 1; } @@ -131,36 +126,36 @@ RadiotapDecap::simple_action(Packet *p) } if (rt_el_present(th, IEEE80211_RADIOTAP_RATE)) { - ceh->rate = *((u_int8_t *) rt_el_offset(th, IEEE80211_RADIOTAP_RATE)); + ceh->rate = *offsets[IEEE80211_RADIOTAP_RATE]; } if (rt_el_present(th, IEEE80211_RADIOTAP_DBM_ANTSIGNAL)) - ceh->rssi = *((u_int8_t *) rt_el_offset(th, IEEE80211_RADIOTAP_DBM_ANTSIGNAL)); + ceh->rssi = *offsets[IEEE80211_RADIOTAP_DBM_ANTSIGNAL]; if (rt_el_present(th, IEEE80211_RADIOTAP_DBM_ANTNOISE)) - ceh->silence = *((u_int8_t *) rt_el_offset(th, IEEE80211_RADIOTAP_DBM_ANTNOISE)); + ceh->silence = *offsets[IEEE80211_RADIOTAP_DBM_ANTNOISE]; if (rt_el_present(th, IEEE80211_RADIOTAP_DB_ANTSIGNAL)) - ceh->rssi = *((u_int8_t *) rt_el_offset(th, IEEE80211_RADIOTAP_DB_ANTSIGNAL)); + ceh->rssi = *offsets[IEEE80211_RADIOTAP_DB_ANTSIGNAL]; if (rt_el_present(th, IEEE80211_RADIOTAP_DB_ANTNOISE)) - ceh->silence = *((u_int8_t *) rt_el_offset(th, IEEE80211_RADIOTAP_DB_ANTNOISE)); + ceh->silence = *offsets[IEEE80211_RADIOTAP_DB_ANTNOISE]; if (rt_el_present(th, IEEE80211_RADIOTAP_RX_FLAGS)) { - u_int16_t flags = le16_to_cpu(*((u_int16_t *) rt_el_offset(th, IEEE80211_RADIOTAP_RX_FLAGS))); + u_int16_t flags = le16_to_cpu(*((u_int16_t *) offsets[IEEE80211_RADIOTAP_RX_FLAGS])); if (flags & IEEE80211_RADIOTAP_F_RX_BADFCS) ceh->flags |= WIFI_EXTRA_RX_ERR; } if (rt_el_present(th, IEEE80211_RADIOTAP_TX_FLAGS)) { - u_int16_t flags = le16_to_cpu(*((u_int16_t *) rt_el_offset(th, IEEE80211_RADIOTAP_TX_FLAGS))); + u_int16_t flags = le16_to_cpu(*((u_int16_t *) offsets[IEEE80211_RADIOTAP_TX_FLAGS])); ceh->flags |= WIFI_EXTRA_TX; if (flags & IEEE80211_RADIOTAP_F_TX_FAIL) ceh->flags |= WIFI_EXTRA_TX_FAIL; } if (rt_el_present(th, IEEE80211_RADIOTAP_DATA_RETRIES)) - ceh->retries = *((u_int8_t *) rt_el_offset(th, IEEE80211_RADIOTAP_DATA_RETRIES)); + ceh->retries = *offsets[IEEE80211_RADIOTAP_DATA_RETRIES]; p->pull(le16_to_cpu(th->it_len)); p->set_mac_header(p->data()); // reset mac-header pointer -- 1.8.3.2 From matteo at openwrt.org Thu Nov 14 13:33:12 2013 From: matteo at openwrt.org (Matteo Croce) Date: Thu, 14 Nov 2013 19:33:12 +0100 Subject: [Click] [PATCH] Fix configure error In-Reply-To: References: <1384423380-17584-1-git-send-email-matteo@openwrt.org> Message-ID: Hi Eddie, this is a minimal set of CFLAGS that make the configure tests fail: $(call cc-option, -mno-check-zero-division) -DVMLINUX_LOAD_ADDRESS="0xffffffff80060000" Cheers, Matteo 2013/11/14 Eddie Kohler : > Hi Matteo, > > Argh, the process of extracting flags from Linux. Can you give a > sample of the flags that were causing a problem? Getting rid of the > special characters might not be good enough; we might need to > recursively expand the make variables. > > Eddie > > > On Thu, Nov 14, 2013 at 5:03 AM, Matteo Croce wrote: >> Strip special characters like $ or " from CFLAGS which causes all configure test to fail >> --- >> configure | 2 +- >> configure.in | 2 +- >> 2 files changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/configure b/configure >> index 83632c5..d422f4e 100755 >> --- a/configure >> +++ b/configure >> @@ -10693,7 +10693,7 @@ $as_echo_n "checking for Linux kernel compilation flags... " >&6; } >> echo >conftest.c >> make -C $linux_builddir M="`pwd`" $linux_makeargs --no-print-directory -p conftest.o >conftest.dat 2>&1 >> for v in KBUILD_CPPFLAGS KBUILD_CFLAGS CPPFLAGS CFLAGS LINUXINCLUDE debug_flags; do >> - eval l$v="'""`grep ^$v' *:*=' conftest.dat | sed s/^$v' *:*= *//'`""'" >> + eval l$v="'""`grep ^$v' *:*=' conftest.dat | sed -e s/^$v' *:*= *//' -e 's/\$\(.*\)//' -e 's/"//g'`""'" >> done >> if test -z "$lKBUILD_CPPFLAGS$lKBUILD_CFLAGS$lCPPFLAGS$lCFLAGS$lLINUXINCLUDE"; then >> { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 >> diff --git a/configure.in b/configure.in >> index 869cacb..2f699e1 100644 >> --- a/configure.in >> +++ b/configure.in >> @@ -1224,7 +1224,7 @@ if test $ac_have_linux_kernel = y; then >> echo >conftest.c >> make -C $linux_builddir M="`pwd`" $linux_makeargs --no-print-directory -p conftest.o >conftest.dat 2>&1 >> for v in KBUILD_CPPFLAGS KBUILD_CFLAGS CPPFLAGS CFLAGS LINUXINCLUDE debug_flags; do >> - eval l$v="'""`grep ^$v' *:*=' conftest.dat | sed s/^$v' *:*= *//'`""'" >> + eval l$v="'""`grep ^$v' *:*=' conftest.dat | sed -e s/^$v' *:*= *//' -e 's/\$\(.*\)//' -e 's/"//g'`""'" >> done >> if test -z "$lKBUILD_CPPFLAGS$lKBUILD_CFLAGS$lCPPFLAGS$lCFLAGS$lLINUXINCLUDE"; then >> AC_MSG_RESULT([not found]) >> -- >> 1.8.3.2 >> >> _______________________________________________ >> click mailing list >> click at amsterdam.lcs.mit.edu >> https://amsterdam.lcs.mit.edu/mailman/listinfo/click -- Matteo Croce OpenWrt Developer _______ ________ __ | |.-----.-----.-----.| | | |.----.| |_ | - || _ | -__| || | | || _|| _| |_______|| __|_____|__|__||________||__| |____| |__| W I R E L E S S F R E E D O M ----------------------------------------------------- BARRIER BREAKER ----------------------------------------------------- * 1/2 oz Galliano Pour all ingredients into * 4 oz cold Coffee an irish coffee mug filled * 1 1/2 oz Dark Rum with crushed ice. Stir. * 2 tsp. Creme de Cacao ----------------------------------------------------- From ekohler at gmail.com Fri Nov 15 10:53:36 2013 From: ekohler at gmail.com (Eddie Kohler) Date: Fri, 15 Nov 2013 10:53:36 -0500 Subject: [Click] [PATCH] speedup radiotap parser In-Reply-To: <1384453883-5559-1-git-send-email-matteo@openwrt.org> References: <1384453883-5559-1-git-send-email-matteo@openwrt.org> Message-ID: Hi Matteo, (1) Can you send patches like this via Github pull requests? (2) I'd prefer for `offsets` to be a parameter rather than a global (for multithread safety). If you can't do this I will sometime. Eddie On Thu, Nov 14, 2013 at 1:31 PM, Matteo Croce wrote: > Scan the radiotap header once per packet thus reducing > the parser complexity from O(n^2) to O(n) > --- > elements/wifi/radiotapdecap.cc | 37 ++++++++++++++++--------------------- > 1 file changed, 16 insertions(+), 21 deletions(-) > > diff --git a/elements/wifi/radiotapdecap.cc b/elements/wifi/radiotapdecap.cc > index e30f84d..ab91788 100644 > --- a/elements/wifi/radiotapdecap.cc > +++ b/elements/wifi/radiotapdecap.cc > @@ -50,6 +50,8 @@ static const int radiotap_elem_to_bytes[NUM_RADIOTAP_ELEMENTS] = > 1, /* IEEE80211_RADIOTAP_DATA_RETRIES */ > }; > > +static u_int8_t *offsets[NUM_RADIOTAP_ELEMENTS]; > + > static int rt_el_present(struct ieee80211_radiotap_header *th, u_int32_t element) > { > if (element > NUM_RADIOTAP_ELEMENTS) > @@ -61,6 +63,8 @@ static int rt_check_header(struct ieee80211_radiotap_header *th, int len) > { > int bytes = 0; > int x = 0; > + u_int8_t *ptr = (u_int8_t *)(th + 1); > + > if (th->it_version != 0) { > return 0; > } > @@ -70,8 +74,10 @@ static int rt_check_header(struct ieee80211_radiotap_header *th, int len) > } > > for (x = 0; x < NUM_RADIOTAP_ELEMENTS; x++) { > - if (rt_el_present(th, x)) > + if (rt_el_present(th, x)) { > + offsets[x] = ptr + bytes; > bytes += radiotap_elem_to_bytes[x]; > + } > } > > if (le16_to_cpu(th->it_len) < sizeof(struct ieee80211_radiotap_header) + bytes) { > @@ -85,17 +91,6 @@ static int rt_check_header(struct ieee80211_radiotap_header *th, int len) > return 1; > } > > -static u_int8_t *rt_el_offset(struct ieee80211_radiotap_header *th, u_int32_t element) { > - unsigned int x = 0; > - u_int8_t *offset = ((u_int8_t *) th) + sizeof(ieee80211_radiotap_header); > - for (x = 0; x < NUM_RADIOTAP_ELEMENTS && x < element; x++) { > - if (rt_el_present(th, x)) > - offset += radiotap_elem_to_bytes[x]; > - } > - > - return offset; > -} > - > RadiotapDecap::RadiotapDecap() > { > } > @@ -121,7 +116,7 @@ RadiotapDecap::simple_action(Packet *p) > ceh->magic = WIFI_EXTRA_MAGIC; > > if (rt_el_present(th, IEEE80211_RADIOTAP_FLAGS)) { > - u_int8_t flags = *((u_int8_t *) rt_el_offset(th, IEEE80211_RADIOTAP_FLAGS)); > + u_int8_t flags = *offsets[IEEE80211_RADIOTAP_FLAGS]; > if (flags & IEEE80211_RADIOTAP_F_DATAPAD) { > ceh->pad = 1; > } > @@ -131,36 +126,36 @@ RadiotapDecap::simple_action(Packet *p) > } > > if (rt_el_present(th, IEEE80211_RADIOTAP_RATE)) { > - ceh->rate = *((u_int8_t *) rt_el_offset(th, IEEE80211_RADIOTAP_RATE)); > + ceh->rate = *offsets[IEEE80211_RADIOTAP_RATE]; > } > > if (rt_el_present(th, IEEE80211_RADIOTAP_DBM_ANTSIGNAL)) > - ceh->rssi = *((u_int8_t *) rt_el_offset(th, IEEE80211_RADIOTAP_DBM_ANTSIGNAL)); > + ceh->rssi = *offsets[IEEE80211_RADIOTAP_DBM_ANTSIGNAL]; > > if (rt_el_present(th, IEEE80211_RADIOTAP_DBM_ANTNOISE)) > - ceh->silence = *((u_int8_t *) rt_el_offset(th, IEEE80211_RADIOTAP_DBM_ANTNOISE)); > + ceh->silence = *offsets[IEEE80211_RADIOTAP_DBM_ANTNOISE]; > > if (rt_el_present(th, IEEE80211_RADIOTAP_DB_ANTSIGNAL)) > - ceh->rssi = *((u_int8_t *) rt_el_offset(th, IEEE80211_RADIOTAP_DB_ANTSIGNAL)); > + ceh->rssi = *offsets[IEEE80211_RADIOTAP_DB_ANTSIGNAL]; > > if (rt_el_present(th, IEEE80211_RADIOTAP_DB_ANTNOISE)) > - ceh->silence = *((u_int8_t *) rt_el_offset(th, IEEE80211_RADIOTAP_DB_ANTNOISE)); > + ceh->silence = *offsets[IEEE80211_RADIOTAP_DB_ANTNOISE]; > > if (rt_el_present(th, IEEE80211_RADIOTAP_RX_FLAGS)) { > - u_int16_t flags = le16_to_cpu(*((u_int16_t *) rt_el_offset(th, IEEE80211_RADIOTAP_RX_FLAGS))); > + u_int16_t flags = le16_to_cpu(*((u_int16_t *) offsets[IEEE80211_RADIOTAP_RX_FLAGS])); > if (flags & IEEE80211_RADIOTAP_F_RX_BADFCS) > ceh->flags |= WIFI_EXTRA_RX_ERR; > } > > if (rt_el_present(th, IEEE80211_RADIOTAP_TX_FLAGS)) { > - u_int16_t flags = le16_to_cpu(*((u_int16_t *) rt_el_offset(th, IEEE80211_RADIOTAP_TX_FLAGS))); > + u_int16_t flags = le16_to_cpu(*((u_int16_t *) offsets[IEEE80211_RADIOTAP_TX_FLAGS])); > ceh->flags |= WIFI_EXTRA_TX; > if (flags & IEEE80211_RADIOTAP_F_TX_FAIL) > ceh->flags |= WIFI_EXTRA_TX_FAIL; > } > > if (rt_el_present(th, IEEE80211_RADIOTAP_DATA_RETRIES)) > - ceh->retries = *((u_int8_t *) rt_el_offset(th, IEEE80211_RADIOTAP_DATA_RETRIES)); > + ceh->retries = *offsets[IEEE80211_RADIOTAP_DATA_RETRIES]; > > p->pull(le16_to_cpu(th->it_len)); > p->set_mac_header(p->data()); // reset mac-header pointer > -- > 1.8.3.2 > > _______________________________________________ > click mailing list > click at amsterdam.lcs.mit.edu > https://amsterdam.lcs.mit.edu/mailman/listinfo/click From cmansour at outlook.com Tue Nov 19 10:47:15 2013 From: cmansour at outlook.com (Christopher Mansour) Date: Tue, 19 Nov 2013 10:47:15 -0500 Subject: [Click] Request Help Message-ID: Hi, I am new to click and I am a student. I want to ask couple of questions I appreciate any feedback or help.1- How can we display or read the contents of a .dump file ?2- When I use "clicky" to observe the configuration or .click files, the boxes are overlapped, so if a configuration is big like some examples provided with the click files, the boxes overlap and cannot be distinguished or organized. Is there a way to organize them ? Thanks. Chris From matteo at openwrt.org Tue Nov 19 10:50:52 2013 From: matteo at openwrt.org (Matteo Croce) Date: Tue, 19 Nov 2013 16:50:52 +0100 Subject: [Click] [PATCH] speedup radiotap parser In-Reply-To: References: <1384453883-5559-1-git-send-email-matteo@openwrt.org> Message-ID: I made the pull request on github 2013/11/15 Eddie Kohler > Hi Matteo, > > (1) Can you send patches like this via Github pull requests? > (2) I'd prefer for `offsets` to be a parameter rather than a global > (for multithread safety). If you can't do this I will sometime. > > Eddie > > > On Thu, Nov 14, 2013 at 1:31 PM, Matteo Croce wrote: > > Scan the radiotap header once per packet thus reducing > > the parser complexity from O(n^2) to O(n) > > --- > > elements/wifi/radiotapdecap.cc | 37 > ++++++++++++++++--------------------- > > 1 file changed, 16 insertions(+), 21 deletions(-) > > > > diff --git a/elements/wifi/radiotapdecap.cc > b/elements/wifi/radiotapdecap.cc > > index e30f84d..ab91788 100644 > > --- a/elements/wifi/radiotapdecap.cc > > +++ b/elements/wifi/radiotapdecap.cc > > @@ -50,6 +50,8 @@ static const int > radiotap_elem_to_bytes[NUM_RADIOTAP_ELEMENTS] = > > 1, /* IEEE80211_RADIOTAP_DATA_RETRIES */ > > }; > > > > +static u_int8_t *offsets[NUM_RADIOTAP_ELEMENTS]; > > + > > static int rt_el_present(struct ieee80211_radiotap_header *th, > u_int32_t element) > > { > > if (element > NUM_RADIOTAP_ELEMENTS) > > @@ -61,6 +63,8 @@ static int rt_check_header(struct > ieee80211_radiotap_header *th, int len) > > { > > int bytes = 0; > > int x = 0; > > + u_int8_t *ptr = (u_int8_t *)(th + 1); > > + > > if (th->it_version != 0) { > > return 0; > > } > > @@ -70,8 +74,10 @@ static int rt_check_header(struct > ieee80211_radiotap_header *th, int len) > > } > > > > for (x = 0; x < NUM_RADIOTAP_ELEMENTS; x++) { > > - if (rt_el_present(th, x)) > > + if (rt_el_present(th, x)) { > > + offsets[x] = ptr + bytes; > > bytes += radiotap_elem_to_bytes[x]; > > + } > > } > > > > if (le16_to_cpu(th->it_len) < sizeof(struct > ieee80211_radiotap_header) + bytes) { > > @@ -85,17 +91,6 @@ static int rt_check_header(struct > ieee80211_radiotap_header *th, int len) > > return 1; > > } > > > > -static u_int8_t *rt_el_offset(struct ieee80211_radiotap_header *th, > u_int32_t element) { > > - unsigned int x = 0; > > - u_int8_t *offset = ((u_int8_t *) th) + > sizeof(ieee80211_radiotap_header); > > - for (x = 0; x < NUM_RADIOTAP_ELEMENTS && x < element; x++) { > > - if (rt_el_present(th, x)) > > - offset += radiotap_elem_to_bytes[x]; > > - } > > - > > - return offset; > > -} > > - > > RadiotapDecap::RadiotapDecap() > > { > > } > > @@ -121,7 +116,7 @@ RadiotapDecap::simple_action(Packet *p) > > ceh->magic = WIFI_EXTRA_MAGIC; > > > > if (rt_el_present(th, IEEE80211_RADIOTAP_FLAGS)) { > > - u_int8_t flags = *((u_int8_t *) rt_el_offset(th, > IEEE80211_RADIOTAP_FLAGS)); > > + u_int8_t flags = > *offsets[IEEE80211_RADIOTAP_FLAGS]; > > if (flags & IEEE80211_RADIOTAP_F_DATAPAD) { > > ceh->pad = 1; > > } > > @@ -131,36 +126,36 @@ RadiotapDecap::simple_action(Packet *p) > > } > > > > if (rt_el_present(th, IEEE80211_RADIOTAP_RATE)) { > > - ceh->rate = *((u_int8_t *) rt_el_offset(th, > IEEE80211_RADIOTAP_RATE)); > > + ceh->rate = *offsets[IEEE80211_RADIOTAP_RATE]; > > } > > > > if (rt_el_present(th, IEEE80211_RADIOTAP_DBM_ANTSIGNAL)) > > - ceh->rssi = *((u_int8_t *) rt_el_offset(th, > IEEE80211_RADIOTAP_DBM_ANTSIGNAL)); > > + ceh->rssi = > *offsets[IEEE80211_RADIOTAP_DBM_ANTSIGNAL]; > > > > if (rt_el_present(th, IEEE80211_RADIOTAP_DBM_ANTNOISE)) > > - ceh->silence = *((u_int8_t *) rt_el_offset(th, > IEEE80211_RADIOTAP_DBM_ANTNOISE)); > > + ceh->silence = > *offsets[IEEE80211_RADIOTAP_DBM_ANTNOISE]; > > > > if (rt_el_present(th, IEEE80211_RADIOTAP_DB_ANTSIGNAL)) > > - ceh->rssi = *((u_int8_t *) rt_el_offset(th, > IEEE80211_RADIOTAP_DB_ANTSIGNAL)); > > + ceh->rssi = > *offsets[IEEE80211_RADIOTAP_DB_ANTSIGNAL]; > > > > if (rt_el_present(th, IEEE80211_RADIOTAP_DB_ANTNOISE)) > > - ceh->silence = *((u_int8_t *) rt_el_offset(th, > IEEE80211_RADIOTAP_DB_ANTNOISE)); > > + ceh->silence = > *offsets[IEEE80211_RADIOTAP_DB_ANTNOISE]; > > > > if (rt_el_present(th, IEEE80211_RADIOTAP_RX_FLAGS)) { > > - u_int16_t flags = le16_to_cpu(*((u_int16_t *) > rt_el_offset(th, IEEE80211_RADIOTAP_RX_FLAGS))); > > + u_int16_t flags = le16_to_cpu(*((u_int16_t *) > offsets[IEEE80211_RADIOTAP_RX_FLAGS])); > > if (flags & IEEE80211_RADIOTAP_F_RX_BADFCS) > > ceh->flags |= WIFI_EXTRA_RX_ERR; > > } > > > > if (rt_el_present(th, IEEE80211_RADIOTAP_TX_FLAGS)) { > > - u_int16_t flags = le16_to_cpu(*((u_int16_t *) > rt_el_offset(th, IEEE80211_RADIOTAP_TX_FLAGS))); > > + u_int16_t flags = le16_to_cpu(*((u_int16_t *) > offsets[IEEE80211_RADIOTAP_TX_FLAGS])); > > ceh->flags |= WIFI_EXTRA_TX; > > if (flags & IEEE80211_RADIOTAP_F_TX_FAIL) > > ceh->flags |= WIFI_EXTRA_TX_FAIL; > > } > > > > if (rt_el_present(th, IEEE80211_RADIOTAP_DATA_RETRIES)) > > - ceh->retries = *((u_int8_t *) rt_el_offset(th, > IEEE80211_RADIOTAP_DATA_RETRIES)); > > + ceh->retries = > *offsets[IEEE80211_RADIOTAP_DATA_RETRIES]; > > > > p->pull(le16_to_cpu(th->it_len)); > > p->set_mac_header(p->data()); // reset mac-header > pointer > > -- > > 1.8.3.2 > > > > _______________________________________________ > > click mailing list > > click at amsterdam.lcs.mit.edu > > https://amsterdam.lcs.mit.edu/mailman/listinfo/click > -- Matteo Croce OpenWrt Developer _______ ________ __ | |.-----.-----.-----.| | | |.----.| |_ | - || _ | -__| || | | || _|| _| |_______|| __|_____|__|__||________||__| |____| |__| W I R E L E S S F R E E D O M ----------------------------------------------------- BARRIER BREAKER ----------------------------------------------------- * 1/2 oz Galliano Pour all ingredients into * 4 oz cold Coffee an irish coffee mug filled * 1 1/2 oz Dark Rum with crushed ice. Stir. * 2 tsp. Creme de Cacao ----------------------------------------------------- From wrightsophia119 at gmail.com Wed Nov 27 03:30:55 2013 From: wrightsophia119 at gmail.com (sophia wright) Date: Wed, 27 Nov 2013 09:30:55 +0100 Subject: [Click] how to create a new packet , and set header fields Message-ID: Hello, i have created my own element on click . at this moment i want to create numbers of TCP-reset packets. I have Dest IP, dest Port, Source IP, source Port , Seq Number and Ack number . Based on the above info , i want to create some numbers of reset packets, Any idea,or some hints , how i could create those with click modular router? General how to create a new packet ,and how i can set its header field? thank you in advance sophia From qq119512 at iii.u-tokyo.ac.jp Thu Nov 28 01:13:30 2013 From: qq119512 at iii.u-tokyo.ac.jp (Hamid Farhadi) Date: Thu, 28 Nov 2013 15:13:30 +0900 Subject: [Click] how to create a new packet , and set header fields In-Reply-To: References: Message-ID: <5296DF0A.7010703@iii.u-tokyo.ac.jp> Hi you may find some hints here. I recieve 2Packet *p" as the input and assign fileds to my own variable. you want the viseversa. make a new packet using WritablePacket:http://read.cs.ucla.edu/click/doxygen/class_writable_packet.html Then do similar thing to assign values check these classes and routines in the Doxygen. Search similar code on the github to find samples: https://github.com/kohler/click EtherAddress _smac; EtherAddress _smac2; EtherAddress _dmac; IPAddress _saddr; IPAddress _daddr; uint16_t _sport; uint16_t _dport; const click_ether *eth = p->ether_header(); const click_ip *iph = p->ip_header(); const click_udp *udph = p->udp_header(); _smac = EtherAddress(eth->ether_shost); _dmac = EtherAddress(eth->ether_dhost); //sa << IPAddress(pick()); //sa << " > " << IPAddress(iph->ip_dst); //click_chatter("src: %s",sa.c_str()); _saddr = iph->ip_src.s_addr; _daddr = iph->ip_dst.s_addr; _sport = udph->uh_sport; _dport = udph->uh_dport; --Hamid On 11/27/13 5:30 PM, sophia wright wrote: > Hello, > > i have created my own element on click . > at this moment i want to create numbers of TCP-reset packets. > I have Dest IP, dest Port, Source IP, source Port , Seq Number and Ack > number . > Based on the above info , i want to create some numbers of reset packets, > Any idea,or some hints , how i could create those with click modular router? > > General how to create a new packet ,and how i can set its header field? > > > thank you in advance > sophia > _______________________________________________ > click mailing list > click at amsterdam.lcs.mit.edu > https://amsterdam.lcs.mit.edu/mailman/listinfo/click > From claudehangui at ymail.com Sat Nov 30 08:32:57 2013 From: claudehangui at ymail.com (Claude Hangui) Date: Sat, 30 Nov 2013 05:32:57 -0800 (PST) Subject: [Click] testing click in a LAN !! Message-ID: <1385818377.27904.YahooMailNeo@web122401.mail.ne1.yahoo.com> Hi everyone... I'm a newbie using click router and I would like to know if it is possible to test one's configuration in a lan ie not connected to the internet. I noticed that most of the scripts present in the conf file work if you are connected to the internet. I modified one of click example to suit my work. I would like to manage qos by setting priority to various services (ie voice, video, data transfer...etc). My problem is before actually testing this config online, I would like to test this in a LAN ie I set my PC as an access point and gateway for my lan so that any request made on the network will pass through my pc on which click router has also been configured. I would like to know if this is possible, and if so how should I actually proceed. Thx in advance.. Claude Hangui?