Created attachment 16262 [details] IF_INDEX is 4294967295 In SDC 2020 SMB3 Virtual IO Lab, run Windows Protocol Test Suite to test FileServer multichannel test cases. Samba server has 2 virtual interfaces for VPN connection: > name=tun2001, ip/mask=192.168.144.9/22 > name=tun2002, ip/mask=192.168.144.10/22 test suite client can ping these 2 ip addresses and browse shares. Then client try to use IOCTL FSCTL_QUERY_NETWORK_INTERFACE_INFO to get the virtual ip addresses of samba server, but samba server responded it without the virtual ip addresses. My VPN setup is point-to-point and the virtual interfaces 'tun2001' & 'tun2002' are without flag IFF_BROADCAST. So edit smb.conf and add "interfaces = ${virtual_ip}/${mask_length};if_index=${id}", like this: > interfaces = eth4 eth8 eth11 eth10 qvs0 "192.168.144.9/22;if_index=50" "192.168.144.10/22;if_index=51" then samba server IOCTL response could return the virtual ip addresses, but found a issue: the interface index of virtual ip addresses is always 4294967295 (0xFFFFFFFF, -1). * Steps to reproduce 1. Setup VPN and get 2 virtual interfaces: tun2001 and tun2002. > # ifconfig | grep -B1 "inet\s" | grep -E "[0-9]|lo" > eth10 Link encap:Ethernet HWaddr 24:5E:BE:2A:98:D2 > inet addr:67.30.1.2 Bcast:67.30.1.255 Mask:255.255.255.0 > eth11 Link encap:Ethernet HWaddr 24:5E:BE:2A:98:D1 > inet addr:67.30.2.2 Bcast:67.30.2.255 Mask:255.255.255.0 > eth4 Link encap:Ethernet HWaddr 24:5E:BE:35:7D:91 > inet addr:67.55.1.2 Bcast:67.55.1.255 Mask:255.255.255.0 > eth8 Link encap:Ethernet HWaddr 24:5E:BE:26:E8:02 > inet addr:67.55.2.2 Bcast:67.55.2.255 Mask:255.255.255.0 > lo Link encap:Local Loopback > inet addr:127.0.0.1 Mask:255.0.0.0 > qvs0 Link encap:Ethernet HWaddr 24:5E:BE:2B:FA:45 > inet addr:10.19.250.195 Bcast:10.19.255.255 Mask:255.255.0.0 > tun2001 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 > inet addr:192.168.144.9 P-t-P:192.168.144.9 Mask:255.255.252.0 > tun2002 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 > inet addr:192.168.144.10 P-t-P:192.168.144.10 Mask:255.255.252.0 > # ip address | grep -B2 "inet\s" | grep -E "[0-9]|lo|link" > ... <cut> ... > 50: tun2001: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 100 > link/none > inet 192.168.144.9/22 brd 192.168.147.255 scope global tun2001 > 51: tun2002: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 100 > link/none > inet 192.168.144.10/22 brd 192.168.147.255 scope global tun2002 2. Add virtual ip address, mask, and if_index into smb.conf > > interfaces = eth4 eth8 eth11 eth10 qvs0 "192.168.144.9/22;if_index=50" "192.168.144.10/22;if_index=51" 3. Check the IOCTL FSCTL_QUERY_NETWORK_INTERFACE_INFO response. * Actual result The interface index of virtual interfaces is always 4294967295. * Expected result. The interface index of virtual interfaces should follow 'if_index' setup.
I also saw this and also a panic when if_index=1,capability=RSS was specified.
CI is in progress, patch against master: https://gitlab.com/samba-team/devel/samba/-/pipelines/194817199
(In reply to Stefan Metzmacher from comment #1) ohh not noticed my test only apply if_index, will test this combination: if_index=1,capability=RSS
(In reply to Jones Syue from comment #3) I'm not 100% sure, I'll have to take a closer look at some log files/backtraces next week.
Before apply the patch, 'local_interfaces' does not list the virtual ip addresses: 192.168.144.9 & 192.168.144.10 (gdb) set $i=0 set $end=8 while ($i < $end) printf "name=%s,\tflags=%#x(IFF_BROADCAST=%s), if_index=%d, speed=%lld, capability=%d\n", probed_ifaces[$i]->name, probed_ifaces[$i]->flags, probed_ifaces[$i]->flags&IFF_BROADCAST ? "true" : "false", probed_ifaces[$i]->if_index, probed_ifaces[$i]->linkspeed, probed_ifaces[$i]->capability set $i=$i+1 end name=eth11, flags=0x11043(IFF_BROADCAST=true), if_index=12, speed=10000000000, capability=1 name=eth4, flags=0x11043(IFF_BROADCAST=true), if_index=6, speed=10000000000, capability=1 name=eth8, flags=0x11043(IFF_BROADCAST=true), if_index=8, speed=10000000000, capability=1 name=lo, flags=0x10049(IFF_BROADCAST=false), if_index=1, speed=1000000000, capability=0 name=tun2001, flags=0x110d1(IFF_BROADCAST=false), if_index=50, speed=10000000, capability=0 name=tun2002, flags=0x110d1(IFF_BROADCAST=false), if_index=51, speed=10000000, capability=0 name=qvs0, flags=0x11043(IFF_BROADCAST=true), if_index=27, speed=1000000000, capability=0 name=eth10, flags=0x11043(IFF_BROADCAST=true), if_index=13, speed=10000000000, capability=1 (gdb) (gdb) define plist set var $n = $arg0 while $n printf "name=%s,\t\tflags=%#x(IFF_BROADCAST=%s), if_index=%d, speed=%lld, capability=%d\n", $n->name, $n->flags, $n->flags&IFF_BROADCAST ? "true" : "false", $n->if_index, $n->linkspeed, $n->capability set var $n = $n->next end end (gdb) plist local_interfaces name=eth10, flags=0x11043(IFF_BROADCAST=true), if_index=13, speed=10000000000, capability=1 name=qvs0, flags=0x11043(IFF_BROADCAST=true), if_index=27, speed=1000000000, capability=0 name=eth8, flags=0x11043(IFF_BROADCAST=true), if_index=8, speed=10000000000, capability=1 name=eth4, flags=0x11043(IFF_BROADCAST=true), if_index=6, speed=10000000000, capability=1 name=eth11, flags=0x11043(IFF_BROADCAST=true), if_index=12, speed=10000000000, capability=1 (gdb)
After apply the patch, 'local_interfaces' could list the virtual ip addresses: 192.168.144.9 & 192.168.144.10 (gdb) plist local_interfaces name=192.168.144.10/, flags=0x2(IFF_BROADCAST=true), if_index=0, speed=1000000000, capability=0 name=192.168.144.9/2, flags=0x2(IFF_BROADCAST=true), if_index=0, speed=1000000000, capability=0 name=qvs0, flags=0x11043(IFF_BROADCAST=true), if_index=27, speed=1000000000, capability=0 name=eth10, flags=0x11043(IFF_BROADCAST=true), if_index=13, speed=10000000000, capability=1 name=eth11, flags=0x11043(IFF_BROADCAST=true), if_index=12, speed=10000000000, capability=1 name=eth8, flags=0x11043(IFF_BROADCAST=true), if_index=8, speed=10000000000, capability=1 name=eth4, flags=0x11043(IFF_BROADCAST=true), if_index=6, speed=10000000000, capability=1 (gdb)
patch v2 against master, add Metze comments (stack trace) from GitLab into git log, no change code, CI is in progress: https://gitlab.com/samba-team/devel/samba/-/commit/ac3f22a88c3dbbdef1e2a326f800a3ed418e3b3f
(In reply to Jones Syue from comment #7) CI is in progress: https://gitlab.com/samba-team/devel/samba/-/pipelines/195132757
(In reply to Jones Syue from comment #6, comment #5) Wrong comment, please skip.
probed_interfaces can list the virtual ip addresses: 192.168.144.9 & 192.168.144.10 Before apply patch, local_interfaces found the if_index of virtual ip is 0, fsctl_network_iface_info() will translate 0 to UINT32_MAX (4294967295) and return to client. (gdb) set $i=0 set $end=8 while ($i < $end) printf "name=%s,\tflags=%#x(IFF_BROADCAST=%s), if_index=%d, speed=%lld, capability=%d\n", probed_ifaces[$i]->name, probed_ifaces[$i]->flags, probed_ifaces[$i]->flags&IFF_BROADCAST ? "true" : "false", probed_ifaces[$i]->if_index, probed_ifaces[$i]->linkspeed, probed_ifaces[$i]->capability set $i=$i+1 end name=eth11, flags=0x11043(IFF_BROADCAST=true), if_index=12, speed=10000000000, capability=1 name=eth4, flags=0x11043(IFF_BROADCAST=true), if_index=6, speed=10000000000, capability=1 name=eth8, flags=0x11043(IFF_BROADCAST=true), if_index=8, speed=10000000000, capability=1 name=lo, flags=0x10049(IFF_BROADCAST=false), if_index=1, speed=1000000000, capability=0 name=tun2001, flags=0x110d1(IFF_BROADCAST=false), if_index=50, speed=10000000, capability=0 name=tun2002, flags=0x110d1(IFF_BROADCAST=false), if_index=51, speed=10000000, capability=0 name=qvs0, flags=0x11043(IFF_BROADCAST=true), if_index=27, speed=1000000000, capability=0 name=eth10, flags=0x11043(IFF_BROADCAST=true), if_index=13, speed=10000000000, capability=1 (gdb) (gdb) define plist set var $n = $arg0 while $n printf "name=%s,\t\tflags=%#x(IFF_BROADCAST=%s), if_index=%d, speed=%lld, capability=%d\n", $n->name, $n->flags, $n->flags&IFF_BROADCAST ? "true" : "false", $n->if_index, $n->linkspeed, $n->capability set var $n = $n->next end end (gdb) plist local_interfaces name=192.168.144.10/, flags=0x2(IFF_BROADCAST=true), if_index=0, speed=1000000000, capability=0 name=192.168.144.9/2, flags=0x2(IFF_BROADCAST=true), if_index=0, speed=1000000000, capability=0 name=qvs0, flags=0x11043(IFF_BROADCAST=true), if_index=27, speed=1000000000, capability=0 name=eth10, flags=0x11043(IFF_BROADCAST=true), if_index=13, speed=10000000000, capability=1 name=eth11, flags=0x11043(IFF_BROADCAST=true), if_index=12, speed=10000000000, capability=1 name=eth8, flags=0x11043(IFF_BROADCAST=true), if_index=8, speed=10000000000, capability=1 name=eth4, flags=0x11043(IFF_BROADCAST=true), if_index=6, speed=10000000000, capability=1 (gdb) > fsctl_network_iface_info > cur->ifindex = iface->if_index; > if (cur->ifindex == 0) { > /* > * Did not get interface index from kernel, > * nor from the config. ==> Apply a common > * default value for these cases. > */ > cur->ifindex = UINT32_MAX; > }
After patch, if_index can be parsed correctly, and fsctl_network_iface_info() can return expected if_index to client. (gdb) plist local_interfaces name=192.168.144.10/, flags=0x2(IFF_BROADCAST=true), if_index=51, speed=1000000000, capability=0 name=192.168.144.9/2, flags=0x2(IFF_BROADCAST=true), if_index=50, speed=1000000000, capability=0 name=qvs0, flags=0x11043(IFF_BROADCAST=true), if_index=27, speed=1000000000, capability=0 name=eth10, flags=0x11043(IFF_BROADCAST=true), if_index=13, speed=10000000000, capability=1 name=eth11, flags=0x11043(IFF_BROADCAST=true), if_index=12, speed=10000000000, capability=1 name=eth8, flags=0x11043(IFF_BROADCAST=true), if_index=8, speed=10000000000, capability=1 name=eth4, flags=0x11043(IFF_BROADCAST=true), if_index=6, speed=10000000000, capability=1
add bug id into git commit log, CI is in progress: https://gitlab.com/samba-team/devel/samba/-/pipelines/195149340
commit against master: https://gitlab.com/samba-team/devel/samba/-/commit/dd3c9e47d98b9790bc31c09fd489edd0cc3a850d CI is passed: https://gitlab.com/samba-team/devel/samba/-/pipelines/195149340 merge request: https://gitlab.com/samba-team/samba/-/merge_requests/1585
This bug was referenced in samba master: b78ff5717654064c8a4facc54a8e9833e5843c21
Created attachment 16292 [details] Patch for v4-13-test
Created attachment 16293 [details] Patch for v4-12-test
Reassigning to Karolin for inclusion in 4.12 and 4.13.
(In reply to Ralph Böhme from comment #17) Pushed to autobuild-v4-{13,12}-test.
This bug was referenced in samba v4-13-test: 68f19debb7453a83d1837c4a0595f7d433b562c0
This bug was referenced in samba v4-12-test: 4873f377e75d5104b4ca2afbc36783b850463eb0
Pushed to both branches. Closing out bug report. Thanks!
This bug was referenced in samba v4-13-stable (Release samba-4.13.3): 68f19debb7453a83d1837c4a0595f7d433b562c0
This bug was referenced in samba v4-12-stable (Release samba-4.12.11): 4873f377e75d5104b4ca2afbc36783b850463eb0