Hi Dejan,

Dejan Muhamedagic wrote:
Hi Kazunori-san,

On Fri, Oct 09, 2009 at 07:17:15PM +0900, Kazunori INOUE wrote:
Hi,

I found that IPv6addr failed to assign the address in the following
environments.
I attached patch for IPv6addr in Cluster Resource Agents
(changeset:de034cf1e9a1).

1) environments
   # ifconfig bond0
   bond0     Link encap:Ethernet  HWaddr 00:10:18:27:02:D3
             inet6 addr: 2001:db8:91:0:92::181/80 Scope:Global
   [snip]

   # ifconfig eth0
   eth0      Link encap:Ethernet  HWaddr 00:1A:64:06:59:92
             inet6 addr: 2001:db8:91:0:91::182/64 Scope:Global
   [snip]

   # grep ^2001 /proc/net/if_inet6
   20010db8009100000091000000000182 0e 40 00 80     eth0
   20010db8009100000092000000000181 0c 50 00 80    bond0
     (* POINT which fails is this order.)

You mean the order of interface list influences the processing?

Yes. (and it is also important that prefix_len is different.)
IPv6addr will be successful if it is the following order.

   # grep ^2001 /proc/net/if_inet6
   20010db8009100000092000000000181 0c 50 00 80    bond0
   20010db8009100000091000000000182 0e 40 00 80     eth0
   #

2) IPv6addr start op
   # env | grep OCF_RESKEY
   OCF_RESKEY_ipv6addr=2001:db8:91:0:92::189
   OCF_RESKEY_nic=bond0
    (* OCF_RESKEY_cidr_netmask is not specified intentionally.)

   # /usr/lib/ocf/resource.d/heartbeat/IPv6addr start
   # echo $?
   1
   #

I hope they are helpful to you.

Regards,
Kazunori INOUE

diff -urN agents.org/heartbeat/IPv6addr.c agents.mod/heartbeat/IPv6addr.c
--- agents.org/heartbeat/IPv6addr.c     2009-10-09 15:13:50.000000000 +0900
+++ agents.mod/heartbeat/IPv6addr.c     2009-10-09 15:19:36.000000000 +0900
@@ -294,6 +294,7 @@
        /* release the pid file */
        unlink(pid_file);
+ cl_log(LOG_DEBUG, "%s %s : %d", getenv("OCF_RESOURCE_INSTANCE"), argv[1], ret);
        return ret;
 }
 int
@@ -513,7 +514,6 @@
                if (*plen_target!=0 && plen != *plen_target) {
                        continue;
                }
-               *plen_target = plen;
/* If interface name provided, only same devname entry
                 * would be considered
@@ -554,6 +554,7 @@
                /* We found it! */
                if (same) {
                        fclose(f);
+                       *plen_target = plen;
                        return devname;
                }
        }

I looked at the code twice, but can't see how this patch would
make the difference. plen doesn't change in that code segment, so
how can moving that assignment make plen_target different. Can
you please explain in more detail.

Since plen is the value read from if_inet6 file, I recognize it as
changing...
When the line of eth0 is read, it's set as 64 (=0x40),
and the line of bond0 is read, it's set as 80 (=0x50).

Please see the attached gdb.log for details.

Best Regards,
Kazunori INOUE

Cheers,

Dejan

_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
# ifconfig bond0
bond0     Link encap:Ethernet  HWaddr 00:10:18:27:02:D3
          inet6 addr: 2001:db8:91:0:92::181/80 Scope:Global
[snip]                                     ---

# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:1A:64:06:59:92
          inet6 addr: 2001:db8:91:0:91::182/64 Scope:Global
[snip]                                     ---

# grep ^2001 /proc/net/if_inet6
20010db8009100000091000000000182 0e 40 00 80     eth0
20010db8009100000092000000000181 0c 50 00 80    bond0
#                                   --

# env | grep OCF_RESKEY
OCF_RESKEY_ipv6addr=2001:db8:91:0:92::189
OCF_RESKEY_nic=bond0
#

# gdb ./IPv6addr
GNU gdb Fedora (6.8-27.el5)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"...
(gdb) b scan_if
Breakpoint 1 at 0x4026ec: file IPv6addr.c, line 471.
(gdb) run start
Starting program: /usr/lib/ocf/resource.d/heartbeat/IPv6addr start
[Thread debugging using libthread_db enabled]
[New Thread 0x2ab77f177630 (LWP 8510)]

Breakpoint 1, scan_if (addr_target=0x7fff2bd95630, plen_target=0x7fff2bd95524, 
use_mask=0,
    prov_ifname=0x7fff2bd95e9e "bond0") at IPv6addr.c:471
471     {
(gdb) bt
#0  scan_if (addr_target=0x7fff2bd95630, plen_target=0x7fff2bd95524, use_mask=0,
    prov_ifname=0x7fff2bd95e9e "bond0") at IPv6addr.c:471
#1  0x0000000000402a59 in get_if (addr_target=0x7fff2bd95630, 
plen_target=0x7fff2bd95524,
    prov_ifname=0x7fff2bd95e9e "bond0") at IPv6addr.c:573
#2  0x0000000000402363 in status_addr6 (addr6=0x7fff2bd95630, prefix_len=0,
    prov_ifname=0x7fff2bd95e9e "bond0") at IPv6addr.c:387
#3  0x000000000040208e in start_addr6 (addr6=0x7fff2bd95630, prefix_len=0,
    prov_ifname=0x7fff2bd95e9e "bond0") at IPv6addr.c:304
#4  0x0000000000401d35 in main (argc=2, argv=0x7fff2bd95848) at IPv6addr.c:273
(gdb) c
Continuing.

Breakpoint 1, scan_if (addr_target=0x7fff2bd95630, plen_target=0x7fff2bd95564, 
use_mask=1,
    prov_ifname=0x7fff2bd95e9e "bond0") at IPv6addr.c:471
471     {
(gdb) bt
#0  scan_if (addr_target=0x7fff2bd95630, plen_target=0x7fff2bd95564, use_mask=1,
    prov_ifname=0x7fff2bd95e9e "bond0") at IPv6addr.c:471
#1  0x0000000000402a0a in find_if (addr_target=0x7fff2bd95630, 
plen_target=0x7fff2bd95564,
    prov_ifname=0x7fff2bd95e9e "bond0") at IPv6addr.c:567
#2  0x00000000004020af in start_addr6 (addr6=0x7fff2bd95630, prefix_len=0,
    prov_ifname=0x7fff2bd95e9e "bond0") at IPv6addr.c:309
#3  0x0000000000401d35 in main (argc=2, argv=0x7fff2bd95848) at IPv6addr.c:273
(gdb) p *plen_target
$1 = 0
(gdb) b IPv6addr.c:516
Breakpoint 2 at 0x4027f9: file IPv6addr.c, line 516.
(gdb) c
Continuing.

Breakpoint 2, scan_if (addr_target=0x7fff2bd95630, plen_target=0x7fff2bd95564, 
use_mask=1,
    prov_ifname=0x7fff2bd95e9e "bond0") at IPv6addr.c:516
516                     *plen_target = plen;
(gdb) p *plen_target
$2 = 0
(gdb) n
521                     if (prov_ifname!=0 && *prov_ifname!=0)
(gdb) p *plen_target
$3 = 64

 /* **********************************************************************
  *  plen_target "0" was overwrited by 64.
  * **********************************************************************/

(gdb) n
523                             if (strcmp(devname, prov_ifname))
(gdb) p devname
$4 = "eth0\0000", '\0' <repeats 14 times>
(gdb) p prov_ifname
$5 = 0x7fff2bd95e9e "bond0"
(gdb) list
518                     /* If interface name provided, only same devname entry
519                      * would be considered
520                      */
521                     if (prov_ifname!=0 && *prov_ifname!=0)
522                     {
523                             if (strcmp(devname, prov_ifname))
524                                     continue;
525                     }
526
527                     for (i = 0; i< 4; i++) {
(gdb) n
489                     gboolean        same = TRUE;
(gdb) p *plen_target
$6 = 64
(gdb) b IPv6addr.c:513
Breakpoint 3 at 0x4027d6: file IPv6addr.c, line 513.
(gdb) c
Continuing.

Breakpoint 3, scan_if (addr_target=0x7fff2bd95630, plen_target=0x7fff2bd95564, 
use_mask=1,
    prov_ifname=0x7fff2bd95e9e "bond0") at IPv6addr.c:513
513                     if (*plen_target!=0 && plen != *plen_target) {
(gdb) p devname
$7 = "bond0", '\0' <repeats 15 times>
(gdb) p plen
$8 = 80
(gdb) p *plen_target
$9 = 64
(gdb) list
508                     }
509
510                     /* If specified prefix, only same prefix entry
511                      * would be considered.
512                      */
513                     if (*plen_target!=0 && plen != *plen_target) {
514                             continue;
515                     }
516                     *plen_target = plen;
517

 /* **********************************************************************
  *  The value of plen_target "64" (please refer to the 72th line of this
  *  log) is a value of eth0 read from if_inet6.
  *   -----------------------------------------------------
  *   20010db8009100000091000000000182 0e 40 00 80     eth0
  *                                       --
  *  When plen_target is 0 here, the 514th line of IPv6addr.c ('continue;')
  *  is not executed. Therefore, bond0 is selected.
  * **********************************************************************/

(gdb) b IPv6addr.c:557
Breakpoint 4 at 0x40298b: file IPv6addr.c, line 557.
(gdb) b IPv6addr.c:561
Breakpoint 5 at 0x4029a1: file IPv6addr.c, line 561.
(gdb) c
Continuing.

Breakpoint 5, scan_if (addr_target=0x7fff2bd95630, plen_target=0x7fff2bd95564, 
use_mask=1,
    prov_ifname=0x7fff2bd95e9e "bond0") at IPv6addr.c:561
561             return NULL;
(gdb) q
The program is running.  Exit anyway? (y or n) y
#


_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to