Index: install.sub =================================================================== RCS file: /cvs/src/distrib/miniroot/install.sub,v retrieving revision 1.1014 diff -u -p -r1.1014 install.sub --- install.sub 3 Jun 2017 22:27:41 -0000 1.1014 +++ install.sub 6 Jun 2017 01:36:08 -0000 @@ -1137,8 +1137,6 @@ configure_ifs() { while :; do _vd=$(ifconfig vlan$_vl 2>&1) [[ $_vd == @(*no such interface*) ]] && break - [[ $_vd == @(*vlan: +([[:digit:]]) parent interface:*) ]] || - break ((_vl++)) done _vd= @@ -1150,11 +1148,8 @@ configure_ifs() { rm -f /tmp/i/mygate while :; do - # Create new vlan if possible. - ifconfig vlan$_vl create >/dev/null 2>&1 - ask_which "network interface" "do you wish to configure" \ - '$(get_ifs)' \ + "\$(get_ifs); echo vlan$_vl" \ ${_p:-'$( (get_ifs netboot; get_ifs) | sed q )'} [[ $resp == done ]] && break @@ -1166,19 +1161,14 @@ configure_ifs() { # questions and bring it up. if [[ $_if == vlan+([0-9]) ]]; then # Get existing tag for this vlan. - _vi=$(ifconfig $_if 2>/dev/null | - sed -n 's/vlan: \([0-9]*\).*/\1/p') - # Get list of all in-use tags. - _tags=$(ifconfig vlan 2>/dev/null | - sed -n 's/vlan: \([0-9]*\).*/\1/p') - # Current tag is a valid tag for this vlan. - [[ -n $_tags ]] && _tags=$(rmel "$_vi" $_tags) + _vi=$(ifconfig $_ifs 2>/dev/null | + sed -En 's/.encap: vnetid (none|[0-9]+).*/\1/p') + # If there's no existing tag, use the interface minor if [[ -z $_vi ]]; then - _vi=0 - while ((++_vi < 4096)); do - ! isin "$_vi" $_tags && break - done + _vi=${_if##vlan} + [[ "$_vi" -eq 0 ]] && _vi=none fi + _ifs=$(get_ifs) set -- $_ifs while [[ $1 == vlan+([0-9]) ]]; do @@ -1197,9 +1187,13 @@ configure_ifs() { continue fi - # Validate range of $_vi as 1-4095, and $_vi not in use. - if ((_vi < 1 || _vi > 4095)) || isin "$_vi" $_tags; then - echo "Invalid or in-use vlan tag '$_vi'" + # Validate $_vi as 1-4095, or none + if [[ "$_vi" -ge 1 && "$_vi" -le 4095 ]]; then + _vi="vnetid $_vi" + elif [[ "$_vi" == "none" ]]; then + _vi="-vnetid" + else + echo "Invalid vlan tag '$_vi'" continue fi @@ -1210,10 +1204,12 @@ configure_ifs() { chmod 640 /tmp/i/hostname.$_vd ifconfig $_vd up - # Make sure a hostname.$_if is created with this info. - ifconfig $_if destroy >/dev/null 2>&1 - ifconfig $_if vlan $_vi vlandev $_vd - echo "vlan $_vi vlandev $_vd" >>$_hn + # Make sure a hostname.$_ifs is created with this info. + ifconfig $_ifs destroy >/dev/null 2>&1 + ifconfig $_ifs create >/dev/null 2>&1 + ifconfig $_ifs $_vi parent $_vd + echo "$_vi parent $_vd" >>$_hn + # Create a new vlan if we just configured the highest. [[ ${_if##vlan} == $_vl ]] && ((_vl++)) fi