GithubHelp home page GithubHelp logo

troglobit / smcroute Goto Github PK

View Code? Open in Web Editor NEW
241.0 15.0 62.0 1.58 MB

Static multicast routing for UNIX

Home Page: https://troglobit.com/projects/smcroute/

License: GNU General Public License v2.0

Makefile 1.37% C 72.12% Shell 22.17% M4 4.34%
multicast multicast-routes linux bsd multicast-routing unix

smcroute's Introduction

SMCRoute - A static multicast routing daemon

License Badge GitHub Status Coverity Status

Table of Contents

About

SMCRoute is a static multicast routing daemon providing fine grained control over the multicast forwarding cache (MFC) in the UNIX kernel. Both IPv4 and IPv6 are fully supported.

SMCRoute can be used as an alternative to dynamic multicast routers like mrouted, pimd, or pim6sd in setups where static multicast routes should be maintained and/or no proper IGMP or MLD signaling exists.

Multicast routes exist in the UNIX kernel as long as a multicast routing daemon runs. On Linux, multiple multicast routers can run simultaneously using different multicast routing tables.

The full documentation of SMCRoute is available in the manual pages, see smcrouted(8), smcroutectl(8), and smcroute.conf(5).

Features

All features, except mrdisc, are supported for both IPv4 and IPv6. Please note, some features may not be available on systems other than Linux. E.g., FreeBSD does not have SSM group join support.

  • Configuration file support, /etc/smcroute.conf
  • Configuration snippet include support, /etc/smcroute.d/*.conf
  • Daemon startup options support, /etc/default/smcroute
  • Support for seamless reloading of the configuration on SIGHUP
  • Source-less on-demand routing, a.k.a. wildcard (*,G) based static routing, including support for (*,G/LEN) and (S/LEN,G/LEN)
  • Optional built-in mrdisc support for IPv4, RFC4286
  • Support for multiple routing tables on Linux
  • Client to add/remove routes, join/leave groups, and built-in support to show both routes and joined groups
  • Interface wildcard matching, eth+ matches eth0, eth15

Note: smcroutectl can be used to freely modify the runtime state of smcrouted, but any changes made (routes/groups) are lost when the configuration is reloaded. This is by design.

Usage

smcrouted [-nNhsv] [-c SEC] [-d SEC] [-e CMD] [-f FILE] [-i NAME]
          [-l LVL] [-p USER:GROUP] [-P FILE] [-t ID] [-u FILE]

smcroutectl [-dptv] [-i NAME] [-u FILE] [COMMAND]
smcroutectl ⟨kill | reload⟩
smcroutectl ⟨add  | rem⟩    ⟨ROUTE⟩
smcroutectl ⟨join | leave⟩  ⟨GROUP⟩
smcroutectl  show [ routes | groups]

To set multicast routes and join groups you must first start the daemon, which needs root privileges, or CAP_NET_ADMIN. Use smcrouted -n to run the daemon in the foreground, as required by modern init daemons like systemd and Finit.

When started from systemd, smcrouted runs with the -n -s options, i.e. supervised in the foreground and uses syslog for logging output. The default log level is INFO, this can be adjusted using the file /etc/default/smcroute:

SMCROUTED_OPTS=-l debug

When configured with --sysconfdir=/etc, like most Linux distributions do, smcrouted reads /etc/smcroute.conf, which can look something like this:

mgroup from eth0 group 225.1.2.3
mgroup from eth0 group 225.1.2.3 source 192.168.1.42
mroute from eth0 group 225.1.2.3 source 192.168.1.42 to eth1 eth2

The first line means "Join multicast group 225.1.2.3 on interface eth0". Useful if eth0 is not directly connected to the source, but to a LAN with switches with IGMP snooping. Joining the group opens up multicast for that group towards eth0. See below Caveat for limitations.

The second mgroup is for source specific group join, i.e. the host specifies that it wants packets from 192.168.1.42 and no other source.

The third mroute line is the actual layer-3 routing entry. Here we say that multicast data originating from 192.168.1.42 on eth0 to the multicast group 225.1.2.3 should be forwarded to interfaces eth1 and eth2.

Note: To test the above you can use ping from another device. The multicast should be visible as long as your IP# matches the source above and you ping 225.1.2.3 -- REMEMBER TO SET THE TTL >1

ping -I eth0 -t 2 225.1.2.3

The TTL is what usually bites people first trying out multicast routing. Most TCP/IP stacks default to a TTL of 1 for multicast frames, e.g. ping above requires -t 2, or greater. This limitation is intentional and reduces the risk of someone accidentally flooding multicast. Remember, multicast behaves like broadcast unless limited.

The TTL should preferably be set on the sender side, e.g. the camera, but can also be modified in the firewall on a router. Be careful though because the TTL is the only thing that helps prevent routing loops! On Linux the following iptables command can be used to change the TTL:

iptables -t mangle -A PREROUTING -i eth0 -d 225.1.2.3 -j TTL --ttl-inc 1

Some commands, like this one, must usually be run with root privileges or the correct set of capabilities.

Caveat

On some platforms there is a limit of 20 groups per socket. This stems from a limit in BSD UNIX, which also affects Linux. The setting that controls this is IP_MAX_MEMBERSHIPTS, defined in the system header file netinet/in.h. Linux users can tweak this with the following /proc setting:

echo 40 > /proc/sys/net/ipv4/igmp_max_memberships

smcrouted probes this at runtime by attempting to join as many groups as possible (as have been requested), when the kernel accepts no further joins on a socket, smcrouted opens a new one.

For large setups it is recommended to investigate enabling multicast router ports in the switches, either statically or by enabling support for multicast router discovery, RFC 4286, or possibly use a dynamic multicast routing protocol.

Action Scripts

smcrouted -e /path/to/script

With -e CMD a user script or command can be called when smcrouted receives a SIGHUP or installs a multicast route to the kernel. This is useful if you, for instance, also run a NAT firewall and need to flush connection tracking after installing a multicast route.

Many Interfaces

smcrouted -N

With the -N command line option SMCRoute does not prepare all system interfaces for multicast routing. Very useful if your system has a lot of interfaces but only a select few are required for multicast routing. Use the following in /etc/smcroute.conf to enable interfaces:

phyint eth0 enable
phyint eth1 enable
phyint eth2 enable

It is possible to use any interface that supports the MULTICAST flag.

Note, however, that depending on the UNIX kernel in use, you may have to have an interface address set, in the relevant address family, and the interface may likely also have to be UP.

Multiple Routing Tables

On Linux it is possible to run multiple multicast routing daemons due to its support for multiple multicast routing tables. In such setups it may be useful to change the default identity of SMCRoute:

smcrouted -i mrt1 -t 1
smcrouted -i mrt2 -t 2

The -i NAME option alters the default syslog name, config file, PID file, and client socket file name used. In the first instance above, smcrouted will use:

  • /etc/mrt1.conf
  • /var/run/mrt1.pid
  • /var/run/mrt1.sock

and syslog messages will use the mrt1 identity as well. Remember to use the same -i NAME also to smcroutectl.

Client Tool

SMCRoute also has a client interface to interact with the daemon:

smcroutectl join eth0 225.1.2.3
smcroutectl add  eth0 192.168.1.42 225.1.2.3 eth1 eth2

If the daemon runs with a different identity the client needs to be called using the same identity:

smcrouted   -i mrt
smcroutectl -i mrt show

There are more commands. See the man page or the online help for details:

smcroutectl help

Note: Root privileges are required by default for smcroutectl due to the IPC socket permissions.

Wildcard Routes

Multicast often originates from different sources but usually not at the same time. For a more generic setup, and to reduce the number of rules required, it is possible to set (*,G) multicast routes for both IPv4 and IPv6. Variants include (*,G/LEN) and (S/LEN,G/LEN. These wildcard routes are used as "templates" to match against and install proper (S,G) routes when the kernel informs smcrouted of inbound multicast from new sources.

Example smcroute.conf:

phyint eth0 enable mrdisc
phyint eth1 enable
phyint eth2 enable

mgroup from eth0 group 225.1.2.3
mroute from eth0 group 225.1.2.3 to eth1 eth2

or, from the command line:

# smcroutectl join eth0 225.1.2.3
# smcroutectl add  eth0 225.1.2.3 eth1 eth2

Also, see the smcrouted -c SEC option for periodic flushing of learned (*,G) rules, including the automatic blocking of unknown multicast, and the smcroutectl flush command.

Multicast Router Discovery

Another interesting feature is multicast router discovery, mrdisc, described in RFC4286. This feature is disabled by default, enable with configure --enable-mrdisc. When enabled it periodically sends out an IGMP message on inbound interfaces¹ to alert switches to open up multicast in that direction. Not many managed switches have support for this yet.

Note: mrdisc only works on Linux due to SO_BINDTODEVICE.


¹ Notice the mrdisc flag to the above phyint eth0 directive, which is missing for eth1 and eth2.

Build & Install

SMCRoute should in theory work on any UNIX like operating system which supports the BSD MROUTING API. Both Linux and FreeBSD are tested on a regular basis.

Linux Requirements

On Linux the following kernel config is required:

CONFIG_IP_MROUTE=y
CONFIG_IP_PIMSM_V1=y
CONFIG_IP_PIMSM_V2=y
CONFIG_IP_MROUTE_MULTIPLE_TABLES=y       # For multiple routing tables
CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y     # For multiple routing tables

*BSD Requirements

On *BSD the following kernel config is required:

options    MROUTING    # Multicast routing
options    PIM         # pimd extensions used for (*,G) support

FreeBSD support module loading, kldload(8), edit /boot/loader.conf:

ip_mroute_load="yes"
ip_mroute6_load="yes"

General Requirements

Check the list of multicast capable interfaces:

cat /proc/net/dev_mcast

or look for interfaces with the MULTICAST flag in the output from:

ifconfig

Some interfaces have the MULTICAST flag disabled by default, like lo and greN. Usually this flag can be enabled administratively.

Configure & Build

The GNU Configure & Build system use /usr/local as the default install prefix. In many cases this is useful, but this means the configuration files, cache, and PID files will also use that prefix. Most users have come to expect those files in /etc/ and /var/ and configure has a few useful options that are recommended to use. For SMCRoute you may want to use something like this:

./configure --prefix=/usr --sysconfdir=/etc --runstatedir=/var/run
make -j5
sudo make install-strip

Usually your system reserves /usr for native pacakges, so most users drop --prefix, installing to /usr/local, or use --prefix=/opt.

Note: On some systems --runstatedir may not be available in the configure script, try --localstatedir=/var instead.

Privilege Separation

As of SMCRoute v2.2 support for privilege separation using the libcap library was added. It is used to drop full root privileges at startup, retaining only CAP_NET_ADMIN for managing the multicast routes.

The build system searches for the libcap library and header file(s). Both libcap-dev and pkg-config are required.

Note: Although support is automatically detected, the build system will issue a warning if libcap is missing. This can be silenced with configure --without-libcap

Integration with systemd

For systemd integration libsystemd-dev and pkg-config are required. When the unit file is installed, systemctl can be used to enable and start smcrouted:

$ sudo systemctl enable smcroute.service
$ sudo systemctl start smcroute.service

Check that it started properly by inspecting the system log, or:

$ sudo systemctl status smcroute.service

Static Build

Some people want to build statically, to do this with autoconf add the following LDFLAGS= after the configure script. You may also need to add LIBS=..., which will depend on your particular system:

./configure LDFLAGS="-static" ...

Building from GIT

The configure script and the Makefile.in files are generated and not stored in GIT. So if you checkout the sources from GitHub you first need to generated these files using ./autogen.sh.

Origin & References

SMCRoute is maintained collaboratively at GitHub. Bug reports, feature requests, patches/pull requests, and documentation fixes are most welcome. The project was previously hosted and maintained by Debian at Alioth and before that by Carsten Schill, the original author.

smcroute's People

Contributors

afriza avatar alexeys85 avatar bombadil avatar ceclinux avatar dthiele avatar glandos avatar gromit1811 avatar henk84 avatar hn avatar hubertmis avatar jblache avatar jcpvdm avatar jonasj76 avatar kylex2 avatar librasungirl avatar mcpat avatar mellowcandle avatar remedi avatar resetius avatar siriobalmelli avatar stormwind99 avatar swegener avatar thayton avatar thedrow avatar troglobit avatar vespian avatar vklimovs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

smcroute's Issues

Multicast Routing to a GRE tunnel

Hello,

I am using smcroute "SMCRoute version 2.0.0 build 141102" on a server with Ubuntu 15.
To route several multicast from one interface(em2) to a GRE tunnel interface(gre00).

But when i try to setup the routing rule I get the error below:

$ sudo smcroute -a em2 192.168.113.100 239.255.1.1 gre00
Daemon error: Invalid output interface

I can route it to a physical interface:

$ sudo smcroute -a em2 192.168.113.100 239.255.1.1 em4
$ip mroute
(192.168.113.100, 239.255.1.1)   Iif: em2        Oifs: em4 

But not to the GRE interface. Does SMCRoute permits to do this configuration to an GRE interface?

Thanks in advance.

Manuel

Do not hide the build commands by default

For security reviews long time after build it is sometimes essential to be able to tell from the build logs
what compiler flags were really used to build the binary. To support such reviews, the build commands
should not be hidden by default.

I intend to work on this issue in the next week, but not today.

Add new kernel (include patch) feature to *not* enable ALLMULTI on VIFs

When VIFs are registered the kernel implicitly adds the ALLMULTI flag to allow all multicast to ingress the interface. This is useful for PIM and DVMRP, but not for low-resource CPU's that know exactly what it wants to forward.

This is an optimization which can only be used with (S,G) routes. The relatively new (*,G) support in SMCRoute relies on the kernel IGMP_NOCACHE feature to alert the daemon when new unknown multicast arrives on an interface. On FreeBSD (*,G) kernel support is included, newer MROUTING stack, but to support (*,G) on Linux the kernel would need to be upgraded.

Hence, when this optimization feature is added it is important not only to document the limitations, but also to add (at least) warnings if the user adds (*,G) routes in smcroute.conf or from the smcroute client.

Add support for Mac OS X

This was with the 2.1.0 release

$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for ANSI C header files... (cached) yes
checking for arpa/inet.h... yes
checking for fcntl.h... yes
checking for netinet/in.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for sys/ioctl.h... yes
checking for sys/socket.h... yes
checking for sys/types.h... (cached) yes
checking for syslog.h... yes
checking for unistd.h... (cached) yes
checking for net/route.h... yes
checking for sys/param.h... yes
checking for ifaddrs.h... yes
checking for linux/sockios.h... no
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking for uint32_t... yes
checking for pid_t... yes
checking vfork.h usability... no
checking vfork.h presence... no
checking for vfork.h... no
checking for fork... yes
checking for vfork... yes
checking for working fork... yes
checking for working vfork... (cached) yes
checking for atexit... yes
checking for dup2... yes
checking for memset... yes
checking for select... yes
checking for socket... yes
checking for strchr... yes
checking for strerror... yes
checking for strrchr... yes
checking for asprintf... yes
checking for sun_len member in struct sockaddr_un... yes
checking for linux/mroute.h... no
checking for linux/filter.h... no
checking for netinet/ip_mroute.h... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: executing depfiles commands
$ make
/Library/Developer/CommandLineTools/usr/bin/make  all-am
gcc -DHAVE_CONFIG_H -I.     -g -O2 -MT smcroute.o -MD -MP -MF .deps/smcroute.Tpo -c -o smcroute.o smcroute.c
In file included from smcroute.c:38:
./mclab.h:139:12: error: use of undeclared identifier 'MAXVIFS'
        uint8 ttl[MAX_MC_VIFS];         /* outgoing VIFs   */
                  ^
./mclab.h:131:21: note: expanded from macro 'MAX_MC_VIFS'
#define MAX_MC_VIFS MAXVIFS             /* from linux/mroute.h */
                    ^
smcroute.c:146:30: error: incomplete definition of type 'struct igmpmsg'
        if (ip->ip_p == 0 && igmpctl->im_msgtype == IGMPMSG_NOCACHE) {
                             ~~~~~~~^
smcroute.c:132:9: note: forward declaration of 'struct igmpmsg'
        struct igmpmsg *igmpctl;
               ^
smcroute.c:146:46: error: use of undeclared identifier 'IGMPMSG_NOCACHE'
        if (ip->ip_p == 0 && igmpctl->im_msgtype == IGMPMSG_NOCACHE) {
                                                    ^
smcroute.c:151:33: error: incomplete definition of type 'struct igmpmsg'
                mroute.group.s_addr  = igmpctl->im_dst.s_addr;
                                       ~~~~~~~^
smcroute.c:132:9: note: forward declaration of 'struct igmpmsg'
        struct igmpmsg *igmpctl;
               ^
smcroute.c:152:33: error: incomplete definition of type 'struct igmpmsg'
                mroute.sender.s_addr = igmpctl->im_src.s_addr;
                                       ~~~~~~~^
smcroute.c:132:9: note: forward declaration of 'struct igmpmsg'
        struct igmpmsg *igmpctl;
               ^
smcroute.c:153:33: error: incomplete definition of type 'struct igmpmsg'
                mroute.inbound       = igmpctl->im_vif;
                                       ~~~~~~~^
smcroute.c:132:9: note: forward declaration of 'struct igmpmsg'
        struct igmpmsg *igmpctl;
               ^
smcroute.c:681:8: warning: 'daemon' is deprecated: first deprecated in OS X 10.5 [-Wdeprecated-declarations]
                        if (daemon(0, 0) < 0) {
                            ^
/usr/include/stdlib.h:267:6: note: 'daemon' has been explicitly marked deprecated here
int      daemon(int, int) __DARWIN_1050(daemon) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_5, __IPHONE_2_0, __IPHONE_2_0);
         ^
1 warning and 6 errors generated.
make[1]: *** [smcroute.o] Error 1
make: *** [all] Error 2

Any ideas on how to overcome this?

Multicast daemon

This is not a bugreport, it is a support request. Feel free to ignore and close it.

I am trying to find a daemon that is both able to forward multicast traffic as well as handle the multicast signalling (IGMP v2 report/join and leave messages, optionally IGMP v3). I don't need/want it to talk any of the multicast routing protocols (DVMRP, PIM-SM, PIM-DM, CBT, MOSPF, MSDP, BGMP, ...).

Does such daemon exist?

Background: At home, I have a triple-play service: Internet, TV and telephony. The custom setup my ISP recommends is a setup with three networks: one for telephony, one for all Internet devices, and one for all TV set-top boxes. Each network connects to a different port on my modem. Now, I like to merge the Internet and IPTV network. For most parts this works, but not yet for the multicast part.

Custom setup

                              IGMP ->      |
set-top box -------------------------------------------- IP TV server
                          <- multicast     |
                                           |
            home network                   |         ISP network

My desired setup:

               IGMP ->                     | IGMP ->
set-top box ------------- FreeBSD router -------------- IP TV server
            <- multicast                   | <- multicast
                                           |
            home network                   |         ISP network

For good measure, I was just able to use nemesis to inject the correct IGMP packet and start and stop the correct IPTV streams. smcroute did forward them correctly, and I received them OK on my set-top box. Fun! Too bad it was also completely overflowing the rest of my network (I had to physically disconnect the upstream cable before I could get the command in to kill smcroute...)

I may still go with some more mundane approach like two VLANs, but I just liked this better. (The main reason is that I don't want a managed switch in my bedroom, where the TV now has a computer to stream from my NAS, and I like to add a set-top box there too. The natural solution of adding a second UTP cable failed because of narrow pipes in the walls. Watching streams over wifi is bad IMHO).

Can't build on Centos 6

autogen.sh works fine, no warnings
./configure work fines, no warnings
make errors out

smcroute.c:551: error: 'PACKAGE_URL' undeclared (first usage)

any idea on how to overcome this? I'm thinking I'm missing a dependency, but build dependencies aren't documented anywhere that I've found

IPv6 is disabled by default

from help of configure, i found:
--disable-ipv6 disable IPv6 support, default: enabled
But in fact, ipv6 is disabled by default, and if add "--disable-ipv6" when run configure, ipv6 would be enabled.

Add support for DHCP client interfaces

Some users want to run smcroute on DHCP client interfaces.

Such interfaces may not yet have a acquired a DHCP lease and will currently be filtered out by the iface_init() function.

A valid IP seems to be required when registering new VIF's in the kernel, this needs to be verified of course. If it turns out that an IP is required we need to add support for handling interfaces that may lose their IP (remove VIF) or suddenly receive a lease (add VIF) dynamically.

Affected multicast routes must be removed and added accordingly as well, of course.

This is Westermo WeOS issue #11865.

Over 20 Group Entries in smcroute.conf

When I create over 20 Entries in the smcroute.conf via

phyint ppp0 enable ttl-threshold 26
phyint lan-1.50 enable
mgroup from ppp0 group 239.35.10.4
mroute from ppp0 group 239.35.10.4 source 193.158.35.251 to lan-1.1 lan-1.50 wlan-1

The Transmitter for the Internet Site (ppp0), has over 100 Group's. The Performance for the Picture on the TV is verry slow.
All another multicast deamon on linux (pimd) are not running. The onlay works is the igmpproxy. But I need two, because I have I internal Plex Media Server, there send Multicast.
Unfortunately I can at the igmpproxy now one upstream Interface.
What can I do if I only two Transmitter for Multicast

Release all allocated memory

All allocated memory is not released appropriately. clean() function should release iface_list from ifvc.c and pidfile_path from pidfile.c.

==11728== HEAP SUMMARY:
==11728== in use at exit: 1,462 bytes in 2 blocks
==11728== total heap usage: 11 allocs, 9 frees, 12,926 bytes allocated
==11728==
==11728== 22 bytes in 1 blocks are still reachable in loss record 1 of 2
==11728== at 0x40291CC: malloc (vg_replace_malloc.c:296)
==11728== by 0x40AA4AF: vasprintf (vasprintf.c:76)
==11728== by 0x408BD2A: asprintf (asprintf.c:35)
==11728== by 0x804BCA2: pidfile (pidfile.c:64)
==11728== by 0x8049702: start_server (smcroute.c:445)
==11728== by 0x8049087: main (smcroute.c:692)
==11728==
==11728== 1,440 bytes in 1 blocks are still reachable in loss record 2 of 2
==11728== at 0x402B0D5: calloc (vg_replace_malloc.c:623)
==11728== by 0x804A6A1: iface_init (ifvc.c:50)
==11728== by 0x804962F: start_server (smcroute.c:410)
==11728== by 0x8049087: main (smcroute.c:692)
==11728==
==11728== LEAK SUMMARY:
==11728== definitely lost: 0 bytes in 0 blocks
==11728== indirectly lost: 0 bytes in 0 blocks
==11728== possibly lost: 0 bytes in 0 blocks
==11728== still reachable: 1,462 bytes in 2 blocks
==11728== suppressed: 0 bytes in 0 blocks

Allocated here:
https://github.com/troglobit/smcroute/blob/master/ifvc.c#L50
https://github.com/troglobit/smcroute/blob/master/pidfile.c#L64

Daemon error: Failed adding VIF for iface eth1: Cannot assign the requested address

Not sure what's going on here. I have a centos machine with 2 network cards on 2 different networks and my goal is to use this computer as a router between the 2 networks (network A 192.168.1.0/24 and network B 10.1.1.0/24). The machines are connected via a simple unmanaged switch (there's no router in the picture besides the cenos machine with 2 nics). I've already setup and have basic routing (ping, udp, tcp, etc) between the 2 networks.

I think smcroute is the right solution to route multicast traffic produced from network A to network B. (is it?)

iptables is cleared and stopped on all 3 machines in the picture

Long story short, my smcroute.conf look like this

phyint eth0 enable ttl-threshold 11
phyint eth1 enable ttl-threshold 11

mgroup from eth0 group 224.0.1.1
mroute from eth0 group 224.0.1.1 to eth1

mgroup from eth1 group 224.0.1.1
mroute from eth1 group 224.0.1.1 to eth0

After saving and starting the daemon, I don't get any errors to stdout. At this point multicast traffic is still not being routed. So I issued the following command

smcroute -j eth0 224.0.1.1
Sending commands....Daemon error: Failed adding VIF for iface eth1: Cannot assign the requested address

which is where i get the error message on the subject line.

Question, is smcroute the right tool for what I'm trying to accomplish? if so, what am I doing wrong (in terms the error message) and what else do i need to do in order to get this setup working?

smcroute -n does not imply -d (daemon), fails silently

In some other daemons, foreground options imply running daemon.
I assumed the same convention for smcroute, and I wasted time.

I think smcroute should either make -n imply -d or explicitly state that -n doesn't imply -d.

20 group limit, 200 route limit

I was wondering if you could please explain why SMCroute is limited to 20 groups and 200 routes. My multicast network application requires a larger number of groups and static routes to be supported.

Is this due to a Linux kernel limitation?

Is it possible to scale SMCroute up to support more groups/routes with a code change?

Can you suggest an alternative approach to allow for a greater number of groups/routes?

Thanks
Joseph Flores

Check return value of internal functions, or change to void

As pointed out in pull request #21 we have several internal API's that return a value (success/fail) which is never checked.

  • read_mroute6_socket()
  • read_ipc_command()
  • ...

This should be fixed in one or two ways:

  1. Change function type to void instead, or
  2. Check return value and, at the very least, call smclog(LOG_DEBUG, ...);

Simplify logging further, default to syslog for daemon

Currently both the client and the daemon logs to both stderr and syslog(). This is both confusing and annoying to the user.

It should work like this:

  • Daemon shall default to syslog when running in the background
  • Daemon shall default to stdout/stderr when running in the foreground, -n
  • When deamon is running in the foreground and the user gives -s syslog shall be used
  • The client shall always use stdout/stderr

Add option to run daemon as user specified in configuration

smcroute daemon can be run without root using capability CAP_NET_ADMIN. This capability enables the thread (among other networking related things) to add and remove multicast routes. This reduces the potential security risks involved in running the daemon with elevated privileges.

The syntax is as follows: /etc/smcroute.conf
user USERNAME

smcroute starts with root privileges. After initial startup procedure it will try to change the GID, UID and supplementary groups while preserving CAP_NET_ADMIN capability. It assumes that the target user exists, otherwise it will just print error message and continue running the daemon as root.

All capability and identity related functions that I used are cross-platform, and most seem to be POSIX compliant. Compiling requires linking libcap. If you are interested in this feature, I can fork and commit it.

Source address translation and smcroute

Hi. I've built a basic Linux router that performs NAT using iptables. I'm using smcroute to do static routing of multicast packets. After initiating smcroute, source address translation in multicast packets seems to kick in after tens of seconds to minutes. I'm wondering if something could be wrong with my setup. What influence does smcroute have on NAT, if any? More details towards the end of https://tewarid.github.io/2014/11/26/enable-ip-multicast-routing-in-linux-kernel.html. Thank you.

smcroute doesn't run on the foreground.

On ArchLinux and OpenWrt, smcroute -n silently exits.

smcroute -n -D prints nothing to stdout. journalctl doesn't show anything related to smcroute after executing smcroute -n -D.

Makefile installs both compressed and uncompressed man pages

It looks like "make install" is installing both the compressed and uncompressed versions of the mcsender and smcroute man pages:

./usr/share/man/man8/mcsender.8
./usr/share/man/man8/smcroute.8.gz
./usr/share/man/man8/smcroute.8
./usr/share/man/man8/mcsender.8.gz

Add socket filter for subscribed multicast

As a performance optimization on small embedded systems it would be a great idea to add a socket filter to the mcgroup4_socket and mcgroup6_socket so that joined multicast is not copied by the kernel to those sockets.

All we really want with the join mechanism is for the kernel to generate IGMP/MLD join out on the network to open up multicast forwarding on Layer-2 in IGMP snooping switches. (If we, the multicast router, generated IGMP query messages we would not need to do the join magic)

Add support for disabling interfaces

When SMCRoute starts up it probes the system for valid interfaces and enumerates VIF's in the kernel. All non-loopback multicast capable interfaces are considered valid. On Linux they do not even need to have an IP address, enumeration is done as is on IPv6, using ifindex.

However, when a VIF is enumerated (created) the kernel, at least Linux, will automatically set the ALLMULTI flag -- meaning "please ingress ALL multicast on this interface, we're a routing machine!". On low-resource systems this may not be a side effect you like, in particular if you have many interfaces but only route multicast between a few, or a pair.

This feature request details a way do declare interfaces as disabled or enabled, and thus enumerate VIFs only on the actual multicast routing interfaces.

Step One

In /etc/smcroute.conf:

# By default, all non-loopback multicast capable interfaces are enabled.
# If you want to use loopback, set the interface multicast flag on it.
phyint eth0 disable

Step Two

$ smcroute -N

In /etc/smcroute.conf:

# With -N no VIFs are enumerated by default, all interfaces must be enabled
# in the config file before attempting to enumerate.
phyint eth0 enable

Retry until network interfaces become available.

During boot, network interfaces could be temporarily unavailable.
After boot, network interfaces can randomly go down and up.

On OpenWrt, during boot, wlan0 goes up lately because it has to establish a connection with another wireless router. /etc/smcroute.conf tries to bind to wlan0 during boot and gives up instantly after a failure.

~# logread | grep smcroute
Wed Mar 15 23:05:28 2017 daemon.notice smcroute[1132]: SMCRoute version 2.0.0 build 160131
Wed Mar 15 23:05:28 2017 daemon.warn smcroute[1132]: Join multicast group, unknown interface wlan0
Wed Mar 15 23:05:28 2017 daemon.warn smcroute[1132]: 32: Invalid inbound IPv4 interface: wlan0

It is desirable for smcroute to retry for a while or for ever whenever network interfaces specified in /etc/smcroute.conf seem to be down during boot or after boot.

With this, smcroute doesn't need -t SEC option and doesn't need to care about the order of programs started during boot.

Replace -D with -L LVL to set daemon log level

The -D (and even the odd -v) command line option(s) crudely control the debug level in
current versions of SMCRoute. It should be replaced with:

-L LVL     Set log level: none, err, info, notice*, debug

Where LOG_NOTICE is the default log level.

smcroute on arm64

Hi

Trying to get smcroute to work on 64bit ARM box. I have used it on 32bit ARM before (ver 2.0.0) without any problems.

3.14.77 #2 SMP PREEMPT Sat Sep 24 07:18:38 UTC 2016 aarch64 aarch64 aarch64 GNU/Linux

I did install and compile latest build:

smcroute -v
SMCRoute version 2.2-rc1 build

I do run daemon without any errors, but it seems the daemon never starts
smcroute -d

When I try to kill the running kernel or add routes, I get:

Daemon not running: Connection refused

IP multicast is enabled in kernel, here is snippet from defconfig used to build kernel:

CONFIG_IP_MULTICAST=y
CONFIG_IP_ADVANCED_ROUTER=y

Just want to confirm that it should work in ARM64 before spending too much time on troubleshooting.

cross-compile support Makefile.in

Makefile.in line 13

Since automake is used, it should really be
CC = @cc@
instead of
CC ?= @cc@
Currently there are issues with cross compiling that require CC to be provided even when building. It should only have to be provided as part of the configuration step.

build fails on el5

The includes/ifdef's still are not correct for builds on centos 5 (el5). For context, I was building a 32bit version on a 64bit host (my firewall runs in a 32bit openvz container on a 64bit host).

I ended up hacking a couple of the source files to make it work. My silly build helper tool below:

[jdefelice@proxmox0 smcroute-1.99.0-working]$ cat xsconf.smcroute

!/bin/bash

case "$1" in
c)
env CFLAGS='-m32' CPPFLAGS='-m32' linux32 ./configure
;;
m)
env CFLAGS='-m32' CPPFLAGS='-m32' linux32 make
;;
mi)
mkdir /smcroute-root
env CFLAGS='-m32' CPPFLAGS='-m32' linux32 make DESTDIR=
/smcroute-root install
;;
d)
rm -rf ~/smcroute-root
env CFLAGS='-m32' CPPFLAGS='-m32' linux32 make clean
env CFLAGS='-m32' CPPFLAGS='-m32' linux32 make distclean
;;
*)
echo "usage: $0 [c|m|mi|d]"
;;
esac

Trying to figure out how to attach a .patch file to this bug report...

Loop forever bug when deleting new (*,G) sourcless routes

Reported by Jean-Baptiste Maillet on June 26th, 2013

I'm using the INADDR_ANY experimental feature of smcroute.
I came accross a bug - or maybe I do something plain stupid,
but anyway smcroute should be robust to brain-damaged users.

Problem:
In some circumstances, removing a INADDR_ANY route can lead to an
infinite loop in the daemon, with client blocked.

Steps to reproduce: (100% reproduceable here)
Checked both on smcroute-1.99.00 and on master SHA: 0b6306b.

smcroute-1.99.00/src/mroute-api. is leaky, I even segfaulted it using similar steps as bellow, so I'd rather work on smcroute-1.99.00, but with a src/mroute-api.c at SHA: 0b6306b, including your fix "mroute-api: Fix possible memory leak due to missing LIST_FOREACH_SAFE() on Linux."

...and on line 366 an additional trace:

entry = LIST_FIRST(&mroute4_conf_list); smclog(LOG_DEBUG, 0, "%s:%d:%s:looping over entry at 0x%x", __FILE__, __LINE__, __func__, entry);

Launch smcroute daemon on foreground, no config file. Then on client side - note that the last command block, has to be interrupted: (then I killed the now CPU-hogging smcroute daemon):

# /home/jbmaillet/sandbox/smcroute-1.99.00/src/smcroute -a eth2 0.0.0.0 239.255.255.250 eth1
# /home/jbmaillet/sandbox/smcroute-1.99.00/src/smcroute -a eth1 0.0.0.0 239.255.255.250 eth2
# /home/jbmaillet/sandbox/smcroute-1.99.00/src/smcroute -r eth2 0.0.0.0 239.255.255.250
^C
root@sumo:/tmp/funk# killall -9 smcroute

Complete traces of a foreground running daemon:

# /home/jbmaillet/sandbox/smcroute-1.99.00/src/smcroute  -d -n -v -D
smcroute, Version 1.99.0, Build 130626 Copyright (c) 2001-2005  Carsten Schill <[email protected]>
Copyright (c) 2006-2009  Julien Blache <[email protected]>,
                   2009  Todd Hayton <[email protected]>, and
              2009-2011  Micha Lenk <[email protected]>
                   2011  Joachim Nilsson <[email protected]>
Distributed under the GNU GENERAL PUBLIC LICENSE, Version 2

Note: Add VIF: 0 Ifindex: 2 Flags: 0x0000 IP: 172.20.223.48 Ifname: eth1
Note: Add VIF: 1 Ifindex: 13 Flags: 0x0000 IP: 192.168.20.20 Ifname: eth2
Note: Add MIF: 0 Ifindex: 2 Flags: 0x0000 Ifname: eth1
Note: Add MIF: 1 Ifindex: 13 Flags: 0x0000 Ifname: eth2
Note: Starting daemon in foreground.
Note: Entering smcroute daemon main loop.
Note: Attempting to load /etc/smcroute.conf
Warn: Failed loading /etc/smcroute.conf. Error 2: No such file or directory
Note: Add MFC: 192.168.1.1 -> 239.255.255.250, inbound VIF: 0
Note: Add MFC: 172.20.220.31 -> 239.255.255.250, inbound VIF: 0
Killed

BTW, it does not matter if a route have been added or not: using 239.255.255.253, used by our CUPS printers for SRVLOC, with much less traffic sans SSDP and no route added yield the same results.

Logs:

$ tail -f /var/log/daemon.log
Jun 26 11:09:02 sumo smcroute[12444]: Note: Starting daemon in foreground.
Jun 26 11:09:02 sumo smcroute[12444]: Note: Entering smcroute daemon main loop.
Jun 26 11:09:02 sumo smcroute[12444]: Note: Attempting to load /etc/smcroute.conf
Jun 26 11:09:02 sumo smcroute[12444]: Warn: Failed loading /etc/smcroute.conf. Error 2: No such file or directory
Jun 26 11:09:03 sumo smcroute[12444]: Debu: Cache miss for group 239.255.255.250 from 172.20.220.124 on interface eth1(0) ifindex:2
Jun 26 11:09:03 sumo smcroute[12444]: Debu: No (*,G) match for (0x7cdc14ac, 0xfaffffef)!
Jun 26 11:09:03 sumo smcroute[12444]: Debu: Cache miss for group 239.255.0.1 from 192.168.0.1 on interface eth1(0) ifindex:2
Jun 26 11:09:03 sumo smcroute[12444]: Debu: No (*,G) match for (0x100a8c0, 0x100ffef)!
Jun 26 11:09:06 sumo smcroute[12444]: Debu: Cache miss for group 239.255.255.250 from 172.20.220.40 on interface eth1(0) ifindex:2
Jun 26 11:09:06 sumo smcroute[12444]: Debu: No (*,G) match for (0x28dc14ac, 0xfaffffef)!
Jun 26 11:09:13 sumo smcroute[12444]: Debu: Cache miss for group 239.255.255.250 from 172.20.220.38 on interface eth1(0) ifindex:2
Jun 26 11:09:13 sumo smcroute[12444]: Debu: No (*,G) match for (0x26dc14ac, 0xfaffffef)!
Jun 26 11:09:13 sumo smcroute[12444]: Debu: Cache miss for group 239.255.0.1 from 192.168.0.1 on interface eth1(0) ifindex:2
Jun 26 11:09:13 sumo smcroute[12444]: Debu: No (*,G) match for (0x100a8c0, 0x100ffef)!
Jun 26 11:09:13 sumo smcroute[12444]: Debu: Cache miss for group 239.255.255.253 from 172.20.220.198 on interface eth1(0) ifindex:2
Jun 26 11:09:13 sumo smcroute[12444]: Debu: No (*,G) match for (0xc6dc14ac, 0xfdffffef)!
Jun 26 11:09:14 sumo smcroute[12444]: Debu: Cache miss for group 239.255.255.250 from 172.20.220.85 on interface eth1(0) ifindex:2
Jun 26 11:09:14 sumo smcroute[12444]: Debu: No (*,G) match for (0x55dc14ac, 0xfaffffef)!
Jun 26 11:09:18 sumo smcroute[12444]: Debu: Cache miss for group 239.255.255.250 from 172.20.220.40 on interface eth1(0) ifindex:2
Jun 26 11:09:18 sumo smcroute[12444]: Debu: No (*,G) match for (0x28dc14ac, 0xfaffffef)!
Jun 26 11:09:20 sumo smcroute[12444]: Debu: Cache miss for group 239.255.255.250 from 172.20.220.137 on interface eth1(0) ifindex:2
Jun 26 11:09:20 sumo smcroute[12444]: Debu: No (*,G) match for (0x89dc14ac, 0xfaffffef)!
Jun 26 11:09:22 sumo smcroute[12444]: Debu: ipc_server_read: waiting for connection...
Jun 26 11:09:22 sumo smcroute[12444]: Debu: ipc_server_read: connection accepted
Jun 26 11:09:22 sumo smcroute[12444]: Debu: ipc_server_read: command read(7, 0xffc81f90, 1024) => 43 should be at least 8
Jun 26 11:09:22 sumo smcroute[12444]: Debu: Adding (*,G) mroute to dynamic list => (0x0, 0xfaffffef) vif:1
Jun 26 11:09:23 sumo smcroute[12444]: Debu: Cache miss for group 239.255.0.1 from 192.168.0.1 on interface eth1(0) ifindex:2
Jun 26 11:09:23 sumo smcroute[12444]: Debu: No (*,G) match for (0x100a8c0, 0x100ffef)!
Jun 26 11:09:28 sumo smcroute[12444]: Debu: ipc_server_read: command read(7, 0xffc81f90, 1024) => 0 should be at least 8
Jun 26 11:09:28 sumo smcroute[12444]: Debu: ipc_server_read: connection lost
Jun 26 11:09:28 sumo smcroute[12444]: Debu: ipc_server_read: waiting for connection...
Jun 26 11:09:28 sumo smcroute[12444]: Debu: ipc_server_read: connection accepted
Jun 26 11:09:28 sumo smcroute[12444]: Debu: ipc_server_read: command read(7, 0xffc81f90, 1024) => 43 should be at least 8
Jun 26 11:09:28 sumo smcroute[12444]: Debu: Adding (*,G) mroute to dynamic list => (0x0, 0xfaffffef) vif:0
Jun 26 11:09:29 sumo smcroute[12444]: Debu: Cache miss for group 239.255.255.250 from 192.168.1.1 on interface eth1(0) ifindex:2
Jun 26 11:09:29 sumo smcroute[12444]: Debu: Found (*,G) match for (0x101a8c0, 0xfaffffef)!
Jun 26 11:09:29 sumo smcroute[12444]: Note: Add MFC: 192.168.1.1 -> 239.255.255.250, inbound VIF: 0
Jun 26 11:09:31 sumo smcroute[12444]: Debu: Cache miss for group 239.255.255.250 from 172.20.220.31 on interface eth1(0) ifindex:2
Jun 26 11:09:31 sumo smcroute[12444]: Debu: Found (*,G) match for (0x1fdc14ac, 0xfaffffef)!
Jun 26 11:09:31 sumo smcroute[12444]: Note: Add MFC: 172.20.220.31 -> 239.255.255.250, inbound VIF: 0
Jun 26 11:09:33 sumo smcroute[12444]: Debu: ipc_server_read: command read(7, 0xffc81f90, 1024) => 0 should be at least 8
Jun 26 11:09:33 sumo smcroute[12444]: Debu: ipc_server_read: connection lost
Jun 26 11:09:33 sumo smcroute[12444]: Debu: ipc_server_read: waiting for connection...
Jun 26 11:09:33 sumo smcroute[12444]: Debu: ipc_server_read: connection accepted
Jun 26 11:09:33 sumo smcroute[12444]: Debu: ipc_server_read: command read(7, 0xffc81f90, 1024) => 38 should be at least 8
Jun 26 11:09:33 sumo smcroute[12444]: Debu: mroute-api.c:366:mroute4_del:looping over entry at 0x82a1218
Jun 26 11:09:33 sumo smcroute[12444]: Debu: mroute-api.c:366:mroute4_del:looping over entry at 0x82a1218
Jun 26 11:09:33 sumo smcroute[12444]: Debu: mroute-api.c:366:mroute4_del:looping over entry at 0x82a1218
Jun 26 11:09:33 sumo smcroute[12444]: Debu: mroute-api.c:366:mroute4_del:looping over entry at 0x82a1218
Jun 26 11:09:33 sumo smcroute[12444]: Debu: mroute-api.c:366:mroute4_del:looping over entry at 0x82a1218

etc etc etc loop forever ...

Analysis:

In mroute4_del() we take the first entry of mroute4_conf_list with LIST_FIRST(), but if we find no match for it -- thus not removing it, then we take it again by LIST_FIRST(), looping endlessly. From the code it may happen looping over mroute4_conf_list as well as inner mroute4_dyn_list.

Another (non-fatal) problem I see in this function in case of INADDR_ANY is the systematic call to __mroute4_del() at the end, whereas this as be done if needed in the loop over mroute4_dyn_list. This result in a "Daemon error: Warn: MRT_DEL_MFC. Error 2: No such file or directory" at route removal.

Proposed Solution:

The attached patch against master fixes these issues for me (also tested on 1.99.00).

From a8e59609cd7771c17ad7b34a0e95a1374d1ff25a Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Maillet <[email protected]>
Date: Wed, 26 Jun 2013 13:57:19 +0200
Subject: [PATCH] Bugfix: IPv4 route removal with INADDR_ANY.

Avoid looping forever if no match.
Avoid useless general case (not INADDR_ANY) route removal at the end.

---
 src/mroute-api.c |   26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/src/mroute-api.c b/src/mroute-api.c
index adf2b45..468a6d2 100644
--- a/src/mroute-api.c
+++ b/src/mroute-api.c
@@ -362,32 +362,40 @@ int mroute4_del(mroute4_t *ptr)
    if (ptr->sender.s_addr == INADDR_ANY) {
        mroute4_t *entry;

-       while (!LIST_EMPTY(&mroute4_conf_list)) {
-           entry = LIST_FIRST(&mroute4_conf_list);
+       if (LIST_EMPTY(&mroute4_conf_list))
+           return 0;

+       entry = LIST_FIRST(&mroute4_conf_list);
+       while (entry) {
+           smclog(LOG_DEBUG, 0, "%s:%d:%s:looping over entry at 0x%x", __FILE__, __LINE__, __func__, entry);
            /* Find matching (*,G) ... and interface. */
            if (!memcmp (&entry->group, &ptr->group, sizeof(entry->group)) && entry->inbound == ptr->inbound) {
                mroute4_t *set;

                smclog(LOG_DEBUG, 0, "Found (*,G) match for (0x%x, 0x%x) - now find any set routes!", ptr->sender.s_addr, ptr->group.s_addr);
-               while (!LIST_EMPTY(&mroute4_dyn_list)) {
-                   set = LIST_FIRST(&mroute4_dyn_list);
+               if (LIST_EMPTY(&mroute4_dyn_list)) {
+                   entry = LIST_NEXT(entry, link);
+                   continue;
+               }

+               set = LIST_FIRST(&mroute4_dyn_list);
+               while (set) {
                    if (!memcmp (&entry->group, &set->group, sizeof(entry->group)) && entry->inbound == set->inbound) {
                        smclog(LOG_DEBUG, 0, "Found match (0x%x, 0x%x) - removing, unlinking and freeing.", set->sender.s_addr, set->group.s_addr);
                        __mroute4_del(set);
                        LIST_REMOVE(set, link);
                        free(set);
-                   }
+                       set = LIST_FIRST(&mroute4_dyn_list);
+                   } else set = LIST_NEXT(set, link);
                }

                LIST_REMOVE(entry, link);
                free(entry);
-           }
+               entry = LIST_FIRST(&mroute4_conf_list);
+           } else entry = LIST_NEXT(entry, link);
        }
-   }
-
-   return __mroute4_del(ptr);
+   } else
+       return __mroute4_del(ptr);
 }

Routing problems with Wake On LAN on OpenWRT

mgroup from wlan0 group 224.0.2.1
mroute from wlan0 group 224.0.2.1 to br-lan
iptables -t mangle -A OUTPUT -d 224.0.2.1 -j TTL --ttl-set 64

I can detect Wake-On-Lan UDP multicast packets to 224.0.2.1 on wlan0 with wireshark.
But, it is not detected on br-lan.

openwrt 15.05.1

Log complains of missing /etc/smcroute.conf while not a required file

When starting the daemon smcroute -d without a configuration file, smcroute complains in the log:

smcroute[26003]: Failed loading /etc/smcroute.conf. Error 2: No such file or directory

The configuration file is not a required file, it is perfectly OK to just send commands to the daemon
using the client.

Failed call to select() in server_loop() error when activating cache life time feature

After the first flush, I get continuous warn in the log file.
I added a debug print just before calling select. the problem is with the timeout parameter.
smclog(LOG_WARNING, "Calling select() with max_fd_num = %u, tmo: sec %u usec %u", max_fd_num+1, tmo->tv_sec, tmo->tv_usec);

Calling select() with max_fd_num = 6, tmo: sec 10 usec 0
Cache timeout, flushing all (*,G) routes!
Calling select() with max_fd_num = 6, tmo: sec 10 usec 0
Calling select() with max_fd_num = 6, tmo: sec 8 usec 0
Calling select() with max_fd_num = 6, tmo: sec 7 usec 0
Calling select() with max_fd_num = 6, tmo: sec 6 usec 0
Calling select() with max_fd_num = 6, tmo: sec 6 usec 0
Calling select() with max_fd_num = 6, tmo: sec 6 usec 0
Calling select() with max_fd_num = 6, tmo: sec 0 usec 0
Calling select() with max_fd_num = 6, tmo: sec 0 usec 0
Calling select() with max_fd_num = 6, tmo: sec 0 usec 0
Calling select() with max_fd_num = 6, tmo: sec 0 usec 0
Calling select() with max_fd_num = 6, tmo: sec 0 usec 0
Calling select() with max_fd_num = 6, tmo: sec 0 usec 0
Calling select() with max_fd_num = 6, tmo: sec 0 usec 0
...
Calling select() with max_fd_num = 6, tmo: sec 4294967295 usec 0
Failed call to select() in server_loop(): Invalid argument
Calling select() with max_fd_num = 6, tmo: sec 4294967295 usec 0
Failed call to select() in server_loop(): Invalid argument
Calling select() with max_fd_num = 6, tmo: sec 4294967295 usec 0
Failed call to select() in server_loop(): Invalid argument
Calling select() with max_fd_num = 6, tmo: sec 4294967295 usec 0
Failed call to select() in server_loop(): Invalid argument
Calling select() with max_fd_num = 6, tmo: sec 4294967295 usec 0
Failed call to select() in server_loop(): Invalid argument
Calling select() with max_fd_num = 6, tmo: sec 4294967295 usec 0
Failed call to select() in server_loop(): Invalid argument
Calling select() with max_fd_num = 6, tmo: sec 4294967295 usec 0

"smcroute -k" seems to loop for ever if smcroute daemon isn't running

Hi,

if you run "smcroute -k" while the daemon isn't running, the command doesn't return at all.

Looking at the strace output smcroute seems to loop forever in this case with following syscalls:

sendto(3, "<12>Oct 26 19:47:47 smcroute[482"..., 90, MSG_NOSIGNAL, NULL, 0) = 90
socket(PF_LOCAL, SOCK_STREAM, 0)        = 4
connect(4, {sa_family=AF_LOCAL, sun_path="/var/run/smcroute"}, 19) = -1 ENOENT (No such file or directory)
close(4)                                = 0

Best regards,
Micha

Add support for action or script exec when installing sourceless routes

I recently tried to set up a sourceless (*,G) multicast route in SMCRoute on a system
that also did 1-to-1 NAT of the source address. This didn't work since conntrack locked
on to the un-natted source IP when SMCRoute installed the source specific (S,G) route
in the kernel upon receiving the first frame from a sender.

     .-------.  ETB  .-------.    ETB    .-------.  ETB  .-------.
     |       |=======|       |===========|       |=======|       |
     |  TR1  |       |  TR2  |           |  TR3  |       |  TR4  |
     |       |-------|       |           |       |-------|       |
     `-------'  ECN  `-------'           `-------'  ECN  `-------'
         |               |                   |               |
     ECN |  10.0.0.0/24  | ECN           ECN |  10.0.0.0/24  | ECN
         |               |                   |               |
     .-------.  ECN  .-------.           .-------.  ECN  .-------.
     |       |-------|       |           |       |-------|       |
     |  RS1  |       |  RS2  |           |  RS3  |       |  RS4  |
     |       |       |       |           |       |       |       |
     `-------'       `-------'           `-------'       `-------'
              Car #1                              Car #2

There are of course ways around this using iptables, but in the spirit of keeping things
simple, the following approach may be the best.

If we add an action conntrack-flush and/or support for calling an external script when
installing the source specific route this problem can be avoided. It could look something
like this:

mroute from eth0 group 225.3.2.1 to eth1 eth2 [exec /path/to/script | conntrack-flush]

Not working for Android

Compiled the mscroute for Android. When pushed the binary to a phone under /system/bin with chmod 755 to the binary, it does nothing, but only shows the help.

For example, when start the daemon using "smcroute -d", no error is shown. But when check running process via "ps |grep smcroute", no daemon is running.

Do I need to push some libraries to the phone to make the function working?

mroute-api.c: mroute4_del() function does not delete empty wildcard entries

mroute4_del() function does not remove empty wildcard entries from mroute4_conf_list and this causes the smcroute logic to continue routing the wildcard entry after the deletion (route matches for new packets). I believe this is not intentional.

if (LIST_EMPTY(&mroute4_dyn_list)) {
    entry = LIST_NEXT(entry, link);
    continue;
}

Should be something along the lines of:

if (LIST_EMPTY(&mroute4_dyn_list)) {
    LIST_REMOVE(entry, link);
    free(entry);
    entry = LIST_FIRST(&mroute4_conf_list);
    continue;
}

https://github.com/troglobit/smcroute/blob/master/mroute-api.c#L403

Add support for IPv6 wildcard routes

I think there is no support for IPv6 wildcard entries yet.
I tried the following. It occurred no error but it did not work.
smcroute -a eth0 :: ff08::7777 eth1 eth2

Please add support for it like it is possible with IPv4:
smcroute -a eth0 0.0.0.0 225.1.2.3 eth1 eth2

Bi directional static routes

I'm not sure that this is a bug, or routing protocol limitation.
But I would like to be able to define bi-directional static multicast routing.
Currently it doesn't work, it works only for one direction.

Here's the config I used:

VA0 --> ETH0

mgroup from va0 group 239.10.10.80
mroute from va0 group 239.10.10.80 to eth0

ETH0 --> VA0

mgroup from eth0 group 239.10.10.80
mroute from eth0 group 239.10.10.80 to va0

Maybe remove smcroute.init from distribution and GIT?

Since most major distributions already have, or are switching to systemd maybe we can drop the smcroute.init file from the tree?

Personally I rarely run the SMCRoute my distribution (Ubuntu or Debian) carries, but both run systemd. Most often I run SMCRoute in TroglOS, for testing, or in our embedded Linux distribution at work¹. In both the latter two cases we use Finit instead of SysV init.

I have no means or interest to maintain this init script and sometime I get support requests via email.

Can we remove it?

¹) http://www.westermo.com

Crash in inet_pton4 on startup

Backtrace:

[root@linus smcroute]# gdb /usr/local/sbin/smcrouted
GNU gdb (GDB) Fedora 7.12.1-47.fc25
Copyright (C) 2017 Free Software Foundation, Inc.
...
Reading symbols from /usr/local/sbin/smcrouted...done.
(gdb) run -n -s
Starting program: /usr/local/sbin/smcrouted -n -s

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7933cc4 in inet_pton4 (dst=0x7fffffffe100 "\020\342\377\377\377\177", src=0x1 <error: Cannot access memory at address 0x1>) at inet_pton.c:86
86              while ((ch = *src++) != '\0') {
Missing separate debuginfos, use: dnf debuginfo-install libcap-2.25-2.fc25.x86_64
(gdb) bt
#0  0x00007ffff7933cc4 in inet_pton4 (dst=0x7fffffffe100 "\020\342\377\377\377\177", src=0x1 <error: Cannot access memory at address 0x1>) at inet_pton.c:86
#1  __GI___inet_pton (af=af@entry=2, src=src@entry=0x0, dst=dst@entry=0x7fffffffe100) at inet_pton.c:52
#2  0x0000000000405047 in join_mgroup (group=0x60aa87 "239.255.255.250", source=0x0, ifname=0x60aa7c "eno1", lineno=31) at parse-conf.c:151
#3  parse_conf_file (file=file@entry=0x406038 "/etc/smcroute.conf") at parse-conf.c:379
#4  0x0000000000402d08 in read_conf_file (conf_file=0x406038 "/etc/smcroute.conf") at smcrouted.c:79
#5  0x00000000004020b3 in start_server () at smcrouted.c:551
#6  main (argc=<optimized out>, argv=<optimized out>) at smcrouted.c:710

/etc/smcroute.conf:

mgroup from eno1 group 239.255.255.250
mroute from eno1 group 239.255.255.250 to p5p1

mgroup from p5p1 group 239.255.255.250
mroute from p5p1 group 239.255.255.250 to eno1

uname -a:

Linux linus 4.10.10-200.fc25.x86_64 #1 SMP Thu Apr 13 01:11:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Interface eno1 (some characters replaced with xxxx):

2: eno1: <BROADCAST,MULTICAST,ALLMULTI,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether e0:xx:xx:2e:9c:4f brd ff:ff:ff:ff:ff:ff
    inet 192.168.102.1/24 brd 192.168.102.254 scope global eno1
       valid_lft forever preferred_lft forever
    inet6 fdcf:xxxx:a677:b802::1/64 scope global
       valid_lft forever preferred_lft forever
    inet6 2605:xxxx:ecc9:b802::1/64 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::xxxx:95ff:fe2e:9c4f/64 scope link
       valid_lft forever preferred_lft forever

Proposal: remove mcsender from distribution and GIT

The mcsender application distributed with SMCRoute is a simple UDP multicast generator that is only barely more interesting than using the standard ping (Debian iputils-ping). Barely, because ICMP can be blocked on the path between sender and receiver, which is the only real downside of using ping over mcsender.

The mcsender application has fallen behind in maintenance and should be both cleaned up and aligned with the overall coding style in SMCRoute if we want to continue maintaining it. However, I'd much rather see it be dropped for an actual multicast testing application (sender and receiver). Here iperf and omping stand out as clear cut alternatives we should recommend instead.

Add support for TTL threshold on outbound interfaces

With the introduction of a phyint configuration level setting in issue #28 it would also be useful to be able to control the TTL threshold for outbound interfaces. I.e., multicast with a TTL less than the threshold would not be allowed to egress that interface - useful for scoping multicast.

Syntax:

phyint <IFNAME> <enable | disable> [ttl-threshold <1-255>]

Default:

ttl-threshold 1

Example:

phyint eth1 enable ttl-threshold 5

Here only multicast data with a TTL > 5 would be allowed to egress eth1.

Multipath multicast routing

Hi,
I've set up the following network where Node1 and Node6 are transmitting and
receiving multicast traffic to group 224.1.1.1 on port 25252. The intermediate
nodes are only forwarding multicast traffic. All nodes have ip forwarding and
multicast support turned on. Reverse path filtering is also turned off as we
use multiple paths to the destinations.

                                 Node3
                              +---------+
                              |         |
                           +--+eth0 eth1+--+
                           |  |         |  |
   Node1          Node2    |  +---------+  |    Node5          Node6
+---------+    +---------+ |               | +---------+    +---------+
|         |    |     eth1+-+               +-+eth0     |    |         |
|     eth0+----+eth0     |                   |     eth2+----+eth0     |
|         |    |     eth2+-+               +-+eth1     |    |         |
+---------+    +---------+ |     Node4     | +---------+    +---------+
                           |  +---------+  |
                           |  |         |  |
                           +--+eth0 eth1+--+
                              |         |
                              +---------+
+-------+-----------+------------+---------+----------+
| Node  | Interface | IP address | Netmask | Gateway  |
+-------+-----------+------------+---------+----------+
| Node1 | eth0      | 10.0.1.1   | 24      | 10.0.1.2 |
+-------+-----------+------------+---------+----------+
| Node2 | eth0      | 10.0.1.2   | 24      | 10.0.1.1 |
+-------+-----------+------------+---------+----------+
|       | eth1      | 10.0.2.2   | 24      | 10.0.2.3 |
+-------+-----------+------------+---------+----------+
|       | eth2      | 10.0.3.2   | 24      | 10.0.3.4 |
+-------+-----------+------------+---------+----------+
| Node3 | eth0      | 10.0.2.3   | 24      | 10.0.2.2 |
+-------+-----------+------------+---------+----------+
|       | eth1      | 10.0.4.3   | 24      | 10.0.4.5 |
+-------+-----------+------------+---------+----------+
| Node4 | eth0      | 10.0.3.4   | 24      | 10.0.3.2 |
+-------+-----------+------------+---------+----------+
|       | eth1      | 10.0.5.4   | 24      | 10.0.5.5 |
+-------+-----------+------------+---------+----------+
| Node5 | eth0      | 10.0.4.5   | 24      | 10.0.4.3 |
+-------+-----------+------------+---------+----------+
|       | eth1      | 10.0.5.5   | 24      | 10.0.5.4 |
+-------+-----------+------------+---------+----------+
|       | eth2      | 10.0.6.5   | 24      | 10.0.6.6 |
+-------+-----------+------------+---------+----------+
| Node6 | eth0      | 10.0.6.6   | 24      | 10.0.6.5 |
+-------+-----------+------------+---------+----------+

The smcroute rules are set up as follows (per node).
Node2:

smcroute -a eth0 0.0.0.0 224.1.1.1 eth1 eth2
smcroute -a eth1 0.0.0.0 224.1.1.1 eth0
smcroute -a eth2 0.0.0.0 224.1.1.1 eth0

Node3:

smcroute -a eth0 0.0.0.0 224.1.1.1 eth1
smcroute -a eth1 0.0.0.0 224.1.1.1 eth0

Node4:

smcroute -a eth0 0.0.0.0 224.1.1.1 eth1
smcroute -a eth1 0.0.0.0 224.1.1.1 eth0

Node5:

smcroute -a eth0 0.0.0.0 224.1.1.1 eth2
smcroute -a eth1 0.0.0.0 224.1.1.1 eth2
smcroute -a eth2 0.0.0.0 224.1.1.1 eth0 eth1

Upon setting these rules I can clearly see traffic going from Node1 to Node6
and vice versa. Looking closer at the multicast routing cache for Node2 and
Node5 (which are the nodes responsible for path selection in each respective
direction) we can see that only one of the paths have been added:

Node2:

root@Node2:~# smcroute -a eth0 0.0.0.0 224.1.1.1 eth1 eth2
root@Node2:~# smcroute -a eth1 0.0.0.0 224.1.1.1 eth0
root@Node2:~# smcroute -a eth2 0.0.0.0 224.1.1.1 eth0
root@Node2:~# ip mroute
(10.0.6.6, 224.1.1.1)            Iif: eth2       Oifs: eth0 
(10.0.1.1, 224.1.1.1)            Iif: eth0       Oifs: eth1 eth2 
root@Node2:~# 

Node5:

root@Node5:~# smcroute -a eth0 0.0.0.0 224.1.1.1 eth2
root@Node5:~# smcroute -a eth1 0.0.0.0 224.1.1.1 eth2
root@Node5:~# smcroute -a eth2 0.0.0.0 224.1.1.1 eth0 eth1
root@Node5:~# ip mroute
(10.0.1.1, 224.1.1.1)            Iif: eth1       Oifs: eth2 
(10.0.6.6, 224.1.1.1)            Iif: eth2       Oifs: eth0 eth1 
root@Node5:~# 

This occurs even though reception of multicast traffic occurs on both
interfaces.

Node2:

root@Node2:~# tcpdump -i eth1 -vvv                 
tcpdump: listening on eth1, link-type EN10MB (Ethernet), capture size 262144 bytes
09:08:40.969403 IP (tos 0x0, ttl 8, id 11203, offset 0, flags [DF], proto UDP (17), length 32)
    10.0.6.6.42032 > 224.1.1.1.25252: [udp sum ok] UDP, length 4
09:08:43.927778 IP (tos 0x0, ttl 9, id 20464, offset 0, flags [DF], proto UDP (17), length 32)
    10.0.1.1.36171 > 224.1.1.1.25252: [udp sum ok] UDP, length 4

root@Node2:~# tcpdump -i eth2 -vvv
tcpdump: listening on eth2, link-type EN10MB (Ethernet), capture size 262144 bytes
09:09:18.949115 IP (tos 0x0, ttl 9, id 32333, offset 0, flags [DF], proto UDP (17), length 32)
    10.0.1.1.36171 > 224.1.1.1.25252: [udp sum ok] UDP, length 4
09:09:20.983309 IP (tos 0x0, ttl 8, id 29307, offset 0, flags [DF], proto UDP (17), length 32)
    10.0.6.6.42032 > 224.1.1.1.25252: [udp sum ok] UDP, length 4

Node5:

root@Node5:~# tcpdump -i eth0 -vvv
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
09:09:54.154853 IP (tos 0x0, ttl 9, id 53322, offset 0, flags [DF], proto UDP (17), length 32)
    10.0.6.6.42032 > 224.1.1.1.25252: [udp sum ok] UDP, length 4
09:09:57.128041 IP (tos 0x0, ttl 8, id 54402, offset 0, flags [DF], proto UDP (17), length 32)
    10.0.1.1.36171 > 224.1.1.1.25252: [udp sum ok] UDP, length 4

root@Node5:~# tcpdump -i eth1 -vvv
tcpdump: listening on eth1, link-type EN10MB (Ethernet), capture size 262144 bytes
09:11:57.207701 IP (tos 0x0, ttl 8, id 43515, offset 0, flags [DF], proto UDP (17), length 32)
    10.0.1.1.36171 > 224.1.1.1.25252: [udp sum ok] UDP, length 4
09:11:59.230905 IP (tos 0x0, ttl 9, id 50499, offset 0, flags [DF], proto UDP (17), length 32)
    10.0.6.6.42032 > 224.1.1.1.25252: [udp sum ok] UDP, length 4

As we can see from the multicast routing cache the path selected for
transmitting the information between Node1 and Node6 is through Node4.
If we were to disable one of the interfaces on Node4, the expected behavior
would be a new path selection (through Node3). However, this does not happen
even though the multicast traffic is still received in both Node2 and Node5.

My theory for what's causing this behavior is related to how smcroute handles
multipath routes. Typically on receiving multicast traffic, the kernel will
signal the userspace daemon by means of a IGMPMSG_NOCACHE message indicating
that no route exist in the cache for the given multicast packet. In this case
however, the route exists but not from the given interface, thus causing the
kernel to transmit an IGMPMSG_WRONGVIF message instead.

Regards,
Dan

Problem building and running SMCRoute on FreeBSD

smcroute did not compile on FreeBSD 10.0. I have not yet investigated it, due to a deadline at work in 2 weeks. I'll have a look later. This report is just to track this for myself.

I suspect it has to do with changes in FreeBSD with the compiler, but that is just a hunch.

[root@wolfje] ~/smcroute-1.99.2# ./configure
checking for gcc... no
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for ANSI C header files... (cached) yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking syslog.h usability... yes
checking syslog.h presence... yes
checking for syslog.h... yes
checking for unistd.h... (cached) yes
checking net/route.h usability... no
checking net/route.h presence... yes
configure: WARNING: net/route.h: present but cannot be compiled
configure: WARNING: net/route.h:     check for missing prerequisite headers?
configure: WARNING: net/route.h: see the Autoconf documentation
configure: WARNING: net/route.h:     section "Present But Cannot Be Compiled"
configure: WARNING: net/route.h: proceeding with the compiler's result
configure: WARNING:     ## ---------------------------------- ##
configure: WARNING:     ## Report this to [email protected] ##
configure: WARNING:     ## ---------------------------------- ##
checking for net/route.h... no
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking ifaddrs.h usability... yes
checking ifaddrs.h presence... yes
checking for ifaddrs.h... yes
checking for linux/mroute.h... no
checking for linux/mroute6.h... no
checking linux/sockios.h usability... no
checking linux/sockios.h presence... no
checking for linux/sockios.h... no
checking for netinet/ip_mroute.h... no
checking for netinet6/ip6_mroute.h... yes
checking for IPv6 multicast host support... yes
checking for IPv6 multicast routing support... yes
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking for uint32_t... yes
checking for sun_len member in struct sockaddr_un... yes
checking for vifc_threshold member in struct mif6ctl... no
checking for vifc_rate_limit member in struct mif6ctl... no
checking for pid_t... yes
checking vfork.h usability... no
checking vfork.h presence... no
checking for vfork.h... no
checking for fork... yes
checking for vfork... yes
checking for working fork... yes
checking for working vfork... (cached) yes
checking whether cc needs -traditional... no
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking for sys/socket.h... (cached) yes
checking types of arguments for select... int,fd_set *,struct timeval *
checking whether setpgrp takes no argument... no
checking for atexit... yes
checking for dup2... yes
checking for memset... yes
checking for select... yes
checking for socket... yes
checking for strchr... yes
checking for strerror... yes
checking for strrchr... yes
checking for asprintf... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating doc/Makefile
config.status: creating src/config.h
config.status: src/config.h is unchanged

[root@wolfje] ~/smcroute-1.99.2# head -30 /usr/include/net/route.h
/*-
 * Copyright (c) 1980, 1986, 1993
 *  The Regents of the University of California.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 4. Neither the name of the University nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 *  @(#)route.h 8.4 (Berkeley) 1/9/95
 * $FreeBSD: release/10.0.0/sys/net/route.h 252184 2013-06-25 00:10:49Z qingli $
[root@wolfje] ~/smcroute-1.99.2# make
[root@wolfje] ~/smcroute-1.99.2# cd src
[root@wolfje] ~/smcroute-1.99.2/src# make
make: "/usr/home/freek/smcroute-1.99.2/src/Makefile" line 59: Missing dependency operator
make: "/usr/home/freek/smcroute-1.99.2/src/Makefile" line 60: Missing dependency operator
make: "/usr/home/freek/smcroute-1.99.2/src/Makefile" line 62: Need an operator
make: "/usr/home/freek/smcroute-1.99.2/src/Makefile" line 63: Need an operator
make: Fatal errors encountered -- cannot continue
make: stopped in /usr/home/freek/smcroute-1.99.2/src

No buffer space error

Hello,

When I try to add more than 20 streams, I get this error:
smcroute[41855]: ADD MEMBERSHIP failed. Error 105: No buffer space available

Is that a limit with the daemon that is written in manual, or do I need to tune some protocol parameters?
Any help or suggestion is greatly appreciated.

Thanks

Add support for GROUP/LEN to (*,G) implementation

The current (*,G) implementation is very useful, what would make it even more useful is approaching (*,*) support by adding support for the following type of .conf file rules:

mroute from eth0 group 239.15.0.0/16 to eth1 eth2
                       ~~~~~~~~~~~~~

Please consider adding an init script

Hi,

currently I am using the following init script in the Debian package. It might be useful to other distributions as well, so feel free to include it in the smcroute source.

#! /bin/sh
#
### BEGIN INIT INFO
# Provides:          smcroute
# Required-Start:    $syslog $local_fs $network $remote_fs
# Required-Stop:     $syslog $local_fs $network $remote_fs
# Should-Start:      
# Should-Stop:       
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Static multicast router daemon
# Description:       SMCRoute is a tool to manipulate the multicast routes
#                    of the Linux kernel. It can be used as an alternative
#                    to dynamic multicast routers like mrouted in situation
#                    where static multicast routes should be maintained
#                    and/or no proper IGMP signaling exists.
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/smcroute
DAEMON_OPTS=-d
NAME=smcroute
DESC="static multicast router daemon"

test -x $DAEMON || exit 0

# Include smcroute defaults if available
if [ -f /etc/default/smcroute ] ; then
    . /etc/default/smcroute
fi

. /lib/lsb/init-functions

start() {
    local error
    local result
    log_begin_msg "Starting $DESC: $NAME"
    error=$(start-stop-daemon --start --quiet \
        --exec $DAEMON -- $DAEMON_OPTS 2>&1)
    result=$?
    if [ "$result" = "0" -a -x /etc/smcroute/startup.sh ]; then
        /etc/smcroute/startup.sh
    else
        log_progress_msg ${error#ERRO: }
    fi
    log_end_msg $result
}

stop() {
    local error
    local result
    log_begin_msg "Stopping $DESC: $NAME"
    error=$($DAEMON -k 2>&1)
    result=$?
    log_progress_msg ${error#ERRO: }
    log_end_msg $result
}

case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart|force-reload)
    #
    #   If the "reload" option is implemented, move the "force-reload"
    #   option to the "reload" entry above. If not, "force-reload" is
    #   just the same as "restart".
    #
    stop
    start
    ;;
  *)
    N=/etc/init.d/$NAME
    echo "Usage: $N {start|stop|restart|force-reload}" >&2
    exit 1
    ;;
esac

exit 0

Git history doesn't contain tag for 1.99.2

The tag for the 1.99.2 release was apparently made on a different branch than master with the effect that the tag 1.99.2 contains changes which are apparently not present in the 'master' branch.

Please review those commits (e.g. by running "git log -p master..1.99.2") and check whether these changes have been done already or have been obsoleted by other commits. If all is set, please merge the history of that tag (e.g. by running "git merge --strategy=ours 1.99.2") so that it is obvious for other users that looking at the repository that these commits are not relevant anymore.

Cheers,
Micha

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.