mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
fix netift
This commit is contained in:
parent
b76bbb581c
commit
5930a09dfc
38 changed files with 1918 additions and 68 deletions
|
@ -13,7 +13,7 @@ set_classless_routes() {
|
|||
done
|
||||
}
|
||||
|
||||
setup_interface() {
|
||||
setup_interface () {
|
||||
proto_init_update "*" 1
|
||||
proto_add_ipv4_address "$ip" "${subnet:-255.255.255.0}"
|
||||
# TODO: apply $broadcast
|
||||
|
@ -27,7 +27,6 @@ setup_interface() {
|
|||
eval "$(ipcalc.sh "$i/$mask")";gw_net="$NETWORK"
|
||||
|
||||
[ "$ip_net" != "$gw_net" ] && proto_add_ipv4_route "$i" 32 "" "$ip"
|
||||
#[ "$DEFAULTROUTE" = 0 ] || proto_add_ipv4_route 0.0.0.0 0 "$i" "$ip"
|
||||
proto_add_ipv4_route 0.0.0.0 0 "$i" "$ip"
|
||||
|
||||
local r
|
||||
|
@ -47,16 +46,10 @@ setup_interface() {
|
|||
proto_add_dns_search "$i"
|
||||
done
|
||||
|
||||
# TODO: Deprecate timesvr in favor of timesrv
|
||||
if [ -n "$timesvr" -a -z "$timesrv" ]; then
|
||||
timesrv="$timesvr"
|
||||
echo "Environment variable 'timesvr' will be deprecated; use 'timesrv' instead."
|
||||
fi
|
||||
|
||||
proto_add_data
|
||||
[ -n "$ZONE" ] && json_add_string zone "$ZONE"
|
||||
[ -n "$ntpsrv" ] && json_add_string ntpserver "$ntpsrv"
|
||||
[ -n "$timesrv" ] && json_add_string timeserver "$timesrv"
|
||||
[ -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"
|
||||
|
@ -113,8 +106,5 @@ esac
|
|||
|
||||
# user rules
|
||||
[ -f /etc/udhcpc.user ] && . /etc/udhcpc.user "$@"
|
||||
for f in /etc/udhcpc.user.d/*; do
|
||||
[ -f "$f" ] && (. "$f" "$@")
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -14,7 +14,7 @@ proto_dhcp_init_config() {
|
|||
proto_config_add_string clientid
|
||||
proto_config_add_string vendorid
|
||||
proto_config_add_boolean 'broadcast:bool'
|
||||
proto_config_add_boolean 'norelease:bool'
|
||||
proto_config_add_boolean 'release:bool'
|
||||
proto_config_add_string 'reqopts:list(string)'
|
||||
proto_config_add_boolean 'defaultreqopts:bool'
|
||||
proto_config_add_string iface6rd
|
||||
|
@ -35,8 +35,8 @@ proto_dhcp_setup() {
|
|||
local config="$1"
|
||||
local iface="$2"
|
||||
|
||||
local ipaddr hostname clientid vendorid broadcast norelease reqopts defaultreqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes classlessroute defaultroute
|
||||
json_get_vars ipaddr hostname clientid vendorid broadcast norelease reqopts defaultreqopts iface6rd delegate zone6rd zone mtu6rd customroutes classlessroute defaultroute
|
||||
local ipaddr hostname clientid vendorid broadcast release reqopts defaultreqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes classlessroute
|
||||
json_get_vars ipaddr hostname clientid vendorid broadcast release reqopts defaultreqopts iface6rd delegate zone6rd zone mtu6rd customroutes classlessroute
|
||||
|
||||
local opt dhcpopts
|
||||
for opt in $reqopts; do
|
||||
|
@ -50,7 +50,7 @@ proto_dhcp_setup() {
|
|||
|
||||
[ "$defaultreqopts" = 0 ] && defaultreqopts="-o" || defaultreqopts=
|
||||
[ "$broadcast" = 1 ] && broadcast="-B" || broadcast=
|
||||
[ "$norelease" = 1 ] && norelease="" || norelease="-R"
|
||||
[ "$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"
|
||||
|
@ -58,7 +58,6 @@ proto_dhcp_setup() {
|
|||
[ -n "$zone" ] && proto_export "ZONE=$zone"
|
||||
[ -n "$mtu6rd" ] && proto_export "MTU6RD=$mtu6rd"
|
||||
[ -n "$customroutes" ] && proto_export "CUSTOMROUTES=$customroutes"
|
||||
[ -n "$defaultroute" ] && proto_export "DEFAULTROUTE=$defaultroute"
|
||||
[ "$delegate" = "0" ] && proto_export "IFACE6RD_DELEGATE=0"
|
||||
# Request classless route option (see RFC 3442) by default
|
||||
[ "$classlessroute" = "0" ] || append dhcpopts "-O 121"
|
||||
|
@ -71,7 +70,7 @@ proto_dhcp_setup() {
|
|||
${ipaddr:+-r $ipaddr} \
|
||||
${hostname:+-x "hostname:$hostname"} \
|
||||
${vendorid:+-V "$vendorid"} \
|
||||
$clientid $defaultreqopts $broadcast $norelease $dhcpopts
|
||||
$clientid $defaultreqopts $broadcast $release $dhcpopts
|
||||
}
|
||||
|
||||
proto_dhcp_renew() {
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
find_config() {
|
||||
local device="$1"
|
||||
local ifdev ifl3dev ifobj
|
||||
for ifobj in $(ubus list network.interface.\*); do
|
||||
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
|
||||
if [[ "$device" = "$ifdev" ]] || [[ "$device" = "$ifl3dev" ]]; then
|
||||
echo "$interface"
|
||||
exit 0
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue