I've done reasonably complicated source-based routing years ago with the
ipfw utility, on FreeBSD, though a quick check informs me that
ipfw is deprecated now, replaced by
pfctl (Packet Filter Control). This is on MacOS/FreeBSD, but its likely ported to Linux.
Even many more years ago, we used to use the open source
GateD open-source UNIX-based routing daemon for source-based policy routing on the NSFnet's backbone of IBM RS/6000s runing AIX, but that software package does not appear to be current.
Wikipedia has a list of open-source routing software packages here , most if not all will provide for source-based policy routing above and beyond basic
Two packages that I've heard of before, though not personally used are BIRD and Quagga.