Hi Hiroki,

On Fri, Jun 20, 2014 at 12:48:03PM +0900, Hiroki Sato wrote:
> John Hay <j...@meraka.org.za> wrote
>   in <20140619103513.ga92...@zibbi.meraka.csir.co.za>:
> 
> jh> Hi Guys,
> jh>
> jh> freebsd-rc did not react, so I'm just checking on -net too.
> jh>
> jh> I found after upgrading that vlan handling broke. I tried the following:
> jh>
> jh> vlans_bce1="6"
> jh> ipv4_addrs_bce1_6="inet 10.239.100.2/24"
> jh> ifconfig_bce1_6_aliases="inet 10.239.100.2/24"
> jh> ifconfig_bce1_6_alias0="inet 10.239.100.2/24"
> jh>
> jh> I traced it down to ifalias_af_common_handler being called with the
> jh> mangled interfcace name _if and it then calls ifconfig with it. Here
> jh> is my fix. Any reason not to commit it? My diff is against 10-stable,
> jh> but head looks the same.
> 
>  Can you try the attached patch?  It seemed broken after list_vars()
>  was introduced.  Replacing $_if with $1 also fixes it, but $_if
>  should be used for ifname as the other parts do.

I have tested ipv4 and ipv6 cases and it seems ok:

##############################
vlans_re1="6 7"
ipv4_addrs_re1_6="inet 10.254.254.253/24"
ifconfig_re1_6_aliases="inet 10.254.254.254/24"
ifconfig_re1_6_ipv6="inet6 accept_rtadv"
ifconfig_re1_7_ipv6="inet6 fd99:6829:597c:2::1 prefixlen 64"

root@angel:/etc # ifconfig re1.6
re1.6: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=3<RXCSUM,TXCSUM>
        ether 90:2b:34:df:ae:c4
        inet6 fe80::922b:34ff:fedf:aec4%re1.6 prefixlen 64 scopeid 0x4 
        inet 10.254.254.254 netmask 0xffffff00 broadcast 10.254.254.255 
        inet 10.254.254.253 netmask 0xffffff00 broadcast 10.254.254.255 
        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
        media: Ethernet autoselect (none)
        status: no carrier
        vlan: 6 parent interface: re1
root@angel:/etc # ifconfig re1.7
re1.7: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=3<RXCSUM,TXCSUM>
        ether 90:2b:34:df:ae:c4
        inet6 fd99:6829:597c:2::1 prefixlen 64 
        inet6 fe80::922b:34ff:fedf:aec4%re1.7 prefixlen 64 scopeid 0x5 
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        media: Ethernet autoselect (none)
        status: no carrier
        vlan: 7 parent interface: re1
root@angel:/etc #
##############################

Thanks

John

> 
> jh> While looking through the code I saw that ltr is called with different
> jh> styling. Is there a reason for it? Which is the prefered style?
> jh>
> jh>   ltr ${_if} "${_punct}" '_' _if
> jh>   ltr "$_if" "$_punct" "_" _if
> 
>  I do not think there is a reason.
> 
>  I think there is no consensus about the style but I am using {} only
>  when boundary between the variable name and the subsequent characters
>  can be ambiguous.
> 
> -- Hiroki

> Index: network.subr
> ===================================================================
> --- network.subr      (revision 267636)
> +++ network.subr      (working copy)
> @@ -1077,7 +1077,7 @@
>  ifalias_af_common()
>  {
>       local _ret _if _af _action alias ifconfig_args _aliasn _c _tmpargs _iaf
> -     local _punct=".-/+"
> +     local _vif _punct=".-/+"
> 
>       _ret=1
>       _aliasn=
> @@ -1086,11 +1086,11 @@
>       _action=$3
> 
>       # Normalize $_if before using it in a pattern to list_vars()
> -     ltr "$_if" "$_punct" "_" _if
> +     ltr "$_if" "$_punct" "_" _vif
> 
>       # ifconfig_IF_aliasN which starts with $_af
> -     for alias in `list_vars ifconfig_${_if}_alias[0-9]\* |
> -             sort_lite -nk1.$((9+${#_if}+7))`
> +     for alias in `list_vars ifconfig_${_vif}_alias[0-9]\* |
> +             sort_lite -nk1.$((9+${#_vif}+7))`
>       do
>               eval ifconfig_args=\"\$$alias\"
>               _iaf=
> @@ -1118,8 +1118,8 @@
>       # backward compatibility: ipv6_ifconfig_IF_aliasN.
>       case $_af in
>       inet6)
> -             for alias in `list_vars ipv6_ifconfig_${_if}_alias[0-9]\* |
> -                     sort_lite -nk1.$((14+${#_if}+7))`
> +             for alias in `list_vars ipv6_ifconfig_${_vif}_alias[0-9]\* |
> +                     sort_lite -nk1.$((14+${#_vif}+7))`
>               do
>                       eval ifconfig_args=\"\$$alias\"
>                       case ${_action}:"${ifconfig_args}" in
> @@ -1129,7 +1129,7 @@
>                       alias:*)
>                               _aliasn="${_aliasn} inet6 ${ifconfig_args}"
>                               warn "\$${alias} is obsolete. " \
> -                                 "Use ifconfig_$1_aliasN instead."
> +                                 "Use ifconfig_${_vif}_aliasN instead."
>                       ;;
>                       esac
>               done
_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"

Reply via email to