Cao Shuxun wrote:
> Here is my puzzledom.
> 
> I installed hb2.0.4 on my slackware 10. And it worked well.
> But I found its master process bound to all my host's interface.
> 
> like:
> netstat -npl | grep heartbeat
> udp        0      0 172.30.31.75:695        0.0.0.0:*           
> 29007/heartbeat: ma 
> udp        0      0 0.0.0.0:33906           0.0.0.0:*           
> 29007/heartbeat: ma 

Heartbeat uses the SO_BINDTODEVICE option to keep it from binding to all
interfaces.  Perhaps netstat doesn't read out that option correctly?

The code in question is below.  All Linux kernels since 2.2.x have
supported this option.  You can even activate the debug shown below to
see if it's really being executed...

#if defined(SO_BINDTODEVICE)
        {
                /*
                 *  We want to send out this particular interface
                 *
                 * This is so we can have redundant NICs, and heartbeat
on both
                 */
                struct ifreq i;
                strcpy(i.ifr_name,  mp->name);

                if (setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE
                ,       (const void *) &i, sizeof(i)) == -1) {
                        PILCallLog(LOG, PIL_CRIT
                        ,       "Error setting socket option
SO_BINDTODEVICE"
                        ": %s"
                        ,       strerror(errno));
                        close(sockfd);
                        return(-1);
                }

                if (DEBUGPKT) {
                        PILCallLog(LOG, PIL_DEBUG
                        , "bcast_make_send_sock: Modified %d"
                        " Added option SO_BINDTODEVICE."
                        ,       sockfd);
                }

        }
#endif


-- 
    Alan Robertson <[EMAIL PROTECTED]>

"Openness is the foundation and preservative of friendship...  Let me
claim from you at all times your undisguised opinions." - William
Wilberforce
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to