|
|
Detect interface failure.
Hi:
I have two interface cards A1 and A2 with addresses IP1 and IP2. I
open a RAW socket
on IP1.
Sometime later, I have disabled A1 . But when I write to the socket,
I do not get any error and the data actually flows out through A2, with
the source IP address as IP1.
Can anybody tel me how do I detect card failures in this kind of
setup??
Should write give me an error??
Regards,
Prathap.
|
|
0
|
|
|
|
Reply
|
prathap.bgl (26)
|
12/14/2005 9:16:41 AM |
|
Hello,
> I have two interface cards A1 and A2 with addresses IP1 and IP2. I
> open a RAW socket on IP1.
> Sometime later, I have disabled A1 .
How Did you disable the interface A1?
> But when I write to the socket, I do not get any error and the data actually flows
> out through A2, with the source IP address as IP1.
> Can anybody tel me how do I detect card failures in this kind of setup??
> Should write give me an error??
No, it is unlikely that write() will return an error. There are two
possibilities to detect such a failure condition:
1) get asynchronously a notification from the kernel. Of course, this
highly depends of the possibilities/features of the underlying OS.
2) use a heartbeat mechanism.
HTH,
Loic.
|
|
0
|
|
|
|
Reply
|
loic
|
12/14/2005 9:58:28 AM
|
|
I used the command : 'ifconfig eth1 down' and have also tried pulling
out the cable.
1) get asynchronously a notification from the kernel. Of course, this
highly depends of the possibilities/features of the underlying OS.
--- How do I receive this notification if the Kernel is giving it???
2) use a heartbeat mechanism.
---- Can you provide more details on this
Thanks,
Prathap.
|
|
0
|
|
|
|
Reply
|
Prathap
|
12/14/2005 2:03:16 PM
|
|
> I used the command : 'ifconfig eth1 down' and have also tried pulling
> out the cable.
yes, that's typically the kind of failure you won't get a the socket
API level, since the error might be transient.
> 1) get asynchronously a notification from the kernel. Of course, this
> highly depends of the possibilities/features of the underlying OS.
> --- How do I receive this notification if the Kernel is giving it???
I don't know. This depends on your OS!
Do you see in the kernel log a message like "link down"?
> 2) use a heartbeat mechanism.
> ---- Can you provide more details on this
That's simple. Basically you exchange periodically over the network
link a heartbeat message using a reliable protocol. If you don't
receive a heartbeat from your peer within a given timeout, then you can
assume that:
1) the peer heartbeat process crashed or hangs,
or
2) the peer node is dead,
or
3) the network link is broken.
With a bit more programming effort, you can exclude 1). To exclude 2),
you need a redundant network link.
Google a bit for "High Availability" and "heartbeat". I am sure you
will find plenty of interesting info about the subject. You might also
want have a look at:
http://www.linux-ha.org/
HTH,
Loic.
|
|
0
|
|
|
|
Reply
|
loic
|
12/14/2005 3:06:14 PM
|
|
Thanks Loic:
Well, what I want to know is, if I can use something like Routing
sockets to detect my local interface failure??
Because, detecting this failure and sending the data out with the
right source IP address is critical for my SCTP implementation.
I cannot afford to experiment too much when the failure happens just
before I try to set up an association.
Regards,
Prathap.
|
|
0
|
|
|
|
Reply
|
Prathap
|
12/14/2005 5:04:09 PM
|
|
|
4 Replies
359 Views
(page loaded in 0.075 seconds)
|
|
|
|
|
|
|
|
|