Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse error in conf file #175

Closed
alexeys85 opened this issue Nov 15, 2021 · 10 comments
Closed

Parse error in conf file #175

alexeys85 opened this issue Nov 15, 2021 · 10 comments

Comments

@alexeys85
Copy link
Contributor

Hi!

I use pretty simple config:
phyint eth1 enable ttl-threshold 1 mrdisc
phyint net1 enable ttl-threshold 2
phyint net2 enable ttl-threshold 2
phyint net3 enable ttl-threshold 2
phyint net4 enable ttl-threshold 2
mgroup from eth1 group 225.1.2.3 source 192.168.1.42
mroute from eth1 group 225.1.2.3 source 192.168.1.42 to net1

And it works just fine, until I pass -N flag to smcroute. In that case it also works fine except there is a message in the log:
smcroute[2789]: Parse error in /etc/smcroute.conf.
Both cases observed in 2.5.3 and 2.5.4 versions. Didn't check in previous versions.

@troglobit
Copy link
Owner

Well, does all these interfaces exist on the system? I've set up something similar with your config, different interfaec names only, and that works fine as long as the interfaces exist.

@alexeys85
Copy link
Contributor Author

Yes, they do. As I said there is only one difference - existing '-N' flag which causing this log message to appear.
This log is with -N flag:
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Found new interface lo, adding ...
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Found new interface eth0, adding ...
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Found new interface eth1, adding ...
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Found new interface ifb0, adding ...
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Found new interface teql0, adding ...
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Found new interface macv0, adding ...
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Found new interface tunl0, adding ...
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Found new interface net1, adding ...
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Found new interface net2, adding ...
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Found new interface net3, adding ...
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Found new interface net4, adding ...
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Found lo, updating ...
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Removing multicast VIFs for lo
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Found eth0, updating ...
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Found eth0, updating ...
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Found eth0, updating ...
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Found eth0, updating ...
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Found eth0, updating ...
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Found eth1, updating ...
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Found eth1, updating ...
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Found macv0, updating ...
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Found macv0, updating ...
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: NOFILE: current 1024 max 0
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: NOFILE: set new current 4096 max 0
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Binding IPC socket to /var/run/smcroute.sock
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: /etc/smcroute.conf line 1: phyint eth1 enable ttl-threshold 1 mrdisc
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Creating/updating multicast VIF for eth1 TTL 1
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Map iface eth1 => VIF 0 ifindex 3 flags 0x0008 TTL threshold 1
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Sending mrdisc announcement on eth1
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: /etc/smcroute.conf line 2:
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: /etc/smcroute.conf line 3: phyint net1 enable ttl-threshold 2
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Creating/updating multicast VIF for net1 TTL 2
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Map iface net1 => VIF 1 ifindex 8 flags 0x0008 TTL threshold 2
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: /etc/smcroute.conf line 4: phyint net2 enable ttl-threshold 2
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Creating/updating multicast VIF for net2 TTL 2
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Map iface net2 => VIF 2 ifindex 9 flags 0x0008 TTL threshold 2
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: /etc/smcroute.conf line 5: phyint net3 enable ttl-threshold 2
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Creating/updating multicast VIF for net3 TTL 2
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Map iface net3 => VIF 3 ifindex 10 flags 0x0008 TTL threshold 2
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: /etc/smcroute.conf line 6: phyint net4 enable ttl-threshold 2
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Creating/updating multicast VIF for net4 TTL 2
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Map iface net4 => VIF 4 ifindex 11 flags 0x0008 TTL threshold 2
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: /etc/smcroute.conf line 7:
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: /etc/smcroute.conf line 8: mgroup from eth1 group 225.1.2.3 source 192.168.1.42
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Group socket 10 count 1 of MAX 20
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Join group (192.168.1.42,225.1.2.3) on ifindex 3 and socket 10 ...
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: /etc/smcroute.conf line 9: mroute from eth1 group 225.1.2.3 source 192.168.1.42 to net1
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: /etc/smcroute.conf line 9: mroute: checking for input iface eth1 ...
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: /etc/smcroute.conf line 9: mroute: input iface eth1 has vif 0
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: /etc/smcroute.conf line 9: mroute: checking for net1 ...
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: mroute: adding route from eth1 (192.168.1.42/32,225.1.2.3/32)
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Add 192.168.1.42 -> 225.1.2.3 from VIF 0
Sat Jan 1 05:18:08 2000 daemon.warn smcroute[2788]: Parse error in /etc/smcroute.conf
Sat Jan 1 05:18:08 2000 daemon.debug smcroute[2788]: Creating PID file /var/run/smcroute.pid
Sat Jan 1 05:18:08 2000 daemon.notice smcroute[2788]: Ready, waiting for client request or kernel event.
Lines 2 and 7 are white lines.
As you see it parsed all lines from file and started to work fine, but with error message.

@troglobit
Copy link
Owner

Hmm, could you show me the complete command line for starting smcrouted? It's a bit fishy that the daemon name is smcroute instead of smcrouted, unless you're using -i smcroute, or maybe you're using the old/deprecated smcroute wrapper script? Because I simply cannot reproduce your issue with the latest release ...

@troglobit
Copy link
Owner

Also, could you dump the output of ip link and ip addr? Just to verify that the correct flags and IP addresses are set.

@alexeys85
Copy link
Contributor Author

By the way, its OpenWrt 21.01

root@RTS1:~# ps | grep smcroute
 2789 root       840 S    /usr/sbin/smcrouted -n -N -f /etc/smcroute.conf -l debug
 3032 root      1148 S    grep smcroute

I tried to debug smcroute code and inserted a smclog statement here:

smcroute/src/conf.c

Lines 468 to 471 in e22f63d

if (rc) {
errno = EOPNOTSUPP;
return 1;
}

and the value of rc var was -4. Then I remove mrdisc from smcroute.conf and rc became -5.
TLDR;
I found that this code decrements rc:

smcroute/src/mrdisc.c

Lines 328 to 329 in e22f63d

errno = ENOENT;
return -1;

because I build smcroute with mrdisc support.

@troglobit
Copy link
Owner

Thanks, reproduced now! :-)

Just pushed a fix, the mrdisc_deregister() function should not fail for never registered interfaces.

@troglobit
Copy link
Owner

I'll prepare a new release in a couple of days, and hopefully get it out the door during the weekend.

Thank you for reporting and helping debug this! <3

@alexeys85
Copy link
Contributor Author

Thanks, works now!

@troglobit
Copy link
Owner

Great :)

@troglobit
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants