On 06/13/2012 08:41 AM, Rafael Henrique Faria wrote:
> But my WAN interface is DHCP, and my connection is throw a cable-modem
> (working as a brigde), so my IP address is public, and random, as my gateway,
> 
> My script, uses the UCI to get the current IP address, and the current
> gateway IP address. So I can ping the gateway, and in case of no response,
> restart the connection. It worked very well in 10.3.1.
> 
> But in trunk, the UCI don't show the current IP address, and the current
> gateway IP address... so I'm unable to test the connectivity.
>
> How can I get the current IP address from the wan interface with the new
> UCI? And the gateway IP address too?

I don't know much about UCI but it seems odd to me that you ever could get a
dynamically-assigned IP address from UCI.

Why not change your script to use either the "ip" command (two versions in
menuconfig, a smaller one in busybox as well as the "real" one) or
ifconfig/route (which I believe are in the default config).  This will also
make your script somewhat more portable.

Something like:

IPADDR=$(ifconfig $(uci -P/var/state get network.wan.ifname) | \
   sed -n 's/.*inet addr:\([0-9.]*\).*/\1/p')

etc.

-- David
_______________________________________________
openwrt-users mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-users

Reply via email to