tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: COMPAT_50 vs NET_RT_IFLIST



Well, I'm not super-familiar with setting up test environments using
chroot, but I was unable to get a qemu install of 5.2 (seems that
recent qemu doesn't deal well with piixide driver).  So I created a
new directory, and unpacked the 5.2 base.tgz distribution set in it.

I then did a chroot to the new directory, and tried to run ifconfig.
The results are not what I expected.  First, I verified that I had
all the right pieces inside the chroot directory - everything looks
good - at least its all from the right year!

# ls -l /sbin/ifconfig
-r-xr-xr-x  1 0  20  114557 Nov 28  2012 /sbin/ifconfig
# ldd /sbin/ifconfig
/sbin/ifconfig:
       -lutil.7 => /lib/libutil.so.7
       -lc.12 => /lib/libc.so.12
       -lprop.0 => /lib/libprop.so.0
# ls -l /lib/libutil.so*
lrwxrwxr-x  1 0  20     15 Nov 28  2012 /lib/libutil.so -> libutil.so.7.15
lrwxrwxr-x 1 0 20 15 Nov 28 2012 /lib/libutil.so.7 -> libutil.so.7.15
-r--r--r--  1 0  20  96585 Nov 28  2012 /lib/libutil.so.7.15
# ls -l /lib/libc.so*
lrwxrwxr-x  1 0  20       14 Nov 28  2012 /lib/libc.so -> libc.so.12.164
lrwxrwxr-x  1 0  20       14 Nov 28  2012 /lib/libc.so.12 -> libc.so.12.164
-r--r--r--  1 0  20  1317667 Nov 28  2012 /lib/libc.so.12.164
# ls -l /lib/libprop*
lrwxrwxr-x  1 0  20     14 Nov 28  2012 /lib/libprop.so -> libprop.so.0.7
lrwxrwxr-x  1 0  20     14 Nov 28  2012 /lib/libprop.so.0 -> libprop.so.0.7
-r--r--r--  1 0  20  82138 Nov 28  2012 /lib/libprop.so.0.7


But, ifconfig fails to run:

# ifconfig -l
ifconfig: getifaddrs: No such file or directory
# ifconfig -a
ifconfig: getifaddrs: No such file or directory


FWIW, this is running on a -current host (8.99.37, from yesterday), and
with the compat_50 (and above) modules loaded.

# modstat | grep compat
compat_50        exec     filesys  -        0       - compat_60
compat_60        exec     filesys  a        1       - compat_70
compat_70        exec     filesys  a        1       - compat_80
compat_80        exec     filesys  a        1       - -
compat_util      misc     builtin  -        0       - -
# uname -a
NetBSD speedy.whooppee.com 8.99.37 NetBSD 8.99.37 (SPEEDY 2019-04-24 23:45:06 UTC) #0: Thu Apr 25 09:00:09 UTC 2019 paul%speedy.whooppee.com@localhost:/build/netbsd-local/obj/amd64/sys/arch/amd64/compile/SPEEDY amd64

Digging just a little bit deeper with ktrace/kdump, I find

 7806      1 ifconfig CALL  __sysctl(0x7f7fff5d66d0,6,0,0x7f7fff5d66e8,0,0)
 7806      1 ifconfig RET   __sysctl -1 errno 2 No such file or directory
 7806      1 ifconfig CALL  write(2,0x7f7fff5d5ce0,0xa)
 7806      1 ifconfig GIO   fd 2 wrote 10 bytes
      "ifconfig: "
 7806      1 ifconfig RET   write 10/0xa
 7806      1 ifconfig CALL  write(2,0x7f7fff5d5dc0,0xa)
 7806      1 ifconfig GIO   fd 2 wrote 10 bytes
      "getifaddrs"
 7806      1 ifconfig RET   write 10/0xa
 7806      1 ifconfig CALL  write(2,0x774133de753f,2)
 7806      1 ifconfig GIO   fd 2 wrote 2 bytes
      ": "
 7806      1 ifconfig RET   write 2
 7806      1 ifconfig CALL  issetugid
 7806      1 ifconfig RET   issetugid 0
 7806      1 ifconfig CALL  issetugid
 7806      1 ifconfig RET   issetugid 0
 7806      1 ifconfig CALL  open(0x7f7fff5d5900,0,0)
 7806      1 ifconfig NAMI  "/usr/share/nls/nls.alias.db"
 7806      1 ifconfig RET   open -1 errno 2 No such file or directory

So looks to me like the sysctl() call is failing.

So, I decided to try a little bit harder. I installed a stock 8.0 system in a qemu vm, and then loaded 5.2's base.tgz into a chroot directory.

Using the stock 8.0 ifconfig, I see
	# ifconfig -l
	wm0 lo0
	# ifconfig -a
	wm0: flags=0x8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
	        capabilities=2bf80<TSO4,IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx>

		capabilities=2bf80<TCP4CSUM_Tx,UDP4CSUM_Rx,UDP4CSUM_Tx,TCP6CSUM_Tx>
	        capabilities=2bf80<UDP6CSUM_Tx>
	        enabled=0
	        ec_capabilities=7<VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU>
	        ec_enabled=0
	        address: 52:54:00:12:34:56
	        media: Ethernet autoselect (none)
	lo0: flags=0x8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33624
	        inet 127.0.0.1/8 flags 0x0
	        inet6 ::1/128 flags 0x20<NODAD>
	        inet6 fe80::1%lo0/64 flags 0x0 scopeid 0x2


When I chroot into the 5.2 directory, I get no output of any sort:

	# chroot /chroot-52/
	# ifconfig -l

	# ifconfig -a

So, there's definitely something wrong in 8.0 with the compat sysctl.

I probably changed the behavior with my work on the compat branch, which is likely why -current gets ENOENT errors.




+--------------------+--------------------------+-----------------------+
| Paul Goyette       | PGP Key fingerprint:     | E-mail addresses:     |
| (Retired)          | FA29 0E3B 35AF E8AE 6651 | paul%whooppee.com@localhost     |
| Software Developer | 0786 F758 55DE 53BA 7731 | pgoyette%netbsd.org@localhost   |
+--------------------+--------------------------+-----------------------+


Home | Main Index | Thread Index | Old Index