X-Git-Url: https://git.archive.openwrt.org/?p=openwrt.git;a=blobdiff_plain;f=package%2Fbase-files%2Ffiles%2Flib%2Ffunctions%2Fnetwork.sh;h=7d06aa40e94b8d55b30c17504bc627b515f13df0;hp=0ff11c3ca19e8567509f3ac005d0ec58d9f6d88b;hb=2c5f724cea3f0dc50fd181425428ab6406fc92a7;hpb=0576c3148f4c9ab1882646be03d102c3310dcb89;ds=sidebyside diff --git a/package/base-files/files/lib/functions/network.sh b/package/base-files/files/lib/functions/network.sh index 0ff11c3ca1..7d06aa40e9 100644 --- a/package/base-files/files/lib/functions/network.sh +++ b/package/base-files/files/lib/functions/network.sh @@ -174,8 +174,8 @@ __network_parse_ifstatus() fi done - # parse up state, device and physdev - for __field in "up" "l3_device" "device"; do + # parse up state, proto, device and physdev + for __field in "up" "proto" "l3_device" "device"; do if json_get_type __tmp "$__field"; then __network_set_cache "${__key}_${__field}" "$__field" fi @@ -381,6 +381,11 @@ network_is_up() __network_device __up "$1" up && [ $__up -eq 1 ] } +# determine the protocol of the given logical interface +# 1: destination variable +# 2: interface +network_get_protocol() { __network_device "$1" "$2" proto; } + # determine the layer 3 linux network device of the given logical interface # 1: destination variable # 2: interface