OpenWrt Forum Archive

Topic: Optimized and feature rich trunk build for select routers

The content of this topic has been archived between 20 Aug 2014 and 5 May 2018. Unfortunately there are posts – most likely complete pages – missing.

@bole5: can you package your script and add it to openwrt packages at github?

Good idea, it's nice and simplistic smile

@carpenoctem

I'll have a look myself when I get the time, if there is an issue on a clean flash I will get it sorted tongue

(Last edited by arokh on 11 Oct 2015, 01:31)

Hey arokh,

you mentioned I think earlier that you had no way of determining which radio was 5GHz on C7, I've made a crude script which you can use.

case $(iwinfo wlan0 info | grep "5.180" | wc -l) in
   1*)
     echo "wlan0 is 5.18GHz"
   ;;
   *)
     echo "wlan0 is not 5.18GHz"
   ;;
esac

Obviously this only prints if the wlan0 is 5GHz and doesnt actually set the name accordingly.

Anyways, keep up the good work!

johanrd wrote:

Hey arokh,

you mentioned I think earlier that you had no way of determining which radio was 5GHz on C7, I've made a crude script which you can use.

case $(iwinfo wlan0 info | grep "5.180" | wc -l) in
   1*)
     echo "wlan0 is 5.18GHz"
   ;;
   *)
     echo "wlan0 is not 5.18GHz"
   ;;
esac

Obviously this only prints if the wlan0 is 5GHz and doesnt actually set the name accordingly.

Anyways, keep up the good work!


Hi there.

What about 'iwinfo wlan0 freq' ?? Provides more exact knowledge of the frequency.

iwinfo wlan0 freq | awk '/\*/ {print $2,$3}'

Even better!

masta wrote:

Hi there.

What about 'iwinfo wlan0 freq' ?? Provides more exact knowledge of the frequency.

iwinfo wlan0 freq | awk '/\*/ {print $2,$3}'

Thanks for this. Do you know if that would work in uci-defaults script?

It should work fine, see my case statement. Instead of printing to screen you can issue a uci command.
Masta's iwinfo command is cleaner so use that.

You should be able to use a script like:

#!/bin/sh

case $(iwinfo wlan0 freq | awk '/\*/ {print $2,$3}') in
   5.180*)
     uci set wireless.@wifi-iface[0].ssid='Openwrt 5GHz'
     uci set wireless.@wifi-iface[1].ssid='Openwrt 2GHz'
     uci commit
   ;;
   *)
     uci set wireless.@wifi-iface[1].ssid='Openwrt 5GHz'
     uci set wireless.@wifi-iface[0].ssid='Openwrt 2GHz'
     uci commit
   ;;
esac

(Last edited by johanrd on 12 Oct 2015, 07:21)

johanrd wrote:

It should work fine, see my case statement. Instead of printing to screen yiu can issue a uci command.
Masta's iwinfo command is cleaner so use that.

Have you tried that in uci-defaults scripts? A lot of things outside of uci commands do not work there.

stangri wrote:

Have you tried that in uci-defaults scripts? A lot of things outside of uci commands do not work there.

No I havent yet, but something similar used to be in Arokh's script.
I have a uci script I run after I've installed a new firmware, I'll add it there and will have a play tonight.

UCI defaults are run very early in the boot process. Anyways, it's not just about finding the 5GHz there is also routers with only one radio and even three radios. I'd like to keep the build generic enough to build for other routers as well, and renaming the 5GHz isn't a huge deal smile

very true. Maybe more something for the post install script that at least I run, to set my own settings (dyndns, radios, dhcp etc).

arokh wrote:

UCI defaults are run very early in the boot process. Anyways, it's not just about finding the 5GHz there is also routers with only one radio and even three radios. I'd like to keep the build generic enough to build for other routers as well, and renaming the 5GHz isn't a huge deal smile

Completely understand, if you could help me figure out how to build my own image for personal consumption I'd be much obliged tho.

I've noticed the order of radios change depending on the firmware I'm using (so between firmware-3 and firmware-4 it's completely reversed) so ideally I'd like to build the uci-defaults script which will take that into account and dynamically find out radio capabilities.

If you have any suggestion on how can I do that I'd be very grateful.

The buildroot is well documented and instructions for my source is on the first page. As for the radios you have suggestions on this very page.

Hi @arokh,

Do you think it's worth to make a isolated vlan/network for IoT (you know, Smart TVs and all kind of insecure and very exploitable stuff) ? If so, I humbly would like to left this as a suggestion to your uci-defaults/99-arokh smile

I don't think most people are that paranoid about their home network, including me.

arokh wrote:

The buildroot is well documented and instructions for my source is on the first page. As for the radios you have suggestions on this very page.

Yeah, nothing that'd work for uci-defaults tho. sad

Downloaded the gzip of the source files and I have a question. So you're running the pixelserv with uhttpd on 192.168.3.254:81 and I found the following in firewall.user:

# Redirects HTTP traffic destined for adhosts to ourself on port 81 where we serve the transparent gif
iptables -w -t nat -A prerouting_rule -p tcp -d 192.168.3.254 --dport 80 -j REDIRECT --to-ports 81
# Make sure that traffic to the pixelserver does not get redirected to Tor
iptables -w -t nat -A prerouting_rule -p tcp -d 192.168.3.254 -j ACCEPT
# Reject anything else to the adhost
iptables -w -A forwarding_rule -d 192.168.3.254 -j REJECT

Did I miss the network alias setup somewhere for that IP? Just these rules and pixelserv running on 192.168.3.254:81 doesn't seem to work for me -- if I just hit http://192.168.3.254 it just times out.

Thanks!

Try on a clean flash, it should work. 192.168.3.254 is a bogus address, look at the comment and the rule, it just redirects to itself, uhttpd listens on port 81.

EDIT: Works fine on clean flash.

@carpenoctem

Same for you, Tor SSID works great on clean flash. No problem with DNS lookups here with the Tor/VPN rule turned on. Make sure that your client isn't set to use an external DNS.

(Last edited by arokh on 14 Oct 2015, 21:59)

@arokh
I want you to note that the command to refresh the adblock bad hosts in root's crontab is not correct.
The right command, as per bole5 post, is:

/etc/init.d/adblock reload 2>&1 >> /tmp/adblock.log

Thank you for all your work.

It's the same command, without redirection of stdin/stdout to a file.

arokh wrote:

Try on a clean flash, it should work. 192.168.3.254 is a bogus address, look at the comment and the rule, it just redirects to itself, uhttpd listens on port 81.

Brainfart, forgot to restart dnsmasq -- everything is working just fine with those commands in firewall.user. wink

arokh wrote:

It's the same command, without redirection of stdin/stdout to a file.

I was not refering to the redirection, I know what is it.
I'm refering to the parameter passed to adblock. In your crontab the command is

/etc/init.d/adblock refresh

instead of the bole5's command

/etc/init.d/adblock reload

I've tried the command with parameter "refresh" directly in the shell and it does nothing giving me the list of possible parameters available.
All of those tests made after a fresh install.

(Last edited by rafee on 15 Oct 2015, 07:43)

Doh, you are right off course smile rebuilding, thx

The archer_cx folder didn't get r47187, did you forget to upload that? tongue

Sorry, posts 2501 to 2500 are missing from our archive.