Hi Stacey, Your patch would certainly make things better for Solaris 11 (for both up and down modes), but the problems with the off-by-one would affect down mode on some other OS's. Not all though that use $int ...
eg: Linux isn't affected as all the addresses are added to "lo" as aliases, rather than creating sub-interfaces for each, as you can see here (using showing ipv4 case):
+ ip address add 10.53.0.1/24 dev lo:1
+ ip address add 10.53.0.2/24 dev lo:2
+ ip address add 10.53.0.3/24 dev lo:3
+ ip address add 10.53.0.4/24 dev lo:4
+ ip address add 10.53.0.5/24 dev lo:5
+ ip address add 10.53.0.6/24 dev lo:6
+ ip address add 10.53.0.7/24 dev lo:7
+ ip address add 10.53.0.8/24 dev lo:8
+ ip address add 10.53.0.9/24 dev lo:9
+ ip address add 10.53.0.10/24 dev lo:10
+ ip address add 10.53.0.11/24 dev lo:11
+ ip address add 10.53.1.1/24 dev lo:11
+ ip address add 10.53.1.2/24 dev lo:12
+ ip address add 10.53.2.1/24 dev lo:21
+ ip address add 10.53.2.2/24 dev lo:22
+ ip address del 10.53.0.11/24 dev lo:10
+ ip address del 10.53.0.10/24 dev lo:9
+ ip address del 10.53.0.9/24 dev lo:8
+ ip address del 10.53.0.8/24 dev lo:7
+ ip address del 10.53.0.7/24 dev lo:6
+ ip address del 10.53.0.6/24 dev lo:5
+ ip address del 10.53.0.5/24 dev lo:4
+ ip address del 10.53.0.4/24 dev lo:3
+ ip address del 10.53.0.3/24 dev lo:2
+ ip address del 10.53.0.2/24 dev lo:1
+ ip address del 10.53.0.1/24 dev lo:0
+ ip address del 10.53.1.2/24 dev lo:11
+ ip address del 10.53.1.1/24 dev lo:10
+ ip address del 10.53.2.2/24 dev lo:21
+ ip address del 10.53.2.1/24 dev lo:20
Ian D
bind 9.18.3 has new issues with ifconfig.sh still; it now creates one more "lo0:11" in the loop, but that clashes with one already being created.
The "down" code still has the off-by-one issue I mentioned before: fix by this patch:
After applying only that fix ... we see this:
# ifconfig.sh up
ifconfig: cannot plumb lo0:11: Interface already exists
ifconfig: cannot plumb lo0:11: Interface already exists
Looks like this is being done:
/sbin/ifconfig lo0:11 plumb
/sbin/ifconfig lo0:11 10.53.0.11 up
/sbin/ifconfig lo0:11 mtu 1500
/sbin/ifconfig lo0:11 inet6 plumb
/sbin/ifconfig lo0:11 inet6 fd92:7065:b8e:ffff::11 up
/sbin/ifconfig lo0:11 plumb
/sbin/ifconfig lo0:11 10.53.1.1 up
/sbin/ifconfig lo0:11 mtu 1500
/sbin/ifconfig lo0:11 inet6 plumb
/sbin/ifconfig lo0:11 inet6 fd92:7065:b8e:99ff::1 up
# ifconfig.sh down
ifconfig: setifaddr: SIOCGLIFNETMASK: lo0:11: no such interface
ifconfig: setifaddr: SIOCGLIFNETMASK: lo0:11: no such interface
ifconfig: setifflags: SIOCGLIFFLAGS: lo0:11: no such interface
ifconfig: cannot unplumb lo0:11: No such interface
Looks like more work is needed to fix the lo0:11 stuff, and some tests now require it by the looks.
bind 9.18.1 has the same issue and my patch for 9.16.24 fixes it there also
Apologies for the formatting, I can't figure out how to get plain text to not be reformatted...
ifconfig.sh up works fine, but ifconfig.sh down doesn't undo things correctly and messes up main loopback interface, leaves 2 test interfaces lying around
This bug has been around for a long time but here is a build with it...
BIND 9.16.16 (Stable Release) <id:0c314d8>
running on SunOS i86pc 5.11 11.4.40.107.3
built by make with '--prefix=/opt/local/bind' '--mandir=/opt/local/man' '--with-python=/opt/local/bin/python3.8' 'CPPFLAGS=-I/usr/include/kerberosv5'
compiled by GCC 7.3.0
compiled with OpenSSL version: OpenSSL 1.1.1k 25 Mar 2021
linked to OpenSSL version: OpenSSL 1.1.1l 24 Aug 2021
compiled with libuv version: 1.40.0
linked to libuv version: 1.40.0
compiled with libxml2 version: 2.9.10
linked to libxml2 version: 20912
compiled with zlib version: 1.2.11
linked to zlib version: 1.2.11
threads support is enabled
default paths:
named configuration: /opt/local/bind/etc/named.conf
rndc configuration: /opt/local/bind/etc/rndc.conf
DNSSEC root key: /opt/local/bind/etc/bind.keys
nsupdate session key: /opt/local/bind/var/run/named/session.key
named PID file: /opt/local/bind/var/run/named/named.pid
named lock file: /opt/local/bind/var/run/named/named.lock
Also present in 9.16.24
as root:
bin/tests/system/ifconfig.sh up
ordinarily a 'make test' would be done here...
bin/tests/system/ifconfig.sh down
ifconfig -a
lo0: flags=3001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,FIXEDMTU,VIRTUAL> mtu 1500 index 1
inet 127.0.0.1 netmask ff000000
...
lo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1
inet6 ::1/128
...
bin/tests/system/ifconfig.sh up
bin/tests/system/ifconfig.sh down
ifconfig: could not create address: Can't assign requested address
ifconfig: cannot unplumb lo0:0: Invalid interface name
ifconfig: cannot unplumb lo0:0: Invalid interface name
ifconfig: could not create address: Can't assign requested address
ifconfig: could not create address: Can't assign requested address
ifconfig: setifaddr: SIOCGLIFNETMASK: lo0:20: no such interface
ifconfig: setifaddr: SIOCGLIFNETMASK: lo0:20: no such interface
ifconfig: setifflags: SIOCGLIFFLAGS: lo0:20: no such interface
ifconfig: cannot unplumb lo0:20: No such interface
ifconfig -a
lo0: flags=3001000848<LOOPBACK,RUNNING,MULTICAST,IPv4,FIXEDMTU,VIRTUAL> mtu 1500 index 1
inet 10.53.0.1 netmask ff000000
lo0:12: flags=3001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,FIXEDMTU,VIRTUAL> mtu 1500 index 1
inet 10.53.1.2 netmask ff000000
lo0:22: flags=3001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,FIXEDMTU,VIRTUAL> mtu 1500 index 1
inet 10.53.2.2 netmask ff000000
...
lo0: flags=2002000848<LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1
inet6 ::1/128
lo0:12: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1
inet6 fd92:7065:b8e:99ff::2/64
lo0:22: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1
inet6 fd92:7065:b8e:ff::2/64
...
Note lo0 is down and lo12, lo22 are lying around still.
Fixed via:
ifconfig lo0 127.0.0.1 up
ifconfig lo0:12 down unplumb
ifconfig lo0:22 down unplumb
ifconfig lo0 inet6 up
ifconfig lo0:12 inet6 down unplumb
ifconfig lo0:22 inet6 down unplumb
ifconfig -a before and after should look the same; lo0 shouldn't be touched
none
Trivial fix; remove "-1" in the down section for int calculation. Also make down do things in same order as up; don't see any advantage to doing it in reverse order.
diff is against 9.16.24 release
*** bin/tests/system/ifconfig.sh.orig Tue Dec 7 12:24:49 2021
--- bin/tests/system/ifconfig.sh Fri Dec 17 03:33:55 2021
***************
*** 160,169 ****
2) ipv6="00" ;;
*) ipv6="" ;;
esac
! for ns in 10 9 8 7 6 5 4 3 2 1
do
[ $i -gt 0 -a $ns -gt 2 ] && continue
! int=`expr $i \* 10 + $ns - 1`
case "$sys" in
*-pc-solaris2.5.1)
ifconfig lo0:$int 0.0.0.0 down
--- 160,169 ----
2) ipv6="00" ;;
*) ipv6="" ;;
esac
! for ns in 1 2 3 4 5 6 7 8 9 10
do
[ $i -gt 0 -a $ns -gt 2 ] && continue
! int=`expr $i \* 10 + $ns`
case "$sys" in
*-pc-solaris2.5.1)
ifconfig lo0:$int 0.0.0.0 down