nuttx/net
Stephen Fox 990ac856b2 net/bluetooth: fix BTPROTO_HCI socket device lookup
bluetooth_sendto() uses netdev_findbyindex(conn->bc_ldev + 1) to find
the Bluetooth network device for an HCI socket.  netdev_findbyindex
searches by global interface index, but bc_ldev is a 0-based count of
Bluetooth devices only — it bears no fixed relationship to the global
interface index.  If any netdev other than a Bluetooth device is
registered before it (e.g. loopback or Ethernet), the Bluetooth device
will not be at global index bc_ldev + 1 and the lookup will return NULL
or the wrong device.

Fix this by replacing netdev_findbyindex with a netdev_foreach walk
using a small callback (bluetooth_dev_byidx_callback) that counts only
NET_LL_BLUETOOTH devices and returns the bc_ldev-th one, regardless of
what else is registered or in what order.

Signed-off-by: Stephen Fox <stephenfox@geotab.com>
2026-05-06 14:45:46 +08:00
..
arp include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
bluetooth net/bluetooth: fix BTPROTO_HCI socket device lookup 2026-05-06 14:45:46 +08:00
can include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
devif net/devif: Reorder ipv4_input packet classification. 2026-04-23 15:11:08 +08:00
icmp net/icmp: use break instead of return in icmp_findconn 2026-04-13 08:46:57 -03:00
icmpv6 net/icmpv6: Discard Neighbor Discovery packet if optlen is 0 2026-05-04 12:06:43 -03:00
ieee802154 include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
igmp include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
inet include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
ipfilter include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
ipforward net/ipforward: Forbid non-forwardable multicast scopes. 2026-04-18 19:54:59 -03:00
ipfrag include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
local include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
mld net/mld: remove duplicate net_unlock in mld_gendog_work 2026-04-13 08:46:57 -03:00
nat net/nat: Let ICMP echo id zero be a valid NAT id. 2026-04-28 00:38:34 -03:00
neighbor include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
netdev net/netdev/netdev_txnotify.c: add debug log with interface name 2026-05-06 01:16:40 +08:00
netfilter net/netfilter: fix match name for UDP in ipt_filter 2026-04-13 08:46:57 -03:00
netlink net/netlink: fix memory leak in netlink_get_neighbor 2026-04-13 08:46:57 -03:00
pkt include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
procfs include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
route net/route: fix return value of net_writeroute_ipv6 2026-04-13 08:46:57 -03:00
rpmsg include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
sixlowpan net/sixlowpan: Fix sixlowpan_uncompresshdr_hc06() 2026-05-04 12:17:23 -03:00
socket include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
tcp net/tcp: improve tcp_send_txnotify 2026-04-21 22:13:36 +08:00
udp net/udp: fix conn_unlock not called outside conditional block 2026-04-09 03:04:15 +08:00
usrsock include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
utils include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
CMakeLists.txt net: Support no-lto option for the network build. 2026-01-20 10:12:45 +08:00
Kconfig net: Support no-lto option for the network build. 2026-01-20 10:12:45 +08:00
Makefile Makefile: Remove make depend files by make distclean 2026-02-16 16:27:57 +01:00
net_initialize.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00