LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-15-2014, 09:14 AM   #1
kjans
LQ Newbie
 
Registered: Feb 2007
Posts: 8

Rep: Reputation: 0
Loss of multicast registration after network restart...


Hi,

I have a Linux service that uses multicast to communicate with other instances
of itself on a LAN. Under normal conditions, it works perfectly.
Running the command “netstat -ng" shows its multicast registration:
eth1 1 239.255.2.3

What I have found is that if the network is restarted, eg: “service network restart”
the service loses its multicast membership, eg: “netstat -ng” no longer shows the
membership and it can no longer hear any other of its peers on the LAN.

I was able to detect the lack of activity (timeout) from the peers and then
reregister by doing:
setsockopt(fd, IPPROTO_IP, IP_DROP_MEMBERSHIP….)
setsockopt(fd, IPROTTO_IP, IP_ADD_MEMBERSHIP…)

Which seems to work… but the condition is detected after a timeout
period… not immediately.

Questions:
- Is there a programmatic way to quickly detect that the multicast
registration still exists or has gone away?
- Is there a way to detect that a “service network restart” has occurred?

The best I can think of is to periodically read “/proc/net/igmp” to see
if the registration still exists.

Thanks
 
Old 12-15-2014, 10:32 AM   #2
/dev/random
Member
 
Registered: Aug 2012
Location: Ontario, Canada
Distribution: Slackware 14.2, LFS-current, NetBSD 6.1.3, OpenIndiana
Posts: 319

Rep: Reputation: 112Reputation: 112
Quote:
Originally Posted by kjans View Post
Hi,

I have a Linux service that uses multicast to communicate with other instances
of itself on a LAN. Under normal conditions, it works perfectly.
Running the command “netstat -ng" shows its multicast registration:
eth1 1 239.255.2.3

What I have found is that if the network is restarted, eg: “service network restart”
the service loses its multicast membership, eg: “netstat -ng” no longer shows the
membership and it can no longer hear any other of its peers on the LAN.

I was able to detect the lack of activity (timeout) from the peers and then
reregister by doing:
setsockopt(fd, IPPROTO_IP, IP_DROP_MEMBERSHIP….)
setsockopt(fd, IPROTTO_IP, IP_ADD_MEMBERSHIP…)

Which seems to work… but the condition is detected after a timeout
period… not immediately.

Questions:
- Is there a programmatic way to quickly detect that the multicast
registration still exists or has gone away?
- Is there a way to detect that a “service network restart” has occurred?

The best I can think of is to periodically read “/proc/net/igmp” to see
if the registration still exists.

Thanks
Put the code is a while loop

while in membership do blah {}
else add me back to membership and jump back into the function (goto multicast)


now it will work as long as its part of a membership if its not it will reconnect to it and contenue to work until it breaks again and then will retry to do the same thing again and again.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Loss Of Network Connection After Power Loss etpoole60 Linux - Networking 4 11-02-2014 07:55 PM
Loss Of Network Connection After Power Loss etpoole60 Linux - Virtualization and Cloud 2 10-27-2014 03:14 PM
Network Registration rjdbarsal Linux - Networking 2 06-25-2013 02:11 AM
How do I set the regulatory daemon to restart when I restart the network service? zahadumy Linux - Networking 0 11-05-2006 11:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration