[LEDE-DEV] /lib/functions/network.sh & ip6ifaceid

Eric Masson emss at free.fr
Wed Jun 7 10:33:43 PDT 2017


Hello,

I'm considering upgrading my Chaos Chalmer TL-WDR3600 to Lede 17.07.1 or 
later to get the shiny latest release and solve some issues.

It seems to me that /lib/functions/network.sh located in base-files 
packages still exhibits a bug regarding ipv6 addresses determination for 
interfaces 
(https://git.lede-project.org/?p=source.git;a=blob;f=package/base-files/files/lib/functions/network.sh;hb=HEAD)

It seems that ipv6 suffix is hardcoded and ip6ifaceid is ignored.

/lib/functions/network.sh excerpt :
> # 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
> }

This causes dropbear to listen on a wrong address when ip6ifaceid is set 
to non default value (anything else than ::1) on lan interface :

ps excerpt :
> 8002 root      1220 R    /usr/sbin/dropbear -F -P /var/run/dropbear.1.pid -p 192.168.85.15:22 -p fd75:43df:37f2::1:22 -K 300

ifconfig excerpt :
> br-lan    Link encap:Ethernet  HWaddr 64:70:02:BA:0E:DE
>           inet addr:192.168.85.15  Bcast:192.168.85.255  Mask:255.255.255.0
>           inet6 addr: fd75:43df:37f2::15/64 Scope:Global
>           inet6 addr: fe80::6670:2ff:feba:ede/64 Scope:Link

Issue :
> root at rtrwrtfenint:/tmp# uci get network.lan.ip6ifaceid
> ::15
> root at rtrwrtfenint:/tmp#  . /lib/functions/network.sh; network_get_ipaddrs_all ipaddrs lan ; echo $ipaddrs
> 192.168.85.15 fd75:43df:37f2::1

Does this qualify as a bug and could be fixed in HEAD and the upcoming 
17.07.2 release please ?

Regards

Éric Masson




More information about the Lede-dev mailing list