{"id":13577595,"url":"https://github.com/troglobit/smcroute","last_synced_at":"2025-04-09T06:11:03.337Z","repository":{"id":2686279,"uuid":"2696426","full_name":"troglobit/smcroute","owner":"troglobit","description":"Static multicast routing for UNIX","archived":false,"fork":false,"pushed_at":"2024-09-29T06:22:39.000Z","size":1628,"stargazers_count":243,"open_issues_count":8,"forks_count":63,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-10-11T02:45:49.245Z","etag":null,"topics":["bsd","linux","multicast","multicast-routes","multicast-routing","unix"],"latest_commit_sha":null,"homepage":"https://troglobit.com/projects/smcroute/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/troglobit.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["troglobit"]}},"created_at":"2011-11-02T16:53:27.000Z","updated_at":"2024-09-29T06:22:43.000Z","dependencies_parsed_at":"2022-07-17T12:30:37.146Z","dependency_job_id":"757ffc6b-7343-4676-a69d-d8174eecfa91","html_url":"https://github.com/troglobit/smcroute","commit_stats":{"total_commits":1271,"total_committers":33,"mean_commits":"38.515151515151516","dds":"0.12273800157356407","last_synced_commit":"999bdd724a1f963ac8bfd0598ffdd2a3d651646e"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/troglobit%2Fsmcroute","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/troglobit%2Fsmcroute/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/troglobit%2Fsmcroute/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/troglobit%2Fsmcroute/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/troglobit","download_url":"https://codeload.github.com/troglobit/smcroute/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247987285,"owners_count":21028895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bsd","linux","multicast","multicast-routes","multicast-routing","unix"],"created_at":"2024-08-01T15:01:22.795Z","updated_at":"2025-04-09T06:11:03.320Z","avatar_url":"https://github.com/troglobit.png","language":"C","funding_links":["https://github.com/sponsors/troglobit"],"categories":["C"],"sub_categories":[],"readme":"SMCRoute - A static multicast routing daemon\n============================================\n[![License Badge][]][License] [![GitHub Status][]][GitHub] [![Coverity Status][]][Coverity Scan]\n\nTable of Contents\n-----------------\n* [About](#about)\n* [Features](#features)\n* [Usage](#usage)\n  * [Caveat](#caveat)\n  * [Actions Scripts](#action-scripts)\n  * [Many Interfaces](#many-interfaces)\n  * [Multiple Routing Tables](#multiple-routing-tables)\n  * [Client Tool](#client-tool)\n* [Wildcard Routes](#wildcard-routes)\n* [Multicast Router Discovery](#multicast-router-discovery)\n* [Build \u0026 Install](#build--install)\n  * [Linux Requirements](#linux-requirements)\n  * [*BSD Requirements](#bsd-requirements)\n  * [General Requirements](#general-requirements)\n  * [Configure \u0026 Build](#configure--build)\n  * [Integration with systemd](#integration-with-systemd)\n  * [Static Build](#static-build)\n  * [Building from GIT](#building-from-git)\n* [Origin \u0026 References](#origin--references)\n\n\nAbout\n-----\n\nSMCRoute is a static multicast routing daemon providing fine grained\ncontrol over the multicast forwarding cache (MFC) in the UNIX kernel.\nBoth IPv4 and IPv6 are fully supported.\n\nSMCRoute can be used as an alternative to dynamic multicast routers like\n[mrouted][], [pimd][], or [pim6sd][] in setups where static multicast\nroutes should be maintained and/or no proper IGMP or MLD signaling\nexists.\n\nMulticast routes exist in the UNIX kernel as long as a multicast routing\ndaemon runs.  On Linux, multiple multicast routers can run simultaneously\nusing different multicast routing tables.\n\nThe full documentation of SMCRoute is available in the manual pages, see\n[smcrouted(8)][], [smcroutectl(8)][], and [smcroute.conf(5)][].\n\n\nFeatures\n--------\n\nAll features, except [mrdisc][], are supported for both IPv4 and IPv6.\nPlease note, some features may not be available on systems other than\nLinux.  E.g., FreeBSD does not have SSM group join support.\n\n  - Configuration file support, `/etc/smcroute.conf`\n  - Configuration snippet include support, `/etc/smcroute.d/*.conf`\n  - Daemon startup options support, `/etc/default/smcroute`\n  - Support for seamless reloading of the configuration on `SIGHUP`\n  - Source-less on-demand routing, a.k.a. wildcard `(*,G)` based static\n    routing, including support for `(*,G/LEN)` and `(S/LEN,G/LEN)`\n  - Optional built-in [mrdisc][] support for IPv4, [RFC4286][]\n  - Support for multiple routing tables on Linux\n  - Client to add/remove routes, join/leave groups, and built-in support\n    to show both routes and joined groups\n  - Interface wildcard matching, `eth+` matches `eth0, eth15`\n\n\u003e **Note:** `smcroutectl` can be used to freely modify the runtime state\n\u003e            of `smcrouted`, but any changes made (routes/groups) are\n\u003e            lost when the configuration is reloaded.  This is by design.\n\n\nUsage\n-----\n\n    smcrouted [-nNhsv] [-c SEC] [-d SEC] [-e CMD] [-f FILE] [-i NAME]\n\t          [-l LVL] [-p USER:GROUP] [-P FILE] [-t ID] [-u FILE]\n    \n    smcroutectl [-dptv] [-i NAME] [-u FILE] [COMMAND]\n    smcroutectl ⟨kill | reload⟩\n    smcroutectl ⟨add  | rem⟩    ⟨ROUTE⟩\n    smcroutectl ⟨join | leave⟩  ⟨GROUP⟩\n    smcroutectl  show [ routes | groups]\n\nTo set multicast routes and join groups you must first start the daemon,\nwhich needs *root privileges*, or `CAP_NET_ADMIN`.  Use `smcrouted -n`\nto run the daemon in the foreground, as required by modern init daemons\nlike systemd and [Finit][].\n\nWhen started from systemd, `smcrouted` runs with the `-n -s` options,\ni.e. supervised in the foreground and uses syslog for logging output.\nThe default log level is `INFO`, this can be adjusted using the file\n`/etc/default/smcroute`:\n\n    SMCROUTED_OPTS=-l debug\n\nWhen configured with `--sysconfdir=/etc`, like most Linux distributions\ndo, `smcrouted` reads `/etc/smcroute.conf`, which can look something\nlike this:\n\n    mgroup from eth0 group 225.1.2.3\n    mgroup from eth0 group 225.1.2.3 source 192.168.1.42\n    mroute from eth0 group 225.1.2.3 source 192.168.1.42 to eth1 eth2\n\nThe first line means \"Join multicast group 225.1.2.3 on interface eth0\".\nUseful if `eth0` is not directly connected to the source, but to a LAN\nwith switches with IGMP snooping.  Joining the group opens up multicast\nfor that group towards `eth0`.  See below Caveat for limitations.\n\nThe second `mgroup` is for source specific group join, i.e. the host\nspecifies that it wants packets from 192.168.1.42 and no other source.\n\nThe third `mroute` line is the actual layer-3 routing entry.  Here we\nsay that multicast data originating from 192.168.1.42 on `eth0` to the\nmulticast group 225.1.2.3 should be forwarded to interfaces `eth1` and\n`eth2`.\n\n**Note:** To test the above you can use ping from another device.  The\n   multicast should be visible as long as your IP# matches the source\n   above and you ping 225.1.2.3 -- **REMEMBER TO SET THE TTL \u003e1**\n\n    ping -I eth0 -t 2 225.1.2.3\n\nThe TTL is what usually bites people first trying out multicast routing.\nMost TCP/IP stacks default to a TTL of 1 for multicast frames, e.g. ping\nabove requires `-t 2`, or greater.  This limitation is intentional and\nreduces the risk of someone accidentally flooding multicast.  Remember,\nmulticast *behaves like broadcast* unless limited.\n\nThe TTL should preferably be set on the sender side, e.g. the camera,\nbut can also be modified in the firewall on a router.  Be careful though\nbecause the TTL is the only thing that helps prevent routing loops!  On\nLinux the following `iptables` command can be used to change the TTL:\n\n    iptables -t mangle -A PREROUTING -i eth0 -d 225.1.2.3 -j TTL --ttl-inc 1\n\nSome commands, like this one, must usually be run with root privileges\nor the correct set of capabilities.\n\n### Caveat\n\nOn some platforms there is a limit of 20 groups per socket.  This stems\nfrom a limit in BSD UNIX, which also affects Linux.  The setting that\ncontrols this is `IP_MAX_MEMBERSHIPTS`, defined in the system header\nfile `netinet/in.h`.  Linux users can tweak this with the following\n`/proc` setting:\n\n    echo 40 \u003e /proc/sys/net/ipv4/igmp_max_memberships\n\n`smcrouted` probes this at runtime by attempting to join as many groups\nas possible (as have been requested), when the kernel accepts no further\njoins on a socket, `smcrouted` opens a new one.\n\nFor large setups it is recommended to investigate enabling multicast\nrouter ports in the switches, either statically or by enabling support\nfor multicast router discovery, RFC 4286, or possibly use a dynamic\nmulticast routing protocol.\n\n\n### Action Scripts\n\n    smcrouted -e /path/to/script\n\nWith `-e CMD` a user script or command can be called when `smcrouted`\nreceives a `SIGHUP` or installs a multicast route to the kernel.  This\nis useful if you, for instance, also run a NAT firewall and need to\nflush connection tracking after installing a multicast route.\n\n\n### Many Interfaces\n\n    smcrouted -N\n\nWith the `-N` command line option SMCRoute does *not* prepare all system\ninterfaces for multicast routing.  Very useful if your system has a lot\nof interfaces but only a select few are required for multicast routing.\nUse the following in `/etc/smcroute.conf` to enable interfaces:\n\n    phyint eth0 enable\n    phyint eth1 enable\n    phyint eth2 enable\n\nIt is possible to use any interface that supports the `MULTICAST` flag.\n\nNote, however, that depending on the UNIX kernel in use, you may have to\nhave an interface address set, in the relevant address family, and the\ninterface may likely also have to be `UP`.\n\n\n### Multiple Routing Tables\n\nOn Linux it is possible to run multiple multicast routing daemons due to\nits support for multiple multicast routing tables.  In such setups it\nmay be useful to change the default identity of SMCRoute:\n\n    smcrouted -i mrt1 -t 1\n    smcrouted -i mrt2 -t 2\n\nThe `-i NAME` option alters the default syslog name, config file, PID\nfile, and client socket file name used.  In the first instance above,\n`smcrouted` will use:\n\n- `/etc/mrt1.conf`\n- `/var/run/mrt1.pid`\n- `/var/run/mrt1.sock`\n\nand syslog messages will use the `mrt1` identity as well.  Remember to\nuse the same `-i NAME` also to `smcroutectl`.\n\n\n### Client Tool\n\nSMCRoute also has a client interface to interact with the daemon:\n\n    smcroutectl join eth0 225.1.2.3\n    smcroutectl add  eth0 192.168.1.42 225.1.2.3 eth1 eth2\n\nIf the daemon runs with a different identity the client needs to be\ncalled using the same identity:\n\n    smcrouted   -i mrt\n    smcroutectl -i mrt show\n\nThere are more commands.  See the man page or the online help for\ndetails:\n\n    smcroutectl help\n\n\u003e **Note:** Root privileges are required by default for `smcroutectl` due\n\u003e to the IPC socket permissions.\n\n\nWildcard Routes\n---------------\n\nMulticast often originates from different sources but usually not at the\nsame time.  For a more generic setup, and to reduce the number of rules\nrequired, it is possible to set `(*,G)` multicast routes for both IPv4\nand IPv6.  Variants include `(*,G/LEN)` and `(S/LEN,G/LEN`.  These\nwildcard routes are used as \"templates\" to match against and install\nproper `(S,G)` routes when the kernel informs `smcrouted` of inbound\nmulticast from new sources.\n\nExample `smcroute.conf`:\n\n    phyint eth0 enable mrdisc\n    phyint eth1 enable\n    phyint eth2 enable\n    \n    mgroup from eth0 group 225.1.2.3\n    mroute from eth0 group 225.1.2.3 to eth1 eth2\n\nor, from the command line:\n\n    # smcroutectl join eth0 225.1.2.3\n    # smcroutectl add  eth0 225.1.2.3 eth1 eth2\n\nAlso, see the `smcrouted -c SEC` option for periodic flushing of learned\n`(*,G)` rules, including the automatic blocking of unknown multicast, and\nthe `smcroutectl flush` command.\n\n\nMulticast Router Discovery\n--------------------------\n\nAnother interesting feature is multicast router discovery, [mrdisc][],\ndescribed in [RFC4286][].  This feature is disabled by default, enable\nwith `configure --enable-mrdisc`.  When enabled it periodically sends\nout an IGMP message on inbound interfaces¹ to alert switches to open up\nmulticast in that direction.  Not many managed switches have support for\nthis yet.\n\n\u003e **Note:** [mrdisc][] only works on Linux due to `SO_BINDTODEVICE`.\n\n____  \n¹ Notice the `mrdisc` flag to the above `phyint eth0` directive, which\nis missing for `eth1` and `eth2`.\n\n\nBuild \u0026 Install\n---------------\n\nSMCRoute should in theory work on any UNIX like operating system which\nsupports the BSD MROUTING API.  Both Linux and FreeBSD are tested on a\nregular basis.\n\n### Linux Requirements\n\nOn Linux the following kernel config is required:\n\n    CONFIG_IP_MROUTE=y\n    CONFIG_IP_PIMSM_V1=y\n    CONFIG_IP_PIMSM_V2=y\n    CONFIG_IP_MROUTE_MULTIPLE_TABLES=y       # For multiple routing tables\n    CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y     # For multiple routing tables\n\n### *BSD Requirements\n\nOn *BSD the following kernel config is required:\n\n    options    MROUTING    # Multicast routing\n    options    PIM         # pimd extensions used for (*,G) support\n\nFreeBSD support module loading, `kldload(8)`, edit `/boot/loader.conf`:\n\n    ip_mroute_load=\"yes\"\n    ip_mroute6_load=\"yes\"\n\n### General Requirements\n\nCheck the list of multicast capable interfaces:\n\n    cat /proc/net/dev_mcast\n\nor look for interfaces with the `MULTICAST` flag in the output from:\n\n    ifconfig\n\nSome interfaces have the `MULTICAST` flag disabled by default, like `lo`\nand `greN`.  Usually this flag can be enabled administratively.\n\n### Configure \u0026 Build\n\nThe GNU Configure \u0026 Build system use `/usr/local` as the default install\nprefix.  In many cases this is useful, but this means the configuration\nfiles, cache, and PID files will also use that prefix.  Most users have\ncome to expect those files in `/etc/` and `/var/` and configure has a\nfew useful options that are recommended to use.  For SMCRoute you may\nwant to use something like this:\n\n    ./configure --prefix=/usr --sysconfdir=/etc --runstatedir=/var/run\n    make -j5\n    sudo make install-strip\n\nUsually your system reserves `/usr` for native pacakges, so most users\ndrop `--prefix`, installing to `/usr/local`, or use `--prefix=/opt`.\n\n**Note:** On some systems `--runstatedir` may not be available in the\n  configure script, try `--localstatedir=/var` instead.\n\n\n### Privilege Separation\n\nAs of SMCRoute v2.2 support for privilege separation using the `libcap`\nlibrary was added.  It is used to drop full root privileges at startup,\nretaining only `CAP_NET_ADMIN` for managing the multicast routes.\n\nThe build system searches for the `libcap` library and header file(s).\nBoth `libcap-dev` and `pkg-config` are required.\n\n**Note:** Although support is automatically detected, the build system\n          will issue a warning if `libcap` is missing.  This can be\n          silenced with `configure --without-libcap`\n\n### Integration with systemd\n\nFor systemd integration `libsystemd-dev` and `pkg-config` are required.\nWhen the unit file is installed, `systemctl` can be used to enable and\nstart `smcrouted`:\n\n    $ sudo systemctl enable smcroute.service\n    $ sudo systemctl start smcroute.service\n\nCheck that it started properly by inspecting the system log, or:\n\n    $ sudo systemctl status smcroute.service\n\n### Static Build\n\nSome people want to build statically, to do this with `autoconf` add the\nfollowing `LDFLAGS=` *after* the configure script.  You may also need to\nadd `LIBS=...`, which will depend on your particular system:\n\n    ./configure LDFLAGS=\"-static\" ...\n\n### Building from GIT\n\nThe `configure` script and the `Makefile.in` files are generated and not\nstored in GIT.  So if you checkout the sources from GitHub you first\nneed to generated these files using `./autogen.sh`.\n\n\nOrigin \u0026 References\n-------------------\n\nSMCRoute is maintained collaboratively at [GitHub][Home].  Bug reports,\nfeature requests, patches/pull requests, and documentation fixes are\nmost welcome.  The project was previously hosted and maintained by\nDebian at [Alioth][] and before that by [Carsten Schill][], the original\nauthor.\n\n\n[smcrouted(8)]:    https://man.troglobit.com/man8/smcrouted.8.html\n[smcroutectl(8)]:  https://man.troglobit.com/man8/smcroutectl.8.html\n[smcroute.conf(5)]:https://man.troglobit.com/man5/smcroute.conf.5.html\n[Finit]:           https://github.com/troglobit/finit\n[mrouted]:         https://github.com/troglobit/mrouted\n[pimd]:            https://github.com/troglobit/pimd\n[pim6sd]:          https://github.com/troglobit/pim6sd\n[mrdisc]:          https://github.com/troglobit/mrdisc\n[RFC4286]:         https://tools.ietf.org/html/rfc4286\n[Home]:            https://github.com/troglobit/smcroute\n[Alioth]:          https://alioth.debian.org/projects/smcroute\n[Carsten Schill]:  http://www.cschill.de/smcroute/\n[License]:         https://en.wikipedia.org/wiki/GPL_license\n[License Badge]:   https://img.shields.io/badge/License-GPL%20v2-blue.svg\n[GitHub]:          https://github.com/troglobit/smcroute/actions/workflows/build.yml/\n[GitHub Status]:   https://github.com/troglobit/smcroute/actions/workflows/build.yml/badge.svg\n[Coverity Scan]:   https://scan.coverity.com/projects/3061\n[Coverity Status]: https://scan.coverity.com/projects/3061/badge.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftroglobit%2Fsmcroute","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftroglobit%2Fsmcroute","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftroglobit%2Fsmcroute/lists"}