diff --git a/bsp/board/domo/ovl/etc/init.d/boot b/bsp/board/domo/ovl/etc/init.d/boot index e108e714..a0e63a8a 100755 --- a/bsp/board/domo/ovl/etc/init.d/boot +++ b/bsp/board/domo/ovl/etc/init.d/boot @@ -21,7 +21,7 @@ boot() { echo Device hostname is `hostname` # Temporary Hack - ifconfig lo up - ifconfig eth0 up - udhcpc -i eth0 + #ifconfig lo up + #ifconfig eth0 up + #udhcpc -i eth0 } diff --git a/bsp/board/domo/ovl/lib/config/uci.sh b/bsp/board/domo/ovl/lib/config/uci.sh new file mode 100644 index 00000000..50891a64 --- /dev/null +++ b/bsp/board/domo/ovl/lib/config/uci.sh @@ -0,0 +1,137 @@ +#!/bin/sh +# Shell script compatibility wrappers for /sbin/uci +# +# Copyright (C) 2008-2010 OpenWrt.org +# Copyright (C) 2008 Felix Fietkau +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +CONFIG_APPEND= +uci_load() { + local PACKAGE="$1" + local DATA + local RET + local VAR + + _C=0 + if [ -z "$CONFIG_APPEND" ]; then + for VAR in $CONFIG_LIST_STATE; do + export ${NO_EXPORT:+-n} CONFIG_${VAR}= + export ${NO_EXPORT:+-n} CONFIG_${VAR}_LENGTH= + done + export ${NO_EXPORT:+-n} CONFIG_LIST_STATE= + export ${NO_EXPORT:+-n} CONFIG_SECTIONS= + export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=0 + export ${NO_EXPORT:+-n} CONFIG_SECTION= + fi + + DATA="$(/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} ${LOAD_STATE:+-P /var/state} -S -n export "$PACKAGE" 2>/dev/null)" + RET="$?" + [ "$RET" != 0 -o -z "$DATA" ] || eval "$DATA" + unset DATA + + ${CONFIG_SECTION:+config_cb} + return "$RET" +} + +uci_set_default() { + local PACKAGE="$1" + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show "$PACKAGE" > /dev/null && return 0 + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} import "$PACKAGE" + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit "$PACKAGE" +} + +uci_revert_state() { + local PACKAGE="$1" + local CONFIG="$2" + local OPTION="$3" + + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -P /var/state revert "$PACKAGE${CONFIG:+.$CONFIG}${OPTION:+.$OPTION}" +} + +uci_set_state() { + local PACKAGE="$1" + local CONFIG="$2" + local OPTION="$3" + local VALUE="$4" + + [ "$#" = 4 ] || return 0 + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -P /var/state set "$PACKAGE.$CONFIG${OPTION:+.$OPTION}=$VALUE" +} + +uci_toggle_state() { + uci_revert_state "$1" "$2" "$3" + uci_set_state "$1" "$2" "$3" "$4" +} + +uci_set() { + local PACKAGE="$1" + local CONFIG="$2" + local OPTION="$3" + local VALUE="$4" + + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set "$PACKAGE.$CONFIG.$OPTION=$VALUE" +} + +uci_get_state() { + uci_get "$1" "$2" "$3" "$4" "/var/state" +} + +uci_get() { + local PACKAGE="$1" + local CONFIG="$2" + local OPTION="$3" + local DEFAULT="$4" + local STATE="$5" + + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} ${STATE:+-P $STATE} -q get "$PACKAGE${CONFIG:+.$CONFIG}${OPTION:+.$OPTION}" + RET="$?" + [ "$RET" -ne 0 ] && [ -n "$DEFAULT" ] && echo "$DEFAULT" + return "$RET" +} + +uci_add() { + local PACKAGE="$1" + local TYPE="$2" + local CONFIG="$3" + + if [ -z "$CONFIG" ]; then + export ${NO_EXPORT:+-n} CONFIG_SECTION="$(/sbin/uci add "$PACKAGE" "$TYPE")" + else + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set "$PACKAGE.$CONFIG=$TYPE" + export ${NO_EXPORT:+-n} CONFIG_SECTION="$CONFIG" + fi +} + +uci_rename() { + local PACKAGE="$1" + local CONFIG="$2" + local VALUE="$3" + + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} rename "$PACKAGE.$CONFIG=$VALUE" +} + +uci_remove() { + local PACKAGE="$1" + local CONFIG="$2" + local OPTION="$3" + + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} del "$PACKAGE.$CONFIG${OPTION:+.$OPTION}" +} + +uci_commit() { + local PACKAGE="$1" + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit $PACKAGE +} diff --git a/bsp/board/domo/ovl/lib/functions/network.sh b/bsp/board/domo/ovl/lib/functions/network.sh new file mode 100644 index 00000000..1b0c7172 --- /dev/null +++ b/bsp/board/domo/ovl/lib/functions/network.sh @@ -0,0 +1,268 @@ +# 1: destination variable +# 2: interface +# 3: path +# 4: separator +# 5: limit +__network_ifstatus() { + local __tmp + + [ -z "$__NETWORK_CACHE" ] && \ + export __NETWORK_CACHE="$(ubus call network.interface dump)" + + __tmp="$(jsonfilter ${4:+-F "$4"} ${5:+-l "$5"} -s "$__NETWORK_CACHE" -e "$1=@.interface${2:+[@.interface='$2']}$3")" + + [ -z "$__tmp" ] && \ + unset "$1" && \ + return 1 + + eval "$__tmp" +} + +# determine first IPv4 address of given logical interface +# 1: destination variable +# 2: interface +network_get_ipaddr() { + __network_ifstatus "$1" "$2" "['ipv4-address'][0].address"; +} + +# determine first IPv6 address of given logical interface +# 1: destination variable +# 2: interface +network_get_ipaddr6() { + local __addr + + if __network_ifstatus "__addr" "$2" "['ipv6-address','ipv6-prefix-assignment'][0].address"; then + case "$__addr" in + *:) export "$1=${__addr}1" ;; + *) export "$1=${__addr}" ;; + esac + return 0 + fi + + unset $1 + return 1 +} + +# determine first IPv4 subnet of given logical interface +# 1: destination variable +# 2: interface +network_get_subnet() { + __network_ifstatus "$1" "$2" "['ipv4-address'][0]['address','mask']" "/" +} + +# determine first IPv6 subnet of given logical interface +# 1: destination variable +# 2: interface +network_get_subnet6() { + __network_ifstatus "$1" "$2" "['ipv6-address'][0]['address','mask']" "/" +} + +# determine first IPv6 prefix of given logical interface +# 1: destination variable +# 2: interface +network_get_prefix6() { + __network_ifstatus "$1" "$2" "['ipv6-prefix'][0]['address','mask']" "/" +} + +# determine all IPv4 addresses of given logical interface +# 1: destination variable +# 2: interface +network_get_ipaddrs() { + __network_ifstatus "$1" "$2" "['ipv4-address'][*].address" +} + +# determine all IPv6 addresses of given logical interface +# 1: destination variable +# 2: interface +network_get_ipaddrs6() { + local __addr + local __list="" + + if __network_ifstatus "__addr" "$2" "['ipv6-address','ipv6-prefix-assignment'][*].address"; then + for __addr in $__addr; do + case "$__addr" in + *:) __list="${__list:+$__list }${__addr}1" ;; + *) __list="${__list:+$__list }${__addr}" ;; + esac + done + + export "$1=$__list" + return 0 + fi + + unset "$1" + return 1 +} + +# determine all IP addresses of given logical interface +# 1: destination variable +# 2: interface +network_get_ipaddrs_all() { + local __addr + local __list="" + + if __network_ifstatus "__addr" "$2" "['ipv4-address','ipv6-address','ipv6-prefix-assignment'][*].address"; then + for __addr in $__addr; do + case "$__addr" in + *:) __list="${__list:+$__list }${__addr}1" ;; + *) __list="${__list:+$__list }${__addr}" ;; + esac + done + + export "$1=$__list" + return 0 + fi + + unset "$1" + return 1 +} + +# determine all IPv4 subnets of given logical interface +# 1: destination variable +# 2: interface +network_get_subnets() { + __network_ifstatus "$1" "$2" "['ipv4-address'][*]['address','mask']" "/ " +} + +# determine all IPv6 subnets of given logical interface +# 1: destination variable +# 2: interface +network_get_subnets6() { + local __addr + local __list="" + + if __network_ifstatus "__addr" "$2" "['ipv6-address','ipv6-prefix-assignment'][*]['address','mask']" "/ "; then + for __addr in $__addr; do + case "$__addr" in + *:/*) __list="${__list:+$__list }${__addr%/*}1/${__addr##*/}" ;; + *) __list="${__list:+$__list }${__addr}" ;; + esac + done + + export "$1=$__list" + return 0 + fi + + unset "$1" + return 1 +} + +# determine all IPv6 prefixes of given logical interface +# 1: destination variable +# 2: interface +network_get_prefixes6() { + __network_ifstatus "$1" "$2" "['ipv6-prefix'][*]['address','mask']" "/ " +} + +# determine IPv4 gateway of given logical interface +# 1: destination variable +# 2: interface +# 3: consider inactive gateway if "true" (optional) +network_get_gateway() { + __network_ifstatus "$1" "$2" ".route[@.target='0.0.0.0' && !@.table].nexthop" "" 1 && \ + return 0 + + [ "$3" = 1 -o "$3" = "true" ] && \ + __network_ifstatus "$1" "$2" ".inactive.route[@.target='0.0.0.0' && !@.table].nexthop" "" 1 +} + +# determine IPv6 gateway of given logical interface +# 1: destination variable +# 2: interface +# 3: consider inactive gateway if "true" (optional) +network_get_gateway6() { + __network_ifstatus "$1" "$2" ".route[@.target='::' && !@.table].nexthop" "" 1 && \ + return 0 + + [ "$3" = 1 -o "$3" = "true" ] && \ + __network_ifstatus "$1" "$2" ".inactive.route[@.target='::' && !@.table].nexthop" "" 1 +} + +# determine the DNS servers of the given logical interface +# 1: destination variable +# 2: interface +# 3: consider inactive servers if "true" (optional) +network_get_dnsserver() { + __network_ifstatus "$1" "$2" "['dns-server'][*]" && return 0 + + [ "$3" = 1 -o "$3" = "true" ] && \ + __network_ifstatus "$1" "$2" ".inactive['dns-server'][*]" +} + +# determine the domains of the given logical interface +# 1: destination variable +# 2: interface +# 3: consider inactive domains if "true" (optional) +network_get_dnssearch() { + __network_ifstatus "$1" "$2" "['dns-search'][*]" && return 0 + + [ "$3" = 1 -o "$3" = "true" ] && \ + __network_ifstatus "$1" "$2" ".inactive['dns-search'][*]" +} + + +# 1: destination variable +# 2: addr +# 3: inactive +__network_wan() +{ + __network_ifstatus "$1" "" \ + "[@.route[@.target='$2' && !@.table]].interface" "" 1 && \ + return 0 + + [ "$3" = 1 -o "$3" = "true" ] && \ + __network_ifstatus "$1" "" \ + "[@.inactive.route[@.target='$2' && !@.table]].interface" "" 1 +} + +# find the logical interface which holds the current IPv4 default route +# 1: destination variable +# 2: consider inactive default routes if "true" (optional) +network_find_wan() { __network_wan "$1" "0.0.0.0" "$2"; } + +# find the logical interface which holds the current IPv6 default route +# 1: destination variable +# 2: consider inactive dafault routes if "true" (optional) +network_find_wan6() { __network_wan "$1" "::" "$2"; } + +# test whether the given logical interface is running +# 1: interface +network_is_up() +{ + local __up + __network_ifstatus "__up" "$1" ".up" && [ "$__up" = 1 ] +} + +# determine the protocol of the given logical interface +# 1: destination variable +# 2: interface +network_get_protocol() { __network_ifstatus "$1" "$2" ".proto"; } + +# determine the layer 3 linux network device of the given logical interface +# 1: destination variable +# 2: interface +network_get_device() { __network_ifstatus "$1" "$2" ".l3_device"; } + +# determine the layer 2 linux network device of the given logical interface +# 1: destination variable +# 2: interface +network_get_physdev() { __network_ifstatus "$1" "$2" ".device"; } + +# defer netifd actions on the given linux network device +# 1: device name +network_defer_device() +{ + ubus call network.device set_state \ + "$(printf '{ "name": "%s", "defer": true }' "$1")" 2>/dev/null +} + +# continue netifd actions on the given linux network device +# 1: device name +network_ready_device() +{ + ubus call network.device set_state \ + "$(printf '{ "name": "%s", "defer": false }' "$1")" 2>/dev/null +} + +# flush the internal value cache to force re-reading values from ubus +network_flush_cache() { unset __NETWORK_CACHE; } diff --git a/bsp/board/domo/ovl/lib/netifd/dhcp.script b/bsp/board/domo/ovl/lib/netifd/dhcp.script new file mode 100755 index 00000000..b3a61e27 --- /dev/null +++ b/bsp/board/domo/ovl/lib/netifd/dhcp.script @@ -0,0 +1,102 @@ +#!/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 + while [ -n "$1" -a -n "$2" -a $max -gt 0 ]; do + proto_add_ipv4_route "${1%%/*}" "${1##*/}" "$2" "$ip" + 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 "$i" 32 "" "$ip" + proto_add_ipv4_route 0.0.0.0 0 "$i" "$ip" + + for r in $CUSTOMROUTES; do + proto_add_ipv4_route "${r%%/*}" "${r##*/}" "$i" "$ip" + done + 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_add_data + [ -n "$ZONE" ] && json_add_string zone "$ZONE" + [ -n "$ntpsrv" ] && json_add_string ntpserver "$ntpsrv" + [ -n "$timesvr" ] && json_add_string timeserver "$timesvr" + [ -n "$hostname" ] && json_add_string hostname "$hostname" + [ -n "$message" ] && json_add_string message "$message" + [ -n "$timezone" ] && json_add_int timezone "$timezone" + [ -n "$lease" ] && json_add_int leasetime "$lease" + proto_close_data + + proto_send_update "$INTERFACE" + + + if [ "$IFACE6RD" != 0 -a -n "$ip6rd" ]; then + local v4mask="${ip6rd%% *}" + ip6rd="${ip6rd#* }" + local ip6rdprefixlen="${ip6rd%% *}" + ip6rd="${ip6rd#* }" + local ip6rdprefix="${ip6rd%% *}" + ip6rd="${ip6rd#* }" + local ip6rdbr="${ip6rd%% *}" + + [ -n "$ZONE" ] || ZONE=$(fw3 -q network $INTERFACE) + [ -z "$IFACE6RD" -o "$IFACE6RD" = 1 ] && IFACE6RD=${INTERFACE}_6 + + json_init + json_add_string name "$IFACE6RD" + json_add_string ifname "@$INTERFACE" + json_add_string proto "6rd" + json_add_string peeraddr "$ip6rdbr" + json_add_int ip4prefixlen "$v4mask" + json_add_string ip6prefix "$ip6rdprefix" + json_add_int ip6prefixlen "$ip6rdprefixlen" + json_add_string tunlink "$INTERFACE" + [ -n "$IFACE6RD_DELEGATE" ] && json_add_boolean delegate "$IFACE6RD_DELEGATE" + [ -n "$ZONE6RD" ] || ZONE6RD=$ZONE + [ -n "$ZONE6RD" ] && json_add_string zone "$ZONE6RD" + [ -n "$MTU6RD" ] && json_add_string mtu "$MTU6RD" + json_close_object + + ubus call network add_dynamic "$(json_dump)" + fi +} + +deconfig_interface() { + proto_init_update "*" 0 + proto_send_update "$INTERFACE" +} + +case "$1" in + deconfig) + deconfig_interface + ;; + renew|bound) + setup_interface + ;; +esac + +# user rules +[ -f /etc/udhcpc.user ] && . /etc/udhcpc.user "$@" + +exit 0 diff --git a/bsp/board/domo/ovl/lib/netifd/netifd-proto.sh b/bsp/board/domo/ovl/lib/netifd/netifd-proto.sh new file mode 100644 index 00000000..447f0f66 --- /dev/null +++ b/bsp/board/domo/ovl/lib/netifd/netifd-proto.sh @@ -0,0 +1,401 @@ +NETIFD_MAIN_DIR="${NETIFD_MAIN_DIR:-/lib/netifd}" + +. /usr/share/libubox/jshn.sh +. $NETIFD_MAIN_DIR/utils.sh + +proto_config_add_int() { + config_add_int "$@" +} + +proto_config_add_string() { + config_add_string "$@" +} + +proto_config_add_boolean() { + config_add_boolean "$@" +} + +_proto_do_teardown() { + json_load "$data" + eval "proto_$1_teardown \"$interface\" \"$ifname\"" +} + +_proto_do_renew() { + json_load "$data" + eval "proto_$1_renew \"$interface\" \"$ifname\"" +} + +_proto_do_setup() { + json_load "$data" + _EXPORT_VAR=0 + _EXPORT_VARS= + eval "proto_$1_setup \"$interface\" \"$ifname\"" +} + +proto_init_update() { + local ifname="$1" + local up="$2" + local external="$3" + + PROTO_KEEP=0 + PROTO_INIT=1 + PROTO_TUNNEL_OPEN= + PROTO_IPADDR= + PROTO_IP6ADDR= + PROTO_ROUTE= + PROTO_ROUTE6= + PROTO_PREFIX6= + PROTO_DNS= + PROTO_DNS_SEARCH= + json_init + json_add_int action 0 + [ -n "$ifname" -a "*" != "$ifname" ] && json_add_string "ifname" "$ifname" + json_add_boolean "link-up" "$up" + [ -n "$3" ] && json_add_boolean "address-external" "$external" +} + +proto_set_keep() { + PROTO_KEEP="$1" +} + +proto_close_nested() { + [ -n "$PROTO_NESTED_OPEN" ] && json_close_object + PROTO_NESTED_OPEN= +} + +proto_add_nested() { + PROTO_NESTED_OPEN=1 + json_add_object "$1" +} + +proto_add_tunnel() { + proto_add_nested "tunnel" +} + +proto_close_tunnel() { + proto_close_nested +} + +proto_add_data() { + proto_add_nested "data" +} + +proto_close_data() { + proto_close_nested +} + +proto_add_dns_server() { + local address="$1" + + append PROTO_DNS "$address" +} + +proto_add_dns_search() { + local address="$1" + + append PROTO_DNS_SEARCH "$address" +} + +proto_add_ipv4_address() { + local address="$1" + local mask="$2" + local broadcast="$3" + local ptp="$4" + + append PROTO_IPADDR "$address/$mask/$broadcast/$ptp" +} + +proto_add_ipv6_address() { + local address="$1" + local mask="$2" + local preferred="$3" + local valid="$4" + local offlink="$5" + local class="$6" + + append PROTO_IP6ADDR "$address/$mask/$preferred/$valid/$offlink/$class" +} + +proto_add_ipv4_route() { + local target="$1" + local mask="$2" + local gw="$3" + local source="$4" + local metric="$5" + + append PROTO_ROUTE "$target/$mask/$gw/$metric///$source" +} + +proto_add_ipv6_route() { + local target="$1" + local mask="$2" + local gw="$3" + local metric="$4" + local valid="$5" + local source="$6" + local table="$7" + + append PROTO_ROUTE6 "$target/$mask/$gw/$metric/$valid/$table/$source" +} + +proto_add_ipv6_prefix() { + local prefix="$1" + local valid="$2" + local preferred="$3" + + if [ -z "$valid" ]; then + append PROTO_PREFIX6 "$prefix" + else + [ -z "$preferred" ] && preferred="$valid" + append PROTO_PREFIX6 "$prefix,$valid,$preferred" + fi +} + +_proto_push_ipv4_addr() { + local str="$1" + local address mask broadcast ptp + + address="${str%%/*}" + str="${str#*/}" + mask="${str%%/*}" + str="${str#*/}" + broadcast="${str%%/*}" + str="${str#*/}" + ptp="$str" + + json_add_object "" + json_add_string ipaddr "$address" + [ -n "$mask" ] && json_add_string mask "$mask" + [ -n "$broadcast" ] && json_add_string broadcast "$broadcast" + [ -n "$ptp" ] && json_add_string ptp "$ptp" + json_close_object +} + +_proto_push_ipv6_addr() { + local str="$1" + local address mask preferred valid offlink + + address="${str%%/*}" + str="${str#*/}" + mask="${str%%/*}" + str="${str#*/}" + preferred="${str%%/*}" + str="${str#*/}" + valid="${str%%/*}" + str="${str#*/}" + offlink="${str%%/*}" + str="${str#*/}" + class="${str%%/*}" + + json_add_object "" + json_add_string ipaddr "$address" + [ -n "$mask" ] && json_add_string mask "$mask" + [ -n "$preferred" ] && json_add_int preferred "$preferred" + [ -n "$valid" ] && json_add_int valid "$valid" + [ -n "$offlink" ] && json_add_boolean offlink "$offlink" + [ -n "$class" ] && json_add_string class "$class" + json_close_object +} + +_proto_push_string() { + json_add_string "" "$1" +} + +_proto_push_route() { + local str="$1"; + local target="${str%%/*}" + str="${str#*/}" + local mask="${str%%/*}" + str="${str#*/}" + local gw="${str%%/*}" + str="${str#*/}" + local metric="${str%%/*}" + str="${str#*/}" + local valid="${str%%/*}" + str="${str#*/}" + local table="${str%%/*}" + str="${str#*/}" + local source="${str}" + + json_add_object "" + json_add_string target "$target" + json_add_string netmask "$mask" + [ -n "$gw" ] && json_add_string gateway "$gw" + [ -n "$metric" ] && json_add_int metric "$metric" + [ -n "$valid" ] && json_add_int valid "$valid" + [ -n "$source" ] && json_add_string source "$source" + [ -n "$table" ] && json_add_string table "$table" + json_close_object +} + +_proto_push_array() { + local name="$1" + local val="$2" + local cb="$3" + + [ -n "$val" ] || return 0 + json_add_array "$name" + for item in $val; do + eval "$cb \"\$item\"" + done + json_close_array +} + +_proto_notify() { + local interface="$1" + local options="$2" + json_add_string "interface" "$interface" + ubus $options call network.interface notify_proto "$(json_dump)" +} + +proto_send_update() { + local interface="$1" + + proto_close_nested + json_add_boolean keep "$PROTO_KEEP" + _proto_push_array "ipaddr" "$PROTO_IPADDR" _proto_push_ipv4_addr + _proto_push_array "ip6addr" "$PROTO_IP6ADDR" _proto_push_ipv6_addr + _proto_push_array "routes" "$PROTO_ROUTE" _proto_push_route + _proto_push_array "routes6" "$PROTO_ROUTE6" _proto_push_route + _proto_push_array "ip6prefix" "$PROTO_PREFIX6" _proto_push_string + _proto_push_array "dns" "$PROTO_DNS" _proto_push_string + _proto_push_array "dns_search" "$PROTO_DNS_SEARCH" _proto_push_string + _proto_notify "$interface" +} + +proto_export() { + local var="VAR${_EXPORT_VAR}" + _EXPORT_VAR="$(($_EXPORT_VAR + 1))" + export -- "$var=$1" + append _EXPORT_VARS "$var" +} + +proto_run_command() { + local interface="$1"; shift + + json_init + json_add_int action 1 + json_add_array command + while [ $# -gt 0 ]; do + json_add_string "" "$1" + shift + done + json_close_array + [ -n "$_EXPORT_VARS" ] && { + json_add_array env + for var in $_EXPORT_VARS; do + eval "json_add_string \"\" \"\${$var}\"" + done + json_close_array + } + _proto_notify "$interface" +} + +proto_kill_command() { + local interface="$1"; shift + + json_init + json_add_int action 2 + [ -n "$1" ] && json_add_int signal "$1" + _proto_notify "$interface" +} + +proto_notify_error() { + local interface="$1"; shift + + json_init + json_add_int action 3 + json_add_array error + while [ $# -gt 0 ]; do + json_add_string "" "$1" + shift + done + json_close_array + _proto_notify "$interface" +} + +proto_block_restart() { + local interface="$1"; shift + + json_init + json_add_int action 4 + _proto_notify "$interface" +} + +proto_set_available() { + local interface="$1" + local state="$2" + json_init + json_add_int action 5 + json_add_boolean available "$state" + _proto_notify "$interface" +} + +proto_add_host_dependency() { + local interface="$1" + local host="$2" + local ifname="$3" + + # execute in subshell to not taint callers env + # see tickets #11046, #11545, #11570 + ( + json_init + json_add_int action 6 + json_add_string host "$host" + [ -n "$ifname" ] && json_add_string ifname "$ifname" + _proto_notify "$interface" -S + ) +} + +proto_setup_failed() { + local interface="$1" + json_init + json_add_int action 7 + _proto_notify "$interface" +} + +init_proto() { + proto="$1"; shift + cmd="$1"; shift + + case "$cmd" in + dump) + add_protocol() { + no_device=0 + no_proto_task=0 + available=0 + renew_handler=0 + + add_default_handler "proto_$1_init_config" + + json_init + json_add_string "name" "$1" + json_add_array "config" + eval "proto_$1_init_config" + json_close_array + json_add_boolean no-device "$no_device" + json_add_boolean no-proto-task "$no_proto_task" + json_add_boolean available "$available" + json_add_boolean renew-handler "$renew_handler" + json_add_boolean lasterror "$lasterror" + json_dump + } + ;; + setup|teardown|renew) + interface="$1"; shift + data="$1"; shift + ifname="$1"; shift + + add_protocol() { + [[ "$proto" == "$1" ]] || return 0 + + case "$cmd" in + setup) _proto_do_setup "$1";; + teardown) _proto_do_teardown "$1" ;; + renew) _proto_do_renew "$1" ;; + *) return 1 ;; + esac + } + ;; + esac +} diff --git a/bsp/board/domo/ovl/lib/netifd/netifd-wireless.sh b/bsp/board/domo/ovl/lib/netifd/netifd-wireless.sh new file mode 100644 index 00000000..87d13cac --- /dev/null +++ b/bsp/board/domo/ovl/lib/netifd/netifd-wireless.sh @@ -0,0 +1,337 @@ +NETIFD_MAIN_DIR="${NETIFD_MAIN_DIR:-/lib/netifd}" + +. /usr/share/libubox/jshn.sh +. $NETIFD_MAIN_DIR/utils.sh + +CMD_UP=0 +CMD_SET_DATA=1 +CMD_PROCESS_ADD=2 +CMD_PROCESS_KILL_ALL=3 +CMD_SET_RETRY=4 + +add_driver() { + return +} + +wireless_setup_vif_failed() { + local error="$1" + echo "Interface $_w_iface setup failed: $error" +} + +wireless_setup_failed() { + local error="$1" + + echo "Device setup failed: $error" + wireless_set_retry 0 +} + +prepare_key_wep() { + local key="$1" + local hex=1 + + echo -n "$key" | grep -qE "[^a-fA-F0-9]" && hex=0 + [ "${#key}" -eq 10 -a $hex -eq 1 ] || \ + [ "${#key}" -eq 26 -a $hex -eq 1 ] || { + [ "${key:0:2}" = "s:" ] && key="${key#s:}" + key="$(echo -n "$key" | hexdump -ve '1/1 "%02x" ""')" + } + echo "$key" +} + +_wdev_prepare_channel() { + json_get_vars channel hwmode + + auto_channel=0 + enable_ht=0 + htmode= + hwmode="${hwmode##11}" + hwmode_n="${hwmode##n}" + + case "$channel" in + ""|0|auto) + channel=0 + auto_channel=1 + ;; + [0-9]*) ;; + *) + wireless_setup_failed "INVALID_CHANNEL" + ;; + esac + + [[ "$hwmode_n" = "$hwmode" ]] || { + enable_ht=1 + hwmode="$hwmode_n" + + json_get_vars htmode + case "$htmode" in + HT20|HT40+|HT40-);; + *) htmode= ;; + esac + } + + case "$hwmode" in + a|b|g) ;; + *) + if [ "$channel" -gt 14 ]; then + hwmode=a + else + hwmode=g + fi + ;; + esac +} + +_wdev_handler() { + json_load "$data" + + json_select config + _wdev_prepare_channel + json_select .. + + eval "drv_$1_$2 \"$interface\"" +} + +_wdev_msg_call() { + local old_cb + + json_set_namespace wdev old_cb + "$@" + json_set_namespace $old_cb +} + +_wdev_wrapper() { + while [ -n "$1" ]; do + eval "$1() { _wdev_msg_call _$1 \"\$@\"; }" + shift + done +} + +_wdev_notify_init() { + local command="$1" + local interface="$2" + + json_init + json_add_int "command" "$command" + json_add_string "device" "$__netifd_device" + [ -n "$interface" ] && json_add_string "interface" "$interface" + json_add_object "data" +} + +_wdev_notify() { + local options="$1" + + json_close_object + ubus $options call network.wireless notify "$(json_dump)" +} + +_wdev_add_variables() { + while [ -n "$1" ]; do + local var="${1%%=*}" + local val="$1" + shift + [[ "$var" = "$val" ]] && continue + val="${val#*=}" + json_add_string "$var" "$val" + done +} + +_wireless_add_vif() { + local name="$1"; shift + local ifname="$1"; shift + + _wdev_notify_init $CMD_SET_DATA "$name" + json_add_string "ifname" "$ifname" + _wdev_add_variables "$@" + _wdev_notify +} + +_wireless_set_up() { + _wdev_notify_init $CMD_UP + _wdev_notify +} + +_wireless_set_data() { + _wdev_notify_init $CMD_SET_DATA + _wdev_add_variables "$@" + _wdev_notify +} + +_wireless_add_process() { + _wdev_notify_init $CMD_PROCESS_ADD + local exe="$2" + [ -L "$exe" ] && exe="$(readlink -f "$exe")" + json_add_int pid "$1" + json_add_string exe "$exe" + [ -n "$3" ] && json_add_boolean required 1 + exe2="$(readlink -f /proc/$pid/exe)" + [ "$exe" = "$exe2" ] && echo "WARNING (wireless_add_process): executable path $exe does not match process $1 path ($exe2)" + _wdev_notify +} + +_wireless_process_kill_all() { + _wdev_notify_init $CMD_PROCESS_KILL_ALL + [ -n "$1" ] && json_add_int signal "$1" + _wdev_notify +} + +_wireless_set_retry() { + _wdev_notify_init $CMD_SET_RETRY + json_add_int retry "$1" + _wdev_notify +} + +_wdev_wrapper \ + wireless_add_vif \ + wireless_set_up \ + wireless_set_data \ + wireless_add_process \ + wireless_process_kill_all \ + wireless_set_retry \ + +wireless_vif_parse_encryption() { + json_get_vars encryption + set_default encryption none + + auth_mode_open=1 + auth_mode_shared=0 + auth_type=none + wpa_cipher=CCMP + case "$encryption" in + *tkip+aes|*tkip+ccmp|*aes+tkip|*ccmp+tkip) wpa_cipher="CCMP TKIP";; + *aes|*ccmp) wpa_cipher="CCMP";; + *tkip) wpa_cipher="TKIP";; + esac + + # 802.11n requires CCMP for WPA + [ "$enable_ht:$wpa_cipher" = "1:TKIP" ] && wpa_cipher="CCMP TKIP" + + # Examples: + # psk-mixed/tkip => WPA1+2 PSK, TKIP + # wpa-psk2/tkip+aes => WPA2 PSK, CCMP+TKIP + # wpa2/tkip+aes => WPA2 RADIUS, CCMP+TKIP + + case "$encryption" in + wpa2*|*psk2*) + wpa=2 + ;; + *mixed*) + wpa=3 + ;; + wpa*|*psk*) + wpa=1 + ;; + *) + wpa=0 + wpa_cipher= + ;; + esac + wpa_pairwise="$wpa_cipher" + + case "$encryption" in + *psk*) + auth_type=psk + ;; + *wpa*|*8021x*) + auth_type=eap + ;; + *wep*) + auth_type=wep + case "$encryption" in + *shared*) + auth_mode_open=0 + auth_mode_shared=1 + ;; + *mixed*) + auth_mode_shared=1 + ;; + esac + ;; + esac +} + +_wireless_set_brsnoop_isolation() { + local multicast_to_unicast="$1" + local isolate + + json_get_var isolate isolate + + [ ${isolate:-0} -gt 0 -o -z "$network_bridge" ] && return + [ ${multicast_to_unicast:-1} -gt 0 ] && json_add_boolean isolate 1 +} + +for_each_interface() { + local _w_types="$1"; shift + local _w_ifaces _w_iface + local _w_type + local _w_found + + local multicast_to_unicast + + json_get_keys _w_ifaces interfaces + json_select interfaces + for _w_iface in $_w_ifaces; do + json_select "$_w_iface" + if [ -n "$_w_types" ]; then + json_get_var network_bridge bridge + json_get_var multicast_to_unicast multicast_to_unicast + json_select config + _wireless_set_brsnoop_isolation "$multicast_to_unicast" + json_get_var _w_type mode + json_select .. + _w_types=" $_w_types " + [[ "${_w_types%$_w_type*}" = "$_w_types" ]] && { + json_select .. + continue + } + fi + "$@" "$_w_iface" + json_select .. + done + json_select .. +} + +_wdev_common_device_config() { + config_add_string channel hwmode htmode +} + +_wdev_common_iface_config() { + config_add_string mode ssid encryption 'key:wpakey' +} + +init_wireless_driver() { + name="$1"; shift + cmd="$1"; shift + + case "$cmd" in + dump) + add_driver() { + eval "drv_$1_cleanup" + + json_init + json_add_string name "$1" + + json_add_array device + _wdev_common_device_config + eval "drv_$1_init_device_config" + json_close_array + + json_add_array iface + _wdev_common_iface_config + eval "drv_$1_init_iface_config" + json_close_array + + json_dump + } + ;; + setup|teardown) + interface="$1"; shift + data="$1"; shift + export __netifd_device="$interface" + + add_driver() { + [[ "$name" == "$1" ]] || return 0 + _wdev_handler "$1" "$cmd" + } + ;; + esac +} diff --git a/bsp/board/domo/ovl/lib/netifd/proto/dhcp.sh b/bsp/board/domo/ovl/lib/netifd/proto/dhcp.sh new file mode 100755 index 00000000..abfdaaff --- /dev/null +++ b/bsp/board/domo/ovl/lib/netifd/proto/dhcp.sh @@ -0,0 +1,76 @@ +#!/bin/sh + +. /lib/functions.sh +. ../netifd-proto.sh +init_proto "$@" + +proto_dhcp_init_config() { + renew_handler=1 + + proto_config_add_string 'ipaddr:ipaddr' + proto_config_add_string 'hostname:hostname' + proto_config_add_string clientid + proto_config_add_string vendorid + proto_config_add_boolean 'broadcast:bool' + proto_config_add_boolean 'release:bool' + proto_config_add_string 'reqopts:list(string)' + proto_config_add_string iface6rd + proto_config_add_string sendopts + proto_config_add_boolean delegate + proto_config_add_string zone6rd + proto_config_add_string zone + proto_config_add_string mtu6rd + proto_config_add_string customroutes +} + +proto_dhcp_setup() { + local config="$1" + local iface="$2" + + local ipaddr hostname clientid vendorid broadcast release reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes + json_get_vars ipaddr hostname clientid vendorid broadcast release reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes + + local opt dhcpopts + for opt in $reqopts; do + append dhcpopts "-O $opt" + done + + for opt in $sendopts; do + append dhcpopts "-x $opt" + done + + [ "$broadcast" = 1 ] && broadcast="-B" || broadcast= + [ "$release" = 1 ] && release="-R" || release= + [ -n "$clientid" ] && clientid="-x 0x3d:${clientid//:/}" || clientid="-C" + [ -n "$iface6rd" ] && proto_export "IFACE6RD=$iface6rd" + [ "$iface6rd" != 0 -a -f /lib/netifd/proto/6rd.sh ] && append dhcpopts "-O 212" + [ -n "$zone6rd" ] && proto_export "ZONE6RD=$zone6rd" + [ -n "$zone" ] && proto_export "ZONE=$zone" + [ -n "$mtu6rd" ] && proto_export "MTU6RD=$mtu6rd" + [ -n "$customroutes" ] && proto_export "CUSTOMROUTES=$customroutes" + [ "$delegate" = "0" ] && proto_export "IFACE6RD_DELEGATE=0" + + 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"} \ + ${vendorid:+-V "$vendorid"} \ + $clientid $broadcast $release $dhcpopts +} + +proto_dhcp_renew() { + local interface="$1" + # SIGUSR1 forces udhcpc to renew its lease + local sigusr1="$(kill -l SIGUSR1)" + [ -n "$sigusr1" ] && proto_kill_command "$interface" $sigusr1 +} + +proto_dhcp_teardown() { + local interface="$1" + proto_kill_command "$interface" +} + +add_protocol dhcp diff --git a/bsp/board/domo/ovl/lib/netifd/utils.sh b/bsp/board/domo/ovl/lib/netifd/utils.sh new file mode 100644 index 00000000..60470a56 --- /dev/null +++ b/bsp/board/domo/ovl/lib/netifd/utils.sh @@ -0,0 +1,50 @@ +N=" +" + +append() { + local var="$1" + local value="$2" + local sep="${3:- }" + + eval "export -- \"$var=\${$var:+\${$var}\${value:+\$sep}}\$value\"" +} + +add_default_handler() { + case "$(type $1 2>/dev/null)" in + *function*) return;; + *) eval "$1() { return; }" + esac +} + +set_default() { + local __s_var="$1" + local __s_val="$2" + eval "export -- \"$__s_var=\${$__s_var:-\$__s_val}\"" +} + +_config_add_generic() { + local type="$1"; shift + + for name in "$@"; do + json_add_array "" + json_add_string "" "$name" + json_add_int "" "$type" + json_close_array + done +} + +config_add_int() { + _config_add_generic 5 "$@" +} + +config_add_array() { + _config_add_generic 1 "$@" +} + +config_add_string() { + _config_add_generic 3 "$@" +} + +config_add_boolean() { + _config_add_generic 7 "$@" +} diff --git a/bsp/board/domo/ovl/lib/netifd/wireless/mac80211.sh b/bsp/board/domo/ovl/lib/netifd/wireless/mac80211.sh new file mode 100755 index 00000000..1e5dd550 --- /dev/null +++ b/bsp/board/domo/ovl/lib/netifd/wireless/mac80211.sh @@ -0,0 +1,66 @@ +#!/bin/sh +NETIFD_MAIN_DIR=../ +. $NETIFD_MAIN_DIR/netifd-wireless.sh + +init_wireless_driver "$@" + +drv_mac80211_init_device_config() { + # identifiers + config_add_string macaddr + config_add_string path + config_add_string phy + + # config + config_add_int channel + config_add_string hwmode + config_add_array ht_capab + + config_add_int chanbw +} + +drv_mac80211_init_iface_config() { + config_add_string macaddr + + config_add_boolean wds + config_add_int maxassoc + config_add_int dtim_period + + config_add_int max_listen_int + + config_add_boolean hidden + config_add_boolean wmm +} + +setup_vif() { + local name="$1" + + json_select config + json_get_var ssid ssid + json_select .. + + wireless_add_vif "$name" "dummy-$ssid" + /bin/sleep 10 & + wireless_add_process "$!" /bin/sleep 1 +} + +drv_mac80211_cleanup() { + echo "mac80211 cleanup" +} + +drv_mac80211_setup() { + echo "mac80211 setup: $1" + json_dump + for_each_interface "sta ap adhoc" setup_vif + wireless_set_data phy=phy0 + wireless_set_up +} + +drv_mac80211_teardown() { + json_select data + json_get_var phy phy + json_select .. + echo "mac80211 teardown: $1 ($phy)" + json_dump +} + +add_driver mac80211 diff --git a/bsp/board/domo/ovl/lib/network/config.sh b/bsp/board/domo/ovl/lib/network/config.sh new file mode 100755 index 00000000..9128971d --- /dev/null +++ b/bsp/board/domo/ovl/lib/network/config.sh @@ -0,0 +1,79 @@ +#!/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/bsp/buildroot_external/package/netifd/netifd.mk b/bsp/buildroot_external/package/netifd/netifd.mk index 6d42faaf..778c179a 100644 --- a/bsp/buildroot_external/package/netifd/netifd.mk +++ b/bsp/buildroot_external/package/netifd/netifd.mk @@ -12,7 +12,7 @@ NETIFD_INSTALL_STAGING = YES NETIFD_DEPENDENCIES = libubox json-c ubus uci -NETIFD_CONF = SRC_DIR=$(TOPDIR)/../.. INC_DIR=$(WORKSPACE_DIR)buildroot/target/usr/include +NETIFD_CONF = SRC_DIR=$(TOPDIR)/../.. INC_DIR=$(WORKSPACE_DIR)buildroot/staging/usr/include NETIFD_CONF_ENV = $(NETIFD_CONF) NETIFD_MAKE_ENV = $(NETIFD_CONF) diff --git a/projects/pi_domo/ovl/etc/config/network b/projects/pi_domo/ovl/etc/config/network new file mode 100644 index 00000000..25fb98ee --- /dev/null +++ b/projects/pi_domo/ovl/etc/config/network @@ -0,0 +1,9 @@ +config interface loopback + option ifname lo + option proto static + option ipaddr 127.0.0.1 + option netmask 255.0.0.0 + +config interface wan + option ifname eth0 + option proto dhcp diff --git a/projects/sun8i-h2_domo/Makefile b/projects/sun8i-h2_domo/Makefile index 906cda6c..8d54d485 100644 --- a/projects/sun8i-h2_domo/Makefile +++ b/projects/sun8i-h2_domo/Makefile @@ -12,3 +12,4 @@ include $(BR_BOARD)/main.mk install: cp $(BR_STAGING)/buildroot/images/zImage /tftpboot/ cp $(BR_STAGING)/buildroot/images/rootfs.cpio.uboot /tftpboot/ + cp $(BR_STAGING)/buildroot/images/script.bin /tftpboot/ diff --git a/projects/sun8i-h2_domo/uboot/dev.cmd b/projects/sun8i-h2_domo/uboot/dev.cmd index e9763bed..63232a48 100644 --- a/projects/sun8i-h2_domo/uboot/dev.cmd +++ b/projects/sun8i-h2_domo/uboot/dev.cmd @@ -1,20 +1,13 @@ +echo ----- +tftp ${fdt_addr_r} script.bin +tftp ${kernel_addr_r} zImage +tftp ${ramdisk_addr_r} rootfs.cpio.uboot +echo ----- gpio set PL10 gpio set PG11 - -#-------------------------------------------------------------------------------------------------------------------------------- setenv machid 1029 setenv bootm_boot_mode sec setenv bootargs "console=ttyS0,115200 rootwait cgroup_enable=memory swapaccount=1 sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_no_mali_mem_reserve sunxi_fb_mem_reserve=16 panic=10 consoleblank=0 enforcing=0" - -#-------------------------------------------------------------------------------------------------------------------------------- +echo ----- fatload mmc 0 ${fdt_addr_r} script.bin - -setenv ipaddr 192.168.9.50 -setenv serverip 192.168.9.174 - -# dhcp ${ramdisk_addr_r} rootfs.cpio.uboot -tftp ${ramdisk_addr_r} rootfs.cpio.uboot -tftp ${kernel_addr_r} zImage - -#-------------------------------------------------------------------------------------------------------------------------------- bootz ${kernel_addr_r} ${ramdisk_addr_r} diff --git a/projects/sun8i-h2_domo/uboot/update.cmd b/projects/sun8i-h2_domo/uboot/update.cmd index 21b5c105..e3f90907 100644 --- a/projects/sun8i-h2_domo/uboot/update.cmd +++ b/projects/sun8i-h2_domo/uboot/update.cmd @@ -1,13 +1,13 @@ - - - - -usb start -dhcp ${kernel_addr_r} zImage +echo ----- +printenv ipaddr +printenv kernel_addr_r +printenv ramdisk_addr_r +echo ----- +tftp ${kernel_addr_r} zImage fatwrite mmc 0:1 ${fileaddr} zImage ${filesize} -tftp ${fdt_addr_r} bcm2708-rpi-b.dtb -fatwrite mmc 0:1 ${fileaddr} bcm2708-rpi-b-plus.dtb ${filesize} + tftp ${ramdisk_addr_r} rootfs.cpio.uboot fatwrite mmc 0:1 ${fileaddr} rootfs.cpio.uboot ${filesize} -setenv bootargs console=ttyAMA0,115200 -bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r} +echo ----- +echo Update Done +echo ----- diff --git a/src/3P/mdns/cache.c b/src/3P/mdns/cache.c index 07d4f20d..aa0c2d49 100644 --- a/src/3P/mdns/cache.c +++ b/src/3P/mdns/cache.c @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include "cache.h" #include "util.h" diff --git a/src/3P/mdns/main.c b/src/3P/mdns/main.c index 02d13f54..e6fe4327 100644 --- a/src/3P/mdns/main.c +++ b/src/3P/mdns/main.c @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include "dns.h" diff --git a/src/3P/mdns/service.c b/src/3P/mdns/service.c index fe6e5a91..c6bc0b51 100644 --- a/src/3P/mdns/service.c +++ b/src/3P/mdns/service.c @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/3P/mdns/ubus.c b/src/3P/mdns/ubus.c index 3cf2313f..19ce7df2 100644 --- a/src/3P/mdns/ubus.c +++ b/src/3P/mdns/ubus.c @@ -16,7 +16,7 @@ #include -#include +#include #include #include diff --git a/src/3P/uci/builders/cmake/CMakeLists.txt b/src/3P/uci/builders/cmake/CMakeLists.txt index b24e2c4b..8eb0b0df 100644 --- a/src/3P/uci/builders/cmake/CMakeLists.txt +++ b/src/3P/uci/builders/cmake/CMakeLists.txt @@ -44,4 +44,4 @@ add_executable (uci_cli $ENV{SRC_DIR}/src/3P/uci/cli.c) set_target_properties (uci_cli PROPERTIES OUTPUT_NAME uci) target_link_libraries (uci_cli LINK_PUBLIC uci ubox blobmsg_json) -install (TARGETS uci_cli RUNTIME DESTINATION bin) \ No newline at end of file +install (TARGETS uci_cli RUNTIME DESTINATION ../sbin) \ No newline at end of file