Coovachilli + local ip

I'm tinkering with my nanopi neo2 and finally managed to build OpenWrt from source.
It's so much lighter than Armbian, and hopefully I could build the WiringNP on it.

I have basic coovachilli setup and still figuring out settings, it seems to be working.
My nanopi is setup as dhcp client, with an old Asus USB n-13 wifi dongle (I have it for a long time but never works untill now).

I'd like to know how I can pass local ip address of eth0 after it get it's address from the router
to chilli configuration.

I looked at /etc/init.d/chilli. I could almost understand what's going on there...but not really :blush:
I'm thinking that I could do something like this in the startup script:

. /lib/functions/
local ip
network_get_ipaddr ip "$2"
echo "uamserver=http://\"$ip\"/hotspot/hotspotlogin.php" >> "$chilli_conf"

That above is an imagined function, knowing very little about scripting and imitated from chilli startup script.

Check if you can use localhost or, otherwise:

. /lib/functions/
network_find_wan NET_IF
network_get_ipaddr NET_ADDR "${NET_IF}"
uci set chilli.@chilli[0].uamserver="http://${NET_ADDR}/..."
/etc/init.d/chilli restart 

And invoke it via hotplug:

1 Like

Thanks..looks like a plan, just have to digest the hotplug and hopefully good to go.
I just tried this on the console:

root@OpenWrt:/# source /lib/functions/
root@OpenWrt:/# network_find_wan NET_IF
root@OpenWrt:/# network_get_ipaddr NET_ADDR "${NET_IF}"
root@OpenWrt:/# echo ${NET_ADDR}

It works :smile:

source /lib/functions/

[ "$ACTION" == "ifup" ] || exit 0

[ "$INTERFACE" = "wan" ] && {

network_find_wan NET_IF
network_get_ipaddr NET_ADDR "${NET_IF}"
uci set chilli.@chilli[0].uamserver="http://${NET_ADDR}/hotspot/login.php"
/etc/init.d/chilli restart


I added it to file 30-chilli I found in hotplug.d/iface
I think I could also add a chilli directory in the hotplug.d
If I'm understanding this (snippets from init.d/chilli )correctly:

service_triggers() {
procd_add_reload_trigger "chilli"

but it works now.

BTW localhost/ didn't work.