troglobit / pimd

PIM-SM/SSM multicast routing for UNIX and Linux
http://troglobit.com/projects/pimd/
BSD 3-Clause "New" or "Revised" License
194 stars 86 forks source link

FreeBSD 12.1 - Failed adding VIF 1 (MRT_ADD_VIF) for iface em1: Address already in use #157

Closed ozkankirik closed 4 years ago

ozkankirik commented 4 years ago

Hello, I'm using FreeBSD 12.1-STABLE. After stopping pimd, it cannot start without a reboot. Reboot solves problem. I think Disabling all vifs from kernel not working.

pimd.conf:

phyint em1 enable
phyint em2 enable
bsr-candidate priority 5
rp-candidate time 30 priority 20
spt-threshold packets 0 interval 100
# pimd -N -d -s debug
debug level 0xffffffff (dvmrp_detail,dvmrp_prunes,dvmrp_routes,dvmrp_neighbors,dvmrp_timers,igmp_proto,igmp_timers,igmp_members,trace,timeout,packets,interfaces,kernel,cache,rsrr,pim_detail,pim_hello,pim_register,pim_join_prune,pim_bootstrap,pim_asserts,pim_cand_rp,pim_routes,pim_timers,pim_rpf)
11:52:23.035 pimd version 2.3.2 starting ...
11:52:23.035 Got 262144 byte send buffer size in 0 iterations
11:52:23.035 Got 262144 byte recv buffer size in 0 iterations
11:52:23.035 Got 262144 byte send buffer size in 0 iterations
11:52:23.035 Got 262144 byte recv buffer size in 0 iterations
11:52:23.035 Getting vifs from kernel
11:52:23.035 Installing em0 (10.2.4.20 on subnet 10.2.4/24) as vif #0 - rate 0
11:52:23.035 Installing em1 (192.168.58.1 on subnet 192.168.58) as vif #1 - rate 0
11:52:23.035 Installing em2 (192.168.59.1 on subnet 192.168.59) as vif #2 - rate 0
11:52:23.035 Installing em1.1600 (192.168.16.1 on subnet 192.168.16) as vif #3 - rate 0
11:52:23.035 Installing em1.1700 (192.168.17.1 on subnet 192.168.17) as vif #4 - rate 0
11:52:23.035 Disabling all vifs from kernel
11:52:23.035 Getting vifs from /usr/local/etc//pimd.conf
11:52:23.035 Local Cand-BSR address 192.168.59.1, priority 5
11:52:23.035 Local Cand-RP address 192.168.59.1, priority 20, interval 30 sec
11:52:23.035 spt-threshold packets 0 interval 100
11:52:23.035 Local static RP: 169.254.0.1, group 232.0.0.0/8
11:52:23.035 IGMP query interval  : 12 sec
11:52:23.035 IGMP querier timeout : 41 sec
11:52:23.035 Interface em0 is DISABLED; vif #0 out of service
11:52:23.035 **Failed adding VIF 1 (MRT_ADD_VIF) for iface em1: Address already in use**
 # netstat -g

IPv4 Virtual Interface Table
 Vif   Thresh   Local-Address   Remote-Address    Pkts-In   Pkts-Out
  0         0   0.248.255.255                   4342224449182   67108859
  2        87   0.248.255.255                     1048576  18446741876471308288
  3       189   0.254.255.255                   18446735277667342272  18446744071575886480
  5       254   0.254.255.255                   18446741876208696832  18446741876208696816
  7        21   255.255.255.255 0.0.0.0         207876617823          0

IPv4 Multicast Forwarding Table is empty

IPv6 Multicast Interface Table is empty

IPv6 Multicast Forwarding Table is empty
troglobit commented 4 years ago

Hi, that really looks weird. What kind of hardware are you running on? Because the output from netstat -g looks like there was a endian problem setting up the VIFs, causing the threshold field to be overwritten with the IP address ...

On my virtual x86 system running i get this:

[root@beasdie ~/pimd-2.3.2]# uname -a
FreeBSD beasdie 11.2-RELEASE-p14 FreeBSD 11.2-RELEASE-p14 #0: Mon Aug 19 22:38:50 UTC 2019     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
[root@beasdie ~/pimd-2.3.2]# ./pimd -c foo.conf -N
[root@beasdie ~/pimd-2.3.2]# netstat -g

IPv4 Virtual Interface Table
 Vif   Thresh   Local-Address   Remote-Address    Pkts-In   Pkts-Out
  0         1   192.168.122.184                         0          0
  1         1   172.16.1.166                            0          0
  2         1   192.168.122.184                         0          0

IPv4 Multicast Forwarding Table is empty

netstat: sysctl: net.inet6.ip6.mif6table: No such file or directory
[root@beasdie ~/pimd-2.3.2]# netstat -g

IPv4 Virtual Interface Table
 Vif   Thresh   Local-Address   Remote-Address    Pkts-In   Pkts-Out
  0         1   192.168.122.184                         0          0
  1         1   172.16.1.166                            0          0
  2         1   192.168.122.184                         0          0

IPv4 Multicast Forwarding Table is empty

I'd recommend trying out the, still to be released, v3.0 from the GitHub master branch and test that instead. There's been lots of fixes and features added since the 2.3.2 release. I've just not had time to finalize it (test on all platforms) to do the release.

ozkankirik commented 4 years ago

You can reproduce this error with this steps: ./pimd -c foo.conf -N killall pimd ./pimd -c foo.conf -N

ozkankirik commented 4 years ago

platform is amd64.

uname -a
FreeBSD test.test.com 12.1-STABLE FreeBSD 12.1-STABLE #8 1f999e39f46(v2)-dirty: Wed Apr 22 08:40:36 +03 2020    test@test.test.com:/usr/obj/usr/src/amd64.amd64/sys/amd64
ozkankirik commented 4 years ago

I'm going to test it. Thank you

troglobit commented 4 years ago

That's weird. I couldn't reproduce with pimd v2.3.2, but I was on FreeBSD 11.2 ... so that could be a contributing factor I guess. Worrying if there's been a change to the kernel causing this.

Anyway, hope it works better with the lastest git master

ozkankirik commented 4 years ago

Problem is related with FreeBSD kernel ip_mroute.c. I opened a new bug report to FreeBSD: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=246629 Thanks

troglobit commented 4 years ago

Nice work locating this, hope they can fix it!