CMake: bump the minimum required CMake version to 3.5 From: Yegor Yefremov <yegorslists@googlemail.com> Older CMake versions are marked as deprecated and generate the related warning: Compatibility with CMake < 3.5 will be removed from a future version of CMake. Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
system-linux: fix race condition in netlink socket error handing The error handling needed for the buffer growth logic relies on uloop_fd's error flag, which is set based on epoll events. Doing so without handling recvmsg's error codes is racy, as an error state may be set between receiving epoll events and the next recvmsg, but calling recvmsg clears the error state. To fix this, add handling for errors returned by nl_recvmsgs_default() and nl_recv(); checking for u->error and retrieving the error status using getsockopt() becomes redundant. We have observed this issue on Gluon (recent OpenWrt 23.05); on some devices with DSA switches, the bridge interface's carrier-on event would consistenly get lost during boot due to insufficient buffer space (see [1]). We have bisected the issue to netifd commit 516ab774cc16 ("system-linux: fix race condition on bringing up wireless devices"), but that commit only uncovered the preexisting bug by switching from getting the carrier state from sysfs to using the netlink messages in cb_rtnl_event(). I suspect that other recent issues about netifd missing a carrier state change like [2] may have the same underlying cause. [1] https://github.com/freifunk-gluon/gluon/issues/3130 [2] https://github.com/openwrt/openwrt/issues/13863 Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Revert "system-linux: set pending to 0 on ifindex found or error for if_get_master" This reverts commit 66a7652176a7580b55076a0975b77c2bfb5bf7ce. Users reported that netifd hangs after this commit. I suspect that the added optimization which sets data->pending to false early might be the cause. It might leave unprocessed netlink messages in the socket, which could mess up the next netlink call. Signed-off-by: Felix Fietkau <nbd@nbd.name>
netifd: fix undefined va_list value which can cause crashes Reinitialize the va_list value after the call to netifd_udebug_vprintf() in netifd_log_message(). It's needed since netifd_udebug_vprintf() invokes vsnprintf() which in turn invokes the va_arg() macro, and after that call the va_list value is undefined. Signed-off-by: Mikael Magnusson <mikma@users.sourceforge.net>
system-linux: set pending to 0 on ifindex found or error for if_get_master Fix Coverity Defect 1559194 reporting an Infinite loop when data->pending is not set to 0 on finishing the callback. While this is a false-positive report as ACK is always called, this is a good time to optimize the code and make the callback exit early if we find the ifindex for the DSA conduit. Correctly set pending to 0 on ifindex found or error for if_get_master valid netlink callback. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
debug: remove newline from debug messages Signed-off-by: Felix Fietkau <nbd@nbd.name>
interface-ip: fix IPv4 route target masking A previous commit supposed to mask out excess host bits in route targets failed to correctly calculate the mask value, causing it to produce improper results for certain mask lengths. Fixes: #17 Fixes: 76eb342 ("interface-ip: mask out host bits in IPv4 route targets") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
system-linux: refresh MAC address on DSA port conduit change On changing the conduit for a DSA port, the conduit may have different a MAC address. In the scenario where a port is part of a bridge and is the primary port, some inconsistency may arise where the bridge have the MAC address of the previous conduit and is never updated. This inconsistency cause problem with packet forwarding with FDB and other related problems. To fix this, refresh the original MAC address after the conduit for the DSA port is changed by polling the new MAC address for the device using ioctl API. Fixes: 2dc7f450f3a2 ("system-linux: add option to configure DSA conduit device") Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>