[Bug 275491] ifconfig(8) only shows 101 members of a bridge
Date: Sun, 03 Dec 2023 02:29:20 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=275491 Bug ID: 275491 Summary: ifconfig(8) only shows 101 members of a bridge Product: Base System Version: 14.0-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: DtxdF@disroot.org Created attachment 246735 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=246735&action=edit libifconfig_bridge.diff Description: I have written a script to create a bridge and a thousand of tap(4) interfaces, each added as a member of that bridge. When ifconfig(8) is run with the bridge name as the first argument, the output shows only 101 members. The members are added correctly even though they are not shown in the output of ifconfig(8), since I tried to add a member that is not shown in the output and ifconfig(8) returns `File exists`. Steps to reproduce this issue: ``` # cat bridge.sh #!/bin/sh total=1000 bridge=$(ifconfig bridge create) echo "${bridge}" for n in `jot ${total}`; do ifconfig "${bridge}" addm $(ifconfig tap create) done # ./bridge.sh bridge2 # ifconfig bridge2 bridge2: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500 ether 58:9c:fc:00:34:14 id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15 maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200 root id 00:00:00:00:00:00 priority 0 ifcost 0 port 0 member: tap1000 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 250 priority 128 path cost 2000000 member: tap999 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 249 priority 128 path cost 2000000 member: tap998 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 248 priority 128 path cost 2000000 member: tap997 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 247 priority 128 path cost 2000000 member: tap996 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 246 priority 128 path cost 2000000 member: tap995 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 245 priority 128 path cost 2000000 member: tap994 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 244 priority 128 path cost 2000000 member: tap993 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 243 priority 128 path cost 2000000 member: tap992 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 242 priority 128 path cost 2000000 member: tap991 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 241 priority 128 path cost 2000000 member: tap990 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 240 priority 128 path cost 2000000 member: tap989 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 239 priority 128 path cost 2000000 member: tap988 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 238 priority 128 path cost 2000000 member: tap987 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 237 priority 128 path cost 2000000 member: tap986 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 236 priority 128 path cost 2000000 member: tap985 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 235 priority 128 path cost 2000000 member: tap984 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 234 priority 128 path cost 2000000 member: tap983 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 233 priority 128 path cost 2000000 member: tap982 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 232 priority 128 path cost 2000000 member: tap981 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 231 priority 128 path cost 2000000 member: tap980 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 230 priority 128 path cost 2000000 member: tap979 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 229 priority 128 path cost 2000000 member: tap978 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 228 priority 128 path cost 2000000 member: tap977 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 227 priority 128 path cost 2000000 member: tap976 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 226 priority 128 path cost 2000000 member: tap975 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 225 priority 128 path cost 2000000 member: tap974 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 224 priority 128 path cost 2000000 member: tap973 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 223 priority 128 path cost 2000000 member: tap972 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 222 priority 128 path cost 2000000 member: tap971 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 221 priority 128 path cost 2000000 member: tap970 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 220 priority 128 path cost 2000000 member: tap969 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 219 priority 128 path cost 2000000 member: tap968 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 218 priority 128 path cost 2000000 member: tap967 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 217 priority 128 path cost 2000000 member: tap966 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 216 priority 128 path cost 2000000 member: tap965 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 215 priority 128 path cost 2000000 member: tap964 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 214 priority 128 path cost 2000000 member: tap963 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 213 priority 128 path cost 2000000 member: tap962 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 212 priority 128 path cost 2000000 member: tap961 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 211 priority 128 path cost 2000000 member: tap960 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 210 priority 128 path cost 2000000 member: tap959 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 209 priority 128 path cost 2000000 member: tap958 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 208 priority 128 path cost 2000000 member: tap957 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 207 priority 128 path cost 2000000 member: tap956 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 206 priority 128 path cost 2000000 member: tap955 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 205 priority 128 path cost 2000000 member: tap954 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 204 priority 128 path cost 2000000 member: tap953 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 203 priority 128 path cost 2000000 member: tap952 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 202 priority 128 path cost 2000000 member: tap951 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 201 priority 128 path cost 2000000 member: tap950 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 200 priority 128 path cost 2000000 member: tap949 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 199 priority 128 path cost 2000000 member: tap948 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 198 priority 128 path cost 2000000 member: tap947 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 197 priority 128 path cost 2000000 member: tap946 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 196 priority 128 path cost 2000000 member: tap945 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 195 priority 128 path cost 2000000 member: tap944 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 194 priority 128 path cost 2000000 member: tap943 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 193 priority 128 path cost 2000000 member: tap942 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 192 priority 128 path cost 2000000 member: tap941 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 191 priority 128 path cost 2000000 member: tap940 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 190 priority 128 path cost 2000000 member: tap939 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 189 priority 128 path cost 2000000 member: tap938 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 188 priority 128 path cost 2000000 member: tap937 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 187 priority 128 path cost 2000000 member: tap936 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 186 priority 128 path cost 2000000 member: tap935 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 185 priority 128 path cost 2000000 member: tap934 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 184 priority 128 path cost 2000000 member: tap933 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 183 priority 128 path cost 2000000 member: tap932 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 182 priority 128 path cost 2000000 member: tap931 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 181 priority 128 path cost 2000000 member: tap930 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 180 priority 128 path cost 2000000 member: tap929 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 179 priority 128 path cost 2000000 member: tap928 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 178 priority 128 path cost 2000000 member: tap927 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 177 priority 128 path cost 2000000 member: tap926 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 176 priority 128 path cost 2000000 member: tap925 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 175 priority 128 path cost 2000000 member: tap924 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 174 priority 128 path cost 2000000 member: tap923 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 173 priority 128 path cost 2000000 member: tap922 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 172 priority 128 path cost 2000000 member: tap921 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 171 priority 128 path cost 2000000 member: tap920 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 170 priority 128 path cost 2000000 member: tap919 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 169 priority 128 path cost 2000000 member: tap918 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 168 priority 128 path cost 2000000 member: tap917 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 167 priority 128 path cost 2000000 member: tap916 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 166 priority 128 path cost 2000000 member: tap915 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 165 priority 128 path cost 2000000 member: tap914 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 164 priority 128 path cost 2000000 member: tap913 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 163 priority 128 path cost 2000000 member: tap912 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 162 priority 128 path cost 2000000 member: tap911 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 161 priority 128 path cost 2000000 member: tap910 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 160 priority 128 path cost 2000000 member: tap909 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 159 priority 128 path cost 2000000 member: tap908 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 158 priority 128 path cost 2000000 member: tap907 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 157 priority 128 path cost 2000000 member: tap906 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 156 priority 128 path cost 2000000 member: tap905 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 155 priority 128 path cost 2000000 member: tap904 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 154 priority 128 path cost 2000000 member: tap903 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 153 priority 128 path cost 2000000 member: tap902 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 152 priority 128 path cost 2000000 member: tap901 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 151 priority 128 path cost 2000000 member: tap900 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 150 priority 128 path cost 2000000 member: tap899 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 149 priority 128 path cost 2000000 groups: bridge nd6 options=9<PERFORMNUD,IFDISABLED> ``` Tested on: * 13.2-RELEASE-p6 * 14.0-RELEASE Notes: * This problem first occurred when I created three hundred of jails using AppJail, which no problems except when trying to stop a jail that uses a Virtualnet (if_bridge(4) + tap(4)). Since it uses the output of ifconfig(8) to get the members of a bridge and members are missing, AppJail fails to stop a jail. * Please correct me if I am wrong: In reading the relevant source files to understand how to fix this problem, I determined that when the `BRDGGIFS` request is passed to the ioctl(2) system call, it buffers a new ifbreq structure, so that if the returned length stored in ifbac_len plus the size of ifbreq (meaning a new structure is added) is less than or equal to the accumulated length, we can finish our work. -- You are receiving this mail because: You are the assignee for the bug.