[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-ha-dev
Subject:    [Linux-ha-dev] Re: ucast.c bugfix for 0.4.9e
From:       Lars Marowsky-Bree <lmb () suse ! de>
Date:       2002-11-20 11:35:28
[Download RAW message or body]

On 2002-11-20T17:05:33,
   Sam O'Connor <sam@panviva.com> said:

Hi Sam,

thanks for the suggested fixes. I've some questions left, which might stem
from me not understanding exactly how the code works ;)

> When the ucast.c plugin parses its config line, it sets mp->name to
> the interface name but config.c sets if back to "if_name ip_addr"
> soon after.
> This causes ucast.c to use a sting like "eth0 10.0.0.10" as an
> interface name later on in HB_make_send_sock.

Ok. I'd suggest that indeed, ucast.c should not get its name mp->name in
_make_send_sock; _make_receive_sock already uses ei->interface correctly.


However, not filling in mp->name in ucast.c seems wrong; all comm modules fill
that one in, and If looked through config.c, and it seems rather that it is to
blame.

config.c:747:
                        mp->name = strdup(value);

I'd suggest that this be replaced with
			if (!mp->name)
				mp->name = strdup(value);

What do you think? (Alan?) Did I miss something?

>         if (setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE
>         ,   &i, sizeof(i)) == -1) {
>             LOG(PIL_CRIT
> !           , "Error setting socket option SO_BINDTODEVICE on %s: %s"
> !           ,   i.ifr_name
>             ,   strerror(errno));
>             close(sockfd);
>             return(-1);

This however seems to be obviously a good idea.

And please, use "diff -u" (ie, unified diffs) next time; they are much easier
to read. Thanks!

If no-one objects, I'll commit these to CVS momentarily.


Sincerely,
    Lars Marowsky-Brée <lmb@suse.de>

-- 
Principal Squirrel 
SuSE Labs - Research & Development, SuSE Linux AG
  
"If anything can go wrong, it will." "Chance favors the prepared (mind)."
  -- Capt. Edward A. Murphy            -- Louis Pasteur
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.community.tummy.com
http://lists.community.tummy.com/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic