On Sun, Nov 11, 2018 at 08:52:39PM -0800, Greg Steuck wrote:
> I was playing with `ifconfig tapN create`. It appears some devices can be
> created outside the useful range. E.g.
>
> % for i in {23..25}; do \
> dev=tap$(printf "%d" $((1 << $i))) && \
> doas ifconfig $dev destroy ; \
> doas ifconfig $dev create && \
> ifconfig $dev && \
> (cd /dev && doas ./MAKEDEV $dev); \
> done
> tap8388608: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
> lladdr fe:e1:ba:d0:af:7c
> index 85 priority 0 llprio 3
> groups: tap
> status: no carrier
> tap16777216: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
> lladdr fe:e1:ba:d1:b4:0e
> index 86 priority 0 llprio 3
> groups: tap
> status: no carrier
> mknod: major or minor number too large (93 16777216)
> tap33554432: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
> lladdr fe:e1:ba:d2:14:9e
> index 87 priority 0 llprio 3
> groups: tap
> status: no carrier
> mknod: major or minor number too large (93 33554432)
>
> Is there some utility in having tap devices with ids outside 24 bit range
> that I'm overlooking? They don't seem to be fit for their stated purpose of
> being open'able as mknod doesn't work for such numbers.
A devices major and minor are all stored as part of a single 32 bit
number. 8 of the bits are for the major, 24 for the minor.
> I don't know how to make a call about restricting such device creation with
> tools or syscalls. Is the current state the local optimum?
If you can trick someone into implementing 64bit device ids you can have
more than your 16 millionth tap device.
> Thanks
> Greg
>
> --
> nest.cx is Gmail hosted, use PGP for anything private. Key:
> http://goo.gl/6dMsr
> Fingerprint: 5E2B 2D0E 1E03 2046 BEC3 4D50 0B15 42BD 8DF5 A1B0