On 07/09/09 21:34, Angus Salkeld wrote:
> Hi
>
> This is a resend of : http://marc.info/?l=openais&m=124821155618466&w=4
>
> Currently totemip_copy (boundto,&ipaddr) is called even when the
> required mask is not found.
>
> This patch changes the behavior to only copy the ipaddr when the mask is
> found.
>
> The current behavior makes debugging an incorrect config really confusing.
ACK on provision you fix the comment below ;-)
Chrissie
>
> --- exec/totemip.c (revision 2405)
> +++ exec/totemip.c (working copy)
> @@ -474,6 +474,7 @@
> int mask_high_bit)
> {
> int fd;
> + int res = -1;
> struct {
> struct nlmsghdr nlh;
> struct rtgenmsg g;
> @@ -591,17 +592,31 @@
> /* SIOCGIFFLAGS needs an interface name
> */
> status = ioctl(ioctl_fd,
> SIOCGIFNAME,&ifr);
> status = ioctl(ioctl_fd,
> SIOCGIFFLAGS,&ifr);
> + close(ioctl_fd);
> if (status) {
> - close(ioctl_fd);
> - close(fd);
> - return -1;
> + res = -1;
> + goto finished;
> }
>
> if (ifr.ifr_flags& IFF_UP)
> *interface_up = 1;
>
> *interface_num = ifa->ifa_index;
> - close(ioctl_fd);
> + /* Mask 32nd bit off to workaround bugs
> in other peoples code
> + * (if configuration requests it). */
The comment should be in this format :
/*
* Mask 32nd bit off to workaround bugs in other peoples' code
* (if configuration requests it).
*/
> + if (ipaddr.family == AF_INET&&
> ipaddr.nodeid == 0) {
> + unsigned int nodeid = 0;
> + memcpy (&nodeid, ipaddr.addr,
> sizeof (int));
> +#if __BYTE_ORDER == __BIG_ENDIAN
> + nodeid = swab32 (nodeid);
> +#endif
> + if (mask_high_bit) {
> + nodeid&= 0x7FFFFFFF;
> + }
> + ipaddr.nodeid = nodeid;
> + }
> + totemip_copy (boundto,&ipaddr);
> + res = 0;
> goto finished;
> }
> }
> @@ -609,24 +624,9 @@
> h = NLMSG_NEXT(h, status);
> }
> }
> + res = -1; /* address not found */
> finished:
> - /*
> - * Mask 32nd bit off to workaround bugs in other poeples code
> - * if configuration requests it.
> - */
> - if (ipaddr.family == AF_INET&& ipaddr.nodeid == 0) {
> - unsigned int nodeid = 0;
> - memcpy (&nodeid, ipaddr.addr, sizeof (int));
> -#if __BYTE_ORDER == __BIG_ENDIAN
> - nodeid = swab32 (nodeid);
> -#endif
> - if (mask_high_bit) {
> - nodeid&= 0x7FFFFFFF;
> - }
> - ipaddr.nodeid = nodeid;
> - }
> - totemip_copy (boundto,&ipaddr);
> close(fd);
> - return 0;
> + return res;
> }
> #endif /* COROSYNC_LINUX */
> _______________________________________________
> Openais mailing list
> [email protected]
> https://lists.linux-foundation.org/mailman/listinfo/openais
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais