diff options
Diffstat (limited to 'package/network/config/netifd/files/usr')
6 files changed, 243 insertions, 0 deletions
diff --git a/package/network/config/netifd/files/usr/.svn/entries b/package/network/config/netifd/files/usr/.svn/entries new file mode 100644 index 0000000..1f099cf --- /dev/null +++ b/package/network/config/netifd/files/usr/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +36060 +svn://svn.openwrt.org/openwrt/trunk/package/network/config/netifd/files/usr +svn://svn.openwrt.org/openwrt + + + +2012-02-27T16:23:39.874148Z +30741 +nbd + + + + + + + + + + + + + + +3c298f89-4303-0410-b956-a3cf2f4a3e73 + +share +dir + diff --git a/package/network/config/netifd/files/usr/share/.svn/entries b/package/network/config/netifd/files/usr/share/.svn/entries new file mode 100644 index 0000000..b436dab --- /dev/null +++ b/package/network/config/netifd/files/usr/share/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +36060 +svn://svn.openwrt.org/openwrt/trunk/package/network/config/netifd/files/usr/share +svn://svn.openwrt.org/openwrt + + + +2012-02-27T16:23:39.874148Z +30741 +nbd + + + + + + + + + + + + + + +3c298f89-4303-0410-b956-a3cf2f4a3e73 + +udhcpc +dir + diff --git a/package/network/config/netifd/files/usr/share/udhcpc/.svn/entries b/package/network/config/netifd/files/usr/share/udhcpc/.svn/entries new file mode 100644 index 0000000..602e48d --- /dev/null +++ b/package/network/config/netifd/files/usr/share/udhcpc/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +36060 +svn://svn.openwrt.org/openwrt/trunk/package/network/config/netifd/files/usr/share/udhcpc +svn://svn.openwrt.org/openwrt + + + +2012-02-27T16:23:39.874148Z +30741 +nbd + + + + + + + + + + + + + + +3c298f89-4303-0410-b956-a3cf2f4a3e73 + +default.script +file + + + + +2013-03-17T12:13:19.000000Z +021bccd0bcd3a0f5f6166fccc54ef30d +2012-02-27T16:23:39.874148Z +30741 +nbd +has-props + + + + + + + + + + + + + + + + + + + + +1346 + diff --git a/package/network/config/netifd/files/usr/share/udhcpc/.svn/prop-base/default.script.svn-base b/package/network/config/netifd/files/usr/share/udhcpc/.svn/prop-base/default.script.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/package/network/config/netifd/files/usr/share/udhcpc/.svn/prop-base/default.script.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/package/network/config/netifd/files/usr/share/udhcpc/.svn/text-base/default.script.svn-base b/package/network/config/netifd/files/usr/share/udhcpc/.svn/text-base/default.script.svn-base new file mode 100644 index 0000000..ac765a6 --- /dev/null +++ b/package/network/config/netifd/files/usr/share/udhcpc/.svn/text-base/default.script.svn-base @@ -0,0 +1,57 @@ +#!/bin/sh +[ -z "$1" ] && echo "Error: should be run by udhcpc" && exit 1 + +set_classless_routes() { + local max=128 + local type + while [ -n "$1" -a -n "$2" -a $max -gt 0 ]; do + [ ${1##*/} -eq 32 ] && type=host || type=net + echo "udhcpc: adding route for $type $1 via $2" + route add -$type "$1" gw "$2" dev "$interface" + max=$(($max-1)) + shift 2 + done +} + +setup_interface() { + echo "udhcpc: ifconfig $interface $ip netmask ${subnet:-255.255.255.0} broadcast ${broadcast:-+}" + ifconfig $interface $ip netmask ${subnet:-255.255.255.0} broadcast ${broadcast:-+} + + [ -n "$router" ] && [ "$router" != "0.0.0.0" ] && [ "$router" != "255.255.255.255" ] && { + echo "udhcpc: setting default routers: $router" + + local valid_gw="" + for i in $router ; do + route add default gw $i dev $interface + valid_gw="${valid_gw:+$valid_gw|}$i" + done + + eval $(route -n | awk ' + /^0.0.0.0\W{9}('$valid_gw')\W/ {next} + /^0.0.0.0/ {print "route del -net "$1" gw "$2";"} + ') + } + + # CIDR STATIC ROUTES (rfc3442) + [ -n "$staticroutes" ] && set_classless_routes $staticroutes + [ -n "$msstaticroutes" ] && set_classless_routes $msstaticroutes +} + + +applied= +case "$1" in + deconfig) + ifconfig "$interface" 0.0.0.0 + ;; + renew) + setup_interface update + ;; + bound) + setup_interface ifup + ;; +esac + +# user rules +[ -f /etc/udhcpc.user ] && . /etc/udhcpc.user + +exit 0 diff --git a/package/network/config/netifd/files/usr/share/udhcpc/default.script b/package/network/config/netifd/files/usr/share/udhcpc/default.script new file mode 100755 index 0000000..ac765a6 --- /dev/null +++ b/package/network/config/netifd/files/usr/share/udhcpc/default.script @@ -0,0 +1,57 @@ +#!/bin/sh +[ -z "$1" ] && echo "Error: should be run by udhcpc" && exit 1 + +set_classless_routes() { + local max=128 + local type + while [ -n "$1" -a -n "$2" -a $max -gt 0 ]; do + [ ${1##*/} -eq 32 ] && type=host || type=net + echo "udhcpc: adding route for $type $1 via $2" + route add -$type "$1" gw "$2" dev "$interface" + max=$(($max-1)) + shift 2 + done +} + +setup_interface() { + echo "udhcpc: ifconfig $interface $ip netmask ${subnet:-255.255.255.0} broadcast ${broadcast:-+}" + ifconfig $interface $ip netmask ${subnet:-255.255.255.0} broadcast ${broadcast:-+} + + [ -n "$router" ] && [ "$router" != "0.0.0.0" ] && [ "$router" != "255.255.255.255" ] && { + echo "udhcpc: setting default routers: $router" + + local valid_gw="" + for i in $router ; do + route add default gw $i dev $interface + valid_gw="${valid_gw:+$valid_gw|}$i" + done + + eval $(route -n | awk ' + /^0.0.0.0\W{9}('$valid_gw')\W/ {next} + /^0.0.0.0/ {print "route del -net "$1" gw "$2";"} + ') + } + + # CIDR STATIC ROUTES (rfc3442) + [ -n "$staticroutes" ] && set_classless_routes $staticroutes + [ -n "$msstaticroutes" ] && set_classless_routes $msstaticroutes +} + + +applied= +case "$1" in + deconfig) + ifconfig "$interface" 0.0.0.0 + ;; + renew) + setup_interface update + ;; + bound) + setup_interface ifup + ;; +esac + +# user rules +[ -f /etc/udhcpc.user ] && . /etc/udhcpc.user + +exit 0 |