* pimreg zombies
@ 2010-09-04 21:12 Alexander Clouter
2010-09-12 19:08 ` David Miller
2010-09-12 19:17 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Alexander Clouter @ 2010-09-04 21:12 UTC (permalink / raw)
To: netdev
Hi,
I am writing a multicast pim daemon and noticed that if I call
setsockopt(MRT_ADD_VIF), also occurs for IPv6 too, incorrectly on a
socket established with socket(AF_INET, SOCK_RAW, IPPROTO_PIM)[1] then
when the application quits I have zombie pimreg (and pimreg6) interfaces
that can only be disposed of with a reboot.
I have included the code below to give you something (hopefully)
reproducible; this problem I see on a 2.6.35.4 kernel. No idea if there
was ever a safe kernel but maybe all the recent namespace and multiple
multicast routing table amendments broke something.
Obviously I know for Linux I should be calling setsockopt() on the IGMP
socket, however I'm pretty sure zombie pim's should not be appearing :)
Cheers
[1] rather than as I should on an IPPROTO_IGMP raw socket
----
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include <stdio.h>
#include <sysexits.h>
#include <string.h>
#include <netinet/in.h>
#include <linux/mroute.h>
#include <linux/mroute6.h>
int main(int argc, char **argv)
{
int pim4, pim6;
struct vifctl v4;
struct mif6ctl v6;
pim4 = socket(AF_INET, SOCK_RAW, IPPROTO_PIM);
if (pim4 < 0) {
perror("socket(AF_INET, SOCK_RAW, IPPROTO_PIM)");
return EX_OSERR;
}
memset(&v4, 0, sizeof(v4));
v4.vifc_flags = VIFF_REGISTER;
if (setsockopt(pim4, IPPROTO_IP, MRT_ADD_VIF, &v4, sizeof(v4)) < 0) {
perror("setsockopt(MRT_ADD_VIF)");
close(pim4);
return EX_OSERR;
}
close(pim4);
/***********************/
pim6 = socket(AF_INET6, SOCK_RAW, IPPROTO_PIM);
if (pim6 < 0) {
perror("socket(AF_INET6, SOCK_RAW, IPPROTO_PIM)");
return EX_OSERR;
}
memset(&v6, 0, sizeof(v6));
v6.mif6c_flags = MIFF_REGISTER;
if (setsockopt(pim6, IPPROTO_IPV6, MRT6_ADD_MIF, &v6, sizeof(v6)) < 0) {
perror("setsockopt(MRT6_ADD_MIF)");
close(pim6);
return EX_OSERR;
}
close(pim6);
return EX_OK;
}
----
--
Alexander Clouter
.sigmonster says: You have junk mail.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: pimreg zombies
2010-09-04 21:12 pimreg zombies Alexander Clouter
@ 2010-09-12 19:08 ` David Miller
2010-09-12 19:17 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2010-09-12 19:08 UTC (permalink / raw)
To: alex; +Cc: netdev
From: Alexander Clouter <alex@digriz.org.uk>
Date: Sat, 4 Sep 2010 22:12:34 +0100
> I am writing a multicast pim daemon and noticed that if I call
> setsockopt(MRT_ADD_VIF), also occurs for IPv6 too, incorrectly on a
> socket established with socket(AF_INET, SOCK_RAW, IPPROTO_PIM)[1] then
> when the application quits I have zombie pimreg (and pimreg6) interfaces
> that can only be disposed of with a reboot.
Thanks for this report, I'll take a look.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: pimreg zombies
2010-09-04 21:12 pimreg zombies Alexander Clouter
2010-09-12 19:08 ` David Miller
@ 2010-09-12 19:17 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2010-09-12 19:17 UTC (permalink / raw)
To: alex; +Cc: netdev
From: Alexander Clouter <alex@digriz.org.uk>
Date: Sat, 4 Sep 2010 22:12:34 +0100
> I am writing a multicast pim daemon and noticed that if I call
> setsockopt(MRT_ADD_VIF), also occurs for IPv6 too, incorrectly on a
> socket established with socket(AF_INET, SOCK_RAW, IPPROTO_PIM)[1] then
> when the application quits I have zombie pimreg (and pimreg6) interfaces
> that can only be disposed of with a reboot.
pimreg interfaces can only be instantiated and removed from userspace
by using the appropriate MRT_*. So you can get rid of these
interfaces by using an appropriate MRT_DEL_VIF call on an IPPROTO_PIM
socket.
They are not automatically removed by the closing of that userland
socket.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-09-12 19:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-04 21:12 pimreg zombies Alexander Clouter
2010-09-12 19:08 ` David Miller
2010-09-12 19:17 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).