On 2012-05-05 9:32 AM, David Woodhouse wrote:
> On Fri, 2012-05-04 at 23:35 -0600, Philip Prindeville wrote:
>> > -find_gw() {
>> > -     route -n | awk '$1 == "0.0.0.0" { print $2; exit }'
>> > +find_route() {
>> > +     ip route get $1 | sed -e 's/ /\n/g' | \
>> > +            sed -ne '1p;/via/{N;p};/dev/{N;p};/src/{N;p};/mtu/{N;p}'
>> 
>> I'd (a) use "ip -4 -o" instead of piping through sed to remove
>> newlines, and (b) use awk munge the fields into the output. 
> 
> Care to express that in 'diff -up' form? Note that it's not "ip -4";
> this doesn't just work for Legacy IP. It works when the VPN server is on
> IPv6 too, and I've tested it that way (in the openconnect incantation at
> least; I haven't done PPTP).
As long as it works, it's not worth putting in effort to clean this up.
This code will be going away soon (replaced by the to-be-written netifd
based script).
The new code will not need iproute2 or such tricks at all.

- Felix
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to