diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-10-10 12:32:29 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2012-10-10 12:32:29 +0000 |
commit | 405e21d16731b2764ab82aaaadcf36a813b105f7 (patch) | |
tree | c6f9a8402389a5081519b91ce62c4a8cafcb8917 /package/netifd/files | |
parent | d0ec348ded6f715b43b396b06ccb10599b37969d (diff) | |
download | mtk-20170518-405e21d16731b2764ab82aaaadcf36a813b105f7.zip mtk-20170518-405e21d16731b2764ab82aaaadcf36a813b105f7.tar.gz mtk-20170518-405e21d16731b2764ab82aaaadcf36a813b105f7.tar.bz2 |
packages: sort network related packages into package/network/
SVN-Revision: 33688
Diffstat (limited to 'package/netifd/files')
-rw-r--r-- | package/netifd/files/etc/hotplug.d/iface/00-netstate | 8 | ||||
-rw-r--r-- | package/netifd/files/etc/hotplug.d/iface/10-sysctl | 36 | ||||
-rwxr-xr-x | package/netifd/files/etc/init.d/network | 47 | ||||
-rwxr-xr-x | package/netifd/files/lib/netifd/dhcp.script | 59 | ||||
-rwxr-xr-x | package/netifd/files/lib/netifd/proto/dhcp.sh | 49 | ||||
-rwxr-xr-x | package/netifd/files/lib/network/config.sh | 79 | ||||
-rwxr-xr-x | package/netifd/files/sbin/devstatus | 12 | ||||
l--------- | package/netifd/files/sbin/ifdown | 1 | ||||
-rwxr-xr-x | package/netifd/files/sbin/ifstatus | 13 | ||||
-rwxr-xr-x | package/netifd/files/sbin/ifup | 79 | ||||
-rwxr-xr-x | package/netifd/files/usr/share/udhcpc/default.script | 57 |
11 files changed, 0 insertions, 440 deletions
diff --git a/package/netifd/files/etc/hotplug.d/iface/00-netstate b/package/netifd/files/etc/hotplug.d/iface/00-netstate deleted file mode 100644 index c50cda6..0000000 --- a/package/netifd/files/etc/hotplug.d/iface/00-netstate +++ /dev/null @@ -1,8 +0,0 @@ -[ ifup = "$ACTION" ] && { - uci_toggle_state network "$INTERFACE" up 1 - uci_toggle_state network "$INTERFACE" connect_time $(sed -ne 's![^0-9].*$!!p' /proc/uptime) - [ -n "$DEVICE" ] && { - uci_toggle_state network "$INTERFACE" device "$(uci -q get network.$INTERFACE.ifname)" - uci_toggle_state network "$INTERFACE" ifname "$DEVICE" - } -} diff --git a/package/netifd/files/etc/hotplug.d/iface/10-sysctl b/package/netifd/files/etc/hotplug.d/iface/10-sysctl deleted file mode 100644 index 33ac5c3..0000000 --- a/package/netifd/files/etc/hotplug.d/iface/10-sysctl +++ /dev/null @@ -1,36 +0,0 @@ -# Skip fake devices (e.g. relayd) -grep -qs "^ *$DEVICE:" /proc/net/dev || exit 0 - -case "$ACTION" in - ifup) - include /lib/network - scan_interfaces - - # Setup sysctls - local proto accept_ra send_rs - - config_get proto "$INTERFACE" proto - if [ "$proto" = dhcp ]; then - accept_ra=1 - send_rs=0 - else - accept_ra=0 - send_rs=1 - fi - - config_get_bool accept_ra "$INTERFACE" accept_ra $accept_ra - [ $accept_ra -eq 0 ] || { - logger -t ifup "Allowing Router Advertisements on $INTERFACE ($DEVICE)" - accept_ra=2 - } - do_sysctl "net.ipv6.conf.$DEVICE.accept_ra" $accept_ra - - config_get_bool send_rs "$INTERFACE" send_rs $send_rs - [ $send_rs -eq 0 ] || { - logger -t ifup "Enabling Router Solicitations on $INTERFACE ($DEVICE)" - send_rs=2 - } - do_sysctl "net.ipv6.conf.$DEVICE.forwarding" $send_rs - ;; -esac - diff --git a/package/netifd/files/etc/init.d/network b/package/netifd/files/etc/init.d/network deleted file mode 100755 index 28b1ba3..0000000 --- a/package/netifd/files/etc/init.d/network +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh /etc/rc.common - -START=20 -STOP=90 - -SERVICE_DAEMONIZE=1 -SERVICE_WRITE_PID=1 - -start() { - stop - [ -e /proc/sys/kernel/core_pattern ] && { - ulimit -c unlimited - echo '/tmp/%e.%p.%s.%t.core' > /proc/sys/kernel/core_pattern - } - service_start /sbin/netifd - - setup_switch() { return 0; } - - include /lib/network - setup_switch - - sleep 1 - - /sbin/wifi down - /sbin/wifi up -} - -restart() { - ifdown -a - sleep 1 - start -} - -shutdown() { - ifdown -a - stop -} - -stop() { - service_stop /sbin/netifd -} - -reload() { - ubus call network reload - /sbin/wifi down - /sbin/wifi up -} diff --git a/package/netifd/files/lib/netifd/dhcp.script b/package/netifd/files/lib/netifd/dhcp.script deleted file mode 100755 index 0097a96..0000000 --- a/package/netifd/files/lib/netifd/dhcp.script +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/sh -[ -z "$1" ] && echo "Error: should be run by udhcpc" && exit 1 - -. /lib/functions.sh -. /lib/netifd/netifd-proto.sh - -set_classless_routes() { - local max=128 - local type - while [ -n "$1" -a -n "$2" -a $max -gt 0 ]; do - proto_add_ipv4_route "${1%%/*}" "${1##*/}" "$2" - max=$(($max-1)) - shift 2 - done -} - -setup_interface () { - proto_init_update "*" 1 - proto_add_ipv4_address "$ip" "${subnet:-255.255.255.0}" - # TODO: apply $broadcast - - for i in $router; do - proto_add_ipv4_route 0.0.0.0 0 "$i" - done - - # CIDR STATIC ROUTES (rfc3442) - [ -n "$staticroutes" ] && set_classless_routes $staticroutes - [ -n "$msstaticroutes" ] && set_classless_routes $msstaticroutes - - for dns in $dns; do - proto_add_dns_server "$dns" - done - for domain in $domain; do - proto_add_dns_search "$domain" - done - proto_send_update "$INTERFACE" - - # TODO - # [ -n "$ntpsrv" ] && change_state network "$ifc" lease_ntpsrv "$ntpsrv" - # [ -n "$timesvr" ] && change_state network "$ifc" lease_timesrv "$timesvr" - # [ -n "$hostname" ] && change_state network "$ifc" lease_hostname "$hostname" - # [ -n "$timezone" ] && change_state network "$ifc" lease_timezone "$timezone" -} - -deconfig_interface() { - proto_init_update "*" 0 - proto_send_update "$INTERFACE" -} - -case "$1" in - deconfig) - deconfig_interface - ;; - renew|bound) - setup_interface - ;; -esac - -exit 0 diff --git a/package/netifd/files/lib/netifd/proto/dhcp.sh b/package/netifd/files/lib/netifd/proto/dhcp.sh deleted file mode 100755 index 9182d58..0000000 --- a/package/netifd/files/lib/netifd/proto/dhcp.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh - -. /lib/functions.sh -. ../netifd-proto.sh -init_proto "$@" - -proto_dhcp_init_config() { - proto_config_add_string "ipaddr" - proto_config_add_string "netmask" - proto_config_add_string "hostname" - proto_config_add_string "clientid" - proto_config_add_string "vendorid" - proto_config_add_boolean "broadcast" - proto_config_add_string "reqopts" -} - -proto_dhcp_setup() { - local config="$1" - local iface="$2" - - local ipaddr hostname clientid vendorid broadcast reqopts - json_get_vars ipaddr hostname clientid vendorid broadcast reqopts - - local opt dhcpopts - for opt in $reqopts; do - append dhcpopts "-O $opt" - done - - [ "$broadcast" = 1 ] && broadcast="-O broadcast" || broadcast= - - proto_export "INTERFACE=$config" - proto_run_command "$config" udhcpc \ - -p /var/run/udhcpc-$iface.pid \ - -s /lib/netifd/dhcp.script \ - -f -t 0 -i "$iface" \ - ${ipaddr:+-r $ipaddr} \ - ${hostname:+-H $hostname} \ - ${clientid:+-x 0x3d:${clientid//:/}} \ - ${vendorid:+-V $vendorid} \ - $broadcast $dhcpopts -} - -proto_dhcp_teardown() { - local interface="$1" - proto_kill_command "$interface" -} - -add_protocol dhcp - diff --git a/package/netifd/files/lib/network/config.sh b/package/netifd/files/lib/network/config.sh deleted file mode 100755 index 9128971..0000000 --- a/package/netifd/files/lib/network/config.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh -# Copyright (C) 2011 OpenWrt.org - -. /usr/share/libubox/jshn.sh - -find_config() { - local device="$1" - local ifdev ifl3dev ifobj - for ifobj in `ubus list network.interface.\*`; do - interface="${ifobj##network.interface.}" - ( - json_load "$(ifstatus $interface)" - json_get_var ifdev device - json_get_var ifl3dev l3_device - if [[ "$device" = "$ifdev" ]] || [[ "$device" = "$ifl3dev" ]]; then - echo "$interface" - exit 0 - else - exit 1 - fi - ) && return - done -} - -unbridge() { - return -} - -ubus_call() { - json_init - local _data="$(ubus -S call "$1" "$2")" - [ -z "$_data" ] && return 1 - json_load "$_data" - return 0 -} - - -fixup_interface() { - local config="$1" - local ifname type device l3dev - - config_get type "$config" type - config_get ifname "$config" ifname - config_get device "$config" device "$ifname" - [ "bridge" = "$type" ] && ifname="br-$config" - config_set "$config" device "$ifname" - ubus_call "network.interface.$config" status || return 0 - json_get_var l3dev l3_device - [ -n "$l3dev" ] && ifname="$l3dev" - json_init - config_set "$config" ifname "$ifname" - config_set "$config" device "$device" -} - -scan_interfaces() { - config_load network - config_foreach fixup_interface interface -} - -prepare_interface_bridge() { - local config="$1" - - [ -n "$config" ] || return 0 - ubus call network.interface."$config" prepare -} - -setup_interface() { - local iface="$1" - local config="$2" - - [ -n "$config" ] || return 0 - ubus call network.interface."$config" add_device "{ \"name\": \"$iface\" }" -} - -do_sysctl() { - [ -n "$2" ] && \ - sysctl -n -e -w "$1=$2" >/dev/null || \ - sysctl -n -e "$1" -} diff --git a/package/netifd/files/sbin/devstatus b/package/netifd/files/sbin/devstatus deleted file mode 100755 index 3c35b26..0000000 --- a/package/netifd/files/sbin/devstatus +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -. /usr/share/libubox/jshn.sh -DEVICE="$1" - -[ -n "$DEVICE" ] || { - echo "Usage: $0 <device>" - exit 1 -} - -json_init -json_add_string name "$DEVICE" -ubus call network.device status "$(json_dump)" diff --git a/package/netifd/files/sbin/ifdown b/package/netifd/files/sbin/ifdown deleted file mode 120000 index a0e5c17..0000000 --- a/package/netifd/files/sbin/ifdown +++ /dev/null @@ -1 +0,0 @@ -ifup
\ No newline at end of file diff --git a/package/netifd/files/sbin/ifstatus b/package/netifd/files/sbin/ifstatus deleted file mode 100755 index 511cc1d..0000000 --- a/package/netifd/files/sbin/ifstatus +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -INTERFACE="$1" - -[ -n "$INTERFACE" ] || { - echo "Usage: $0 <interface>" - exit 1 -} - -ubus -S list "network.interface.$INTERFACE" >/dev/null || { - echo "Interface $INTERFACE not found" - exit 1 -} -ubus call network.interface."$INTERFACE" status diff --git a/package/netifd/files/sbin/ifup b/package/netifd/files/sbin/ifup deleted file mode 100755 index e6dbb35..0000000 --- a/package/netifd/files/sbin/ifup +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh - -ifup_all= -setup_wifi= - -if_call() { - local interface="$1" - for mode in $modes; do - ubus call $interface $mode - done -} - -case "$0" in - *ifdown) modes=down;; - *ifup) - modes="down up" - setup_wifi=1 - ;; - *) echo "Invalid command: $0";; -esac - -while :; do - case "$1" in - -a) - ifup_all=1 - shift - ;; - -w) - setup_wifi= - shift - ;; - *) - break - ;; - esac -done - -[ "$modes" = "down up" ] && ubus call network reload -if [ -n "$ifup_all" ]; then - for interface in `ubus -S list 'network.interface.*'`; do - if_call "$interface" - done - [ -n "$setup_wifi" ] && /sbin/wifi up - exit -else - ubus -S list "network.interface.$1" > /dev/null || { - echo "Interface $1 not found" - exit - } - if_call "network.interface.$1" -fi - -if [ -n "$setup_wifi" ] && grep -sq config /etc/config/wireless; then - . /lib/functions.sh - - find_related_radios() { - local wdev wnet - config_get wdev "$1" device - config_get wnet "$1" network - - if [ -n "$wdev" ]; then - for wnet in $wnet; do - if [ "$wnet" = "$network" ]; then - append radio_devs "$wdev" "$N" - fi - done - fi - } - - local radio_devs - local network="$1" - config_load wireless - config_foreach find_related_radios wifi-iface - - local dev - for dev in $(echo "$radio_devs" | sort -u); do - /sbin/wifi up "$dev" - done -fi diff --git a/package/netifd/files/usr/share/udhcpc/default.script b/package/netifd/files/usr/share/udhcpc/default.script deleted file mode 100755 index ac765a6..0000000 --- a/package/netifd/files/usr/share/udhcpc/default.script +++ /dev/null @@ -1,57 +0,0 @@ -#!/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 |