Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux-HA: Dev

[PATCH] IPv6addr: removing libnet dependency

 

 

Linux-HA dev RSS feed   Index | Next | Previous | View Threaded


keisuke.mori+ha at gmail

Jul 22, 2010, 5:19 PM

Post #1 of 22 (1437 views)
Permalink
[PATCH] IPv6addr: removing libnet dependency

The attached patch is to remove libnet dependency from IPv6addr RA
by replacing the same functionality using the standard socket API.

Currently there are following problems with resource-agents package:

- IPv6addr RA requires an extra libnet package on the run-time environment.
That is pretty inconvenient particularly for RHEL users because
it's not included in the standard distribution.

- The pre-built RPMs from ClusterLabs does not include IPv6addr RA.
This was once reported in the pacemaker list:
http://www.gossamer-threads.com/lists/linuxha/pacemaker/64295#64295

The patch will resolve those issues.
I believe that none of Pacemaker/Heartbeat related packages would be
depending on libnet library any more after patched.

Regards,

--
Keisuke MORI
Attachments: IPv6addr-no-libnet.patch (5.97 KB)


horms at verge

Jul 22, 2010, 8:09 PM

Post #2 of 22 (1420 views)
Permalink
Re: [PATCH] IPv6addr: removing libnet dependency [In reply to]

On Fri, Jul 23, 2010 at 09:19:44AM +0900, Keisuke MORI wrote:
> The attached patch is to remove libnet dependency from IPv6addr RA
> by replacing the same functionality using the standard socket API.
>
> Currently there are following problems with resource-agents package:
>
> - IPv6addr RA requires an extra libnet package on the run-time environment.
> That is pretty inconvenient particularly for RHEL users because
> it's not included in the standard distribution.
>
> - The pre-built RPMs from ClusterLabs does not include IPv6addr RA.
> This was once reported in the pacemaker list:
> http://www.gossamer-threads.com/lists/linuxha/pacemaker/64295#64295
>
> The patch will resolve those issues.
> I believe that none of Pacemaker/Heartbeat related packages would be
> depending on libnet library any more after patched.

Hi Mori-san,

I will add that libnet seems to be more or less unmaintained.

You seem to make using libnet optional, is there a reason
not to just remove it? portability?

> # HG changeset patch
> # User Keisuke MORI <kskmori [at] intellilink>
> # Date 1279802861 -32400
> # Branch ipv6
> # Node ID 40d5dbdca9cc089b6514c7525cd2dbd678299711
> # Parent b3142fd9cc672f2217e632608bc986b46265b193
> IPv6addr: remove libnet dependency
>
> diff -r b3142fd9cc67 -r 40d5dbdca9cc configure.in
> --- a/configure.in Fri Jul 16 09:46:38 2010 +0200
> +++ b/configure.in Thu Jul 22 21:47:41 2010 +0900
> @@ -607,6 +607,7 @@
> [new_libnet=yes; AC_DEFINE(HAVE_LIBNET_1_1_API, 1, Libnet 1.1 API)],
> [new_libnet=no; AC_DEFINE(HAVE_LIBNET_1_0_API, 1, Libnet 1.0 API)],$LIBNETLIBS)
> AC_SUBST(LIBNETLIBS)
> + AC_DEFINE(HAVE_LIBNET_API, 1, Libnet API)
> fi
>
> if test "$new_libnet" = yes; then
> @@ -634,7 +635,7 @@
> dnl ************************************************************************
> dnl * Check for netinet/icmp6.h to enable the IPv6addr resource agent
> AC_CHECK_HEADERS(netinet/icmp6.h,[],[],[#include <sys/types.h>])
> -AM_CONDITIONAL(USE_IPV6ADDR, test "$ac_cv_header_netinet_icmp6_h" = yes -a "$new_libnet" = yes )
> +AM_CONDITIONAL(USE_IPV6ADDR, test "$ac_cv_header_netinet_icmp6_h" = yes )
>
> dnl ========================================================================
> dnl Compiler flags
> diff -r b3142fd9cc67 -r 40d5dbdca9cc heartbeat/IPv6addr.c
> --- a/heartbeat/IPv6addr.c Fri Jul 16 09:46:38 2010 +0200
> +++ b/heartbeat/IPv6addr.c Thu Jul 22 21:47:41 2010 +0900
> @@ -87,13 +87,25 @@
>
> #include <config.h>
>
> +#include <stdio.h>
> #include <stdlib.h>
> +#include <unistd.h>
> #include <sys/types.h>
> +#include <sys/socket.h>
> #include <netinet/icmp6.h>
> +#include <arpa/inet.h> /* for inet_pton */
> +#include <net/if.h> /* for if_nametoindex */
> +#include <sys/ioctl.h>
> +#include <sys/stat.h>
> +#include <fcntl.h>
> #include <libgen.h>
> #include <syslog.h>
> +#include <signal.h>
> +#include <errno.h>
> #include <clplumbing/cl_log.h>
> +#ifdef HAVE_LIBNET_API
> #include <libnet.h>
> +#endif
>
>
> #define PIDFILE_BASE HA_RSCTMPDIR "/IPv6addr-"
> @@ -400,8 +412,11 @@
> return OCF_NOT_RUNNING;
> }
>
> +#ifdef HAVE_LIBNET_API
> /* Send an unsolicited advertisement packet
> * Please refer to rfc2461
> + *
> + * Libnet based implementation.
> */
> int
> send_ua(struct in6_addr* src_ip, char* if_name)
> @@ -466,6 +481,108 @@
> libnet_destroy(l);
> return status;
> }
> +#else /* HAVE_LIBNET_API */
> +/* Send an unsolicited advertisement packet
> + * Please refer to rfc4861 / rfc3542
> + *
> + * Libnet independent implementation.
> + */
> +int
> +send_ua(struct in6_addr* src_ip, char* if_name)
> +{
> + int status = -1;
> + int fd;
> +
> + int ifindex;
> + int hop;
> + struct ifreq ifr;
> +#define HWADDR_LEN 6 /* mac address length */

Personally I'd prefer the define outside of the function.

> + u_int8_t payload[sizeof(struct nd_neighbor_advert)
> + + sizeof(struct nd_opt_hdr) + HWADDR_LEN];
> + struct nd_neighbor_advert *na;
> + struct nd_opt_hdr *opt;
> + struct sockaddr_in6 src_sin6;
> + struct sockaddr_in6 dst_sin6;
> +
> + if ((fd = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) == 0) {
> + cl_log(LOG_ERR, "socket(IPPROTO_ICMPV6) failed: %s",
> + strerror(errno));
> + goto err;
> + }
> + /* set the outgoing interface */
> + ifindex = if_nametoindex(if_name);
> + if (setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_IF,
> + &ifindex, sizeof(ifindex)) < 0) {
> + cl_log(LOG_ERR, "setsockopt(IPV6_MULTICAST_IF) failed: %s",
> + strerror(errno));
> + goto err;
> + }
> + /* set the hop limit */
> + hop = 255; /* 255 is required. see rfc4861 7.1.2 */
> + if (setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
> + &hop, sizeof(hop)) < 0) {
> + cl_log(LOG_ERR, "setsockopt(IPV6_MULTICAST_HOPS) failed: %s",
> + strerror(errno));
> + goto err;
> + }
> +
> + /* set the source address */
> + memset(&src_sin6, 0, sizeof(src_sin6));
> + src_sin6.sin6_family = AF_INET6;
> + src_sin6.sin6_addr = *src_ip;
> + src_sin6.sin6_port = 0;
> + if (bind(fd, (struct sockaddr *)&src_sin6, sizeof(src_sin6)) < 0) {
> + cl_log(LOG_ERR, "bind() failed: %s", strerror(errno));
> + goto err;
> + }
> +
> +
> + /* get the hardware address */
> + memset(&ifr, 0, sizeof(ifr));
> + strncpy(ifr.ifr_name, if_name, sizeof(ifr.ifr_name) - 1);
> + if (ioctl(fd, SIOCGIFHWADDR, &ifr) < 0) {
> + cl_log(LOG_ERR, "ioctl(SIOCGIFHWADDR) failed: %s", strerror(errno));
> + goto err;
> + }
> +
> + /* build a neighbor advertisement message */
> + memset(&payload, 0, sizeof(payload));
> +
> + na = (struct nd_neighbor_advert *)&payload;
> + na->nd_na_type = ND_NEIGHBOR_ADVERT;
> + na->nd_na_code = 0;
> + na->nd_na_cksum = 0; /* calculated by kernel */
> + na->nd_na_flags_reserved = ND_NA_FLAG_OVERRIDE;
> + na->nd_na_target = (*src_ip);

There is no need to enclose *src_ip in brackets.

> +
> + /* options field; set the target link-layer address */
> + opt = (struct nd_opt_hdr *)&payload[sizeof(struct nd_neighbor_advert)];
> + opt->nd_opt_type = ND_OPT_TARGET_LINKADDR;
> + opt->nd_opt_len = 1; /* The length of the option in units of 8 octets */
> + memcpy(&payload[sizeof(struct nd_neighbor_advert)
> + + sizeof(struct nd_opt_hdr)],
> + &ifr.ifr_hwaddr.sa_data, HWADDR_LEN);
> +
> + /* sending an unsolicited neighbor advertisement to all */
> + memset(&dst_sin6, 0, sizeof(dst_sin6));
> + dst_sin6.sin6_family = AF_INET6;
> + inet_pton(AF_INET6, BCAST_ADDR, &dst_sin6.sin6_addr); /* should not fail */
> +
> + if (sendto(fd, &payload, sizeof(payload), 0,
> + (struct sockaddr *)&dst_sin6, sizeof(dst_sin6))
> + != sizeof(payload)) {
> + cl_log(LOG_ERR, "sendto(%s) failed: %s",
> + if_name, strerror(errno));
> + goto err;
> + }

Is it valid to assume that there will never be a partial write?

> + status = 0;
> +
> +err:
> + close(fd);
> + return status;
> +}
> +#endif /* HAVE_LIBNET_API */
>
> /* find the network interface associated with an address */
> char*
> @@ -643,7 +760,7 @@
> is_addr6_available(struct in6_addr* addr6)
> {
> struct sockaddr_in6 addr;
> - struct libnet_icmpv6_hdr icmph;
> + struct icmp6_hdr icmph;
> u_char outpack[MINPACKSIZE];
> int icmp_sock;
> int ret;
> @@ -653,11 +770,11 @@
>
> icmp_sock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
> memset(&icmph, 0, sizeof(icmph));
> - icmph.icmp_type = ICMP6_ECHO;
> - icmph.icmp_code = 0;
> - icmph.icmp_sum = 0;
> - icmph.seq = htons(0);
> - icmph.id = 0;
> + icmph.icmp6_type = ICMP6_ECHO_REQUEST;
> + icmph.icmp6_code = 0;
> + icmph.icmp6_cksum = 0;
> + icmph.icmp6_seq = htons(0);
> + icmph.icmp6_id = 0;
>
> memset(&outpack, 0, sizeof(outpack));
> memcpy(&outpack, &icmph, sizeof(icmph));

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

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


keisuke.mori+ha at gmail

Jul 23, 2010, 2:38 AM

Post #3 of 22 (1412 views)
Permalink
Re: [PATCH] IPv6addr: removing libnet dependency [In reply to]

Hi,

2010/7/23 Simon Horman <horms [at] verge>:
> I will add that libnet seems to be more or less unmaintained.
>
> You seem to make using libnet optional, is there a reason
> not to just remove it? portability?

I just thought that some people may want to preserve the existing
behavior. OpenSUSE has libnet shipped with it for example, and I'm not
sure if they would agree to change the implementation or just want to
keep using libnet.

But ok, If no one has objections I'll revise the patch so that it
removes all libnet code from IPv6addr.c and make it single code.
Any other opinions?

As for portability, I believe that the new implementation is
more portable than using libnet. (cf.
http://developerbugs.linux-foundation.org/show_bug.cgi?id=2034#c10)


>> +#define HWADDR_LEN 6 /* mac address length */
>
> Personally I'd prefer the define outside of the function.

Ok, I just wanted to place them closely but no strong preference.
I'll move it to somewhere around the other macro definitions.

>> +     na->nd_na_target = (*src_ip);
>
> There is no need to enclose *src_ip in brackets.

Right. removing the parens.

>> +     if (sendto(fd, &payload, sizeof(payload), 0,
>> +                (struct sockaddr *)&dst_sin6, sizeof(dst_sin6))
>> +         != sizeof(payload)) {

> Is it valid to assume that there will never be a partial write?

I think that reporting an error is just enough when a partial write
occurred here. The packet is very small (32 bytes) and it should
rarely happen, it will be retried 5 times when it occurred, and if it
still fails then it should be considered that "a really bad things"
happened:-) And also the current libnet code does exactly same as
above inside so no behavior would be changed with this code.

Thanks,

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


andrew at beekhof

Jul 23, 2010, 6:04 AM

Post #4 of 22 (1410 views)
Permalink
Re: [PATCH] IPv6addr: removing libnet dependency [In reply to]

On Fri, Jul 23, 2010 at 5:09 AM, Simon Horman <horms [at] verge> wrote:
> On Fri, Jul 23, 2010 at 09:19:44AM +0900, Keisuke MORI wrote:
>> The attached patch is to remove libnet dependency from IPv6addr RA
>> by replacing the same functionality using the standard socket API.
>>
>> Currently there are following problems with resource-agents package:
>>
>>  - IPv6addr RA requires an extra libnet package on the run-time environment.
>>   That is pretty inconvenient particularly for RHEL users because
>>   it's not included in the standard distribution.
>>
>>  - The pre-built RPMs from ClusterLabs does not include IPv6addr RA.
>>   This was once reported in the pacemaker list:
>>   http://www.gossamer-threads.com/lists/linuxha/pacemaker/64295#64295
>>
>> The patch will resolve those issues.
>> I believe that none of Pacemaker/Heartbeat related packages would be
>> depending on libnet library any more after patched.
>
> Hi Mori-san,
>
> I will add that libnet seems to be more or less unmaintained.

Someone recently picked it up again, but I'm in favor of the patch for
the reasons Mori-san already stated.

> You seem to make using libnet optional, is there a reason
> not to just remove it? portability?

Agreed, lets just drop it.
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


lars.ellenberg at linbit

Jul 23, 2010, 6:54 AM

Post #5 of 22 (1406 views)
Permalink
Re: [PATCH] IPv6addr: removing libnet dependency [In reply to]

On Fri, Jul 23, 2010 at 03:04:20PM +0200, Andrew Beekhof wrote:
> On Fri, Jul 23, 2010 at 5:09 AM, Simon Horman <horms [at] verge> wrote:
> > On Fri, Jul 23, 2010 at 09:19:44AM +0900, Keisuke MORI wrote:
> >> The attached patch is to remove libnet dependency from IPv6addr RA
> >> by replacing the same functionality using the standard socket API.
> >>
> >> Currently there are following problems with resource-agents package:
> >>
> >>  - IPv6addr RA requires an extra libnet package on the run-time environment.
> >>   That is pretty inconvenient particularly for RHEL users because
> >>   it's not included in the standard distribution.
> >>
> >>  - The pre-built RPMs from ClusterLabs does not include IPv6addr RA.
> >>   This was once reported in the pacemaker list:
> >>   http://www.gossamer-threads.com/lists/linuxha/pacemaker/64295#64295
> >>
> >> The patch will resolve those issues.
> >> I believe that none of Pacemaker/Heartbeat related packages would be
> >> depending on libnet library any more after patched.
> >
> > Hi Mori-san,
> >
> > I will add that libnet seems to be more or less unmaintained.
>
> Someone recently picked it up again, but I'm in favor of the patch for
> the reasons Mori-san already stated.
>
> > You seem to make using libnet optional, is there a reason
> > not to just remove it? portability?
>
> Agreed, lets just drop it.

Ack.

BTW, is it correct that most of it could be done by "ip", similar as
IPaddr2 does it? The only think missing would be a send_arp v6.
Anyone want to write an IPv6addr2? ;-)

--
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com

DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


horms at verge

Jul 23, 2010, 8:48 PM

Post #6 of 22 (1423 views)
Permalink
Re: [PATCH] IPv6addr: removing libnet dependency [In reply to]

On Fri, Jul 23, 2010 at 03:54:16PM +0200, Lars Ellenberg wrote:
> On Fri, Jul 23, 2010 at 03:04:20PM +0200, Andrew Beekhof wrote:
> > On Fri, Jul 23, 2010 at 5:09 AM, Simon Horman <horms [at] verge> wrote:
> > > On Fri, Jul 23, 2010 at 09:19:44AM +0900, Keisuke MORI wrote:
> > >> The attached patch is to remove libnet dependency from IPv6addr RA
> > >> by replacing the same functionality using the standard socket API.
> > >>
> > >> Currently there are following problems with resource-agents package:
> > >>
> > >>  - IPv6addr RA requires an extra libnet package on the run-time environment.
> > >>   That is pretty inconvenient particularly for RHEL users because
> > >>   it's not included in the standard distribution.
> > >>
> > >>  - The pre-built RPMs from ClusterLabs does not include IPv6addr RA.
> > >>   This was once reported in the pacemaker list:
> > >>   http://www.gossamer-threads.com/lists/linuxha/pacemaker/64295#64295
> > >>
> > >> The patch will resolve those issues.
> > >> I believe that none of Pacemaker/Heartbeat related packages would be
> > >> depending on libnet library any more after patched.
> > >
> > > Hi Mori-san,
> > >
> > > I will add that libnet seems to be more or less unmaintained.
> >
> > Someone recently picked it up again, but I'm in favor of the patch for
> > the reasons Mori-san already stated.
> >
> > > You seem to make using libnet optional, is there a reason
> > > not to just remove it? portability?
> >
> > Agreed, lets just drop it.
>
> Ack.
>
> BTW, is it correct that most of it could be done by "ip", similar as
> IPaddr2 does it? The only think missing would be a send_arp v6.
> Anyone want to write an IPv6addr2? ;-)

I believe that the main objection to using "ip" is that it doesn't exist
outside of Linux.

If you look at the history of IPaddr vs IPaddr2. They are both scripts.
The former is based on ifconfig and route, and is portable. IPaddr2
is based on ip is cleaner and probably has better features. There is
also a compatibility issue because ip aliases aren't exactly the
same as secondary addresses.

If we contrast this to IPv6addr, its cross platform,
and there seems to be no strong argument for new features (at all,
let alone ones that can't be added to the C code).

So no, I don't think there is a strong reason for an "ip" based
IPv6addr2. And I really wish the IPaddr/IPaddr2 situation didn't exist.


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


lars.ellenberg at linbit

Jul 24, 2010, 3:52 AM

Post #7 of 22 (1406 views)
Permalink
Re: [PATCH] IPv6addr: removing libnet dependency [In reply to]

On Sat, Jul 24, 2010 at 12:48:30PM +0900, Simon Horman wrote:
> > > > You seem to make using libnet optional, is there a reason
> > > > not to just remove it? portability?
> > >
> > > Agreed, lets just drop it.
> >
> > Ack.
> >
> > BTW, is it correct that most of it could be done by "ip", similar as
> > IPaddr2 does it? The only think missing would be a send_arp v6.
> > Anyone want to write an IPv6addr2? ;-)
>
> I believe that the main objection to using "ip" is that it doesn't exist
> outside of Linux.
>
> If you look at the history of IPaddr vs IPaddr2.

Yes, I know.

> If we contrast this to IPv6addr, its cross platform,

Oh, I did not realize that.

> So no, I don't think there is a strong reason for an "ip" based
> IPv6addr2. And I really wish the IPaddr/IPaddr2 situation didn't exist.

me too ;-)

--
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com

DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


horms at verge

Jul 24, 2010, 10:01 PM

Post #8 of 22 (1400 views)
Permalink
Re: [PATCH] IPv6addr: removing libnet dependency [In reply to]

On Sat, Jul 24, 2010 at 12:52:26PM +0200, Lars Ellenberg wrote:
> On Sat, Jul 24, 2010 at 12:48:30PM +0900, Simon Horman wrote:
> > > > > You seem to make using libnet optional, is there a reason
> > > > > not to just remove it? portability?
> > > >
> > > > Agreed, lets just drop it.
> > >
> > > Ack.
> > >
> > > BTW, is it correct that most of it could be done by "ip", similar as
> > > IPaddr2 does it? The only think missing would be a send_arp v6.
> > > Anyone want to write an IPv6addr2? ;-)
> >
> > I believe that the main objection to using "ip" is that it doesn't exist
> > outside of Linux.
> >
> > If you look at the history of IPaddr vs IPaddr2.
>
> Yes, I know.

Sorry if I sounded condescending, I know you know that code pretty well :-)

> > If we contrast this to IPv6addr, its cross platform,
>
> Oh, I did not realize that.
>
> > So no, I don't think there is a strong reason for an "ip" based
> > IPv6addr2. And I really wish the IPaddr/IPaddr2 situation didn't exist.
>
> me too ;-)

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


keisuke.mori+ha at gmail

Jul 26, 2010, 2:39 AM

Post #9 of 22 (1388 views)
Permalink
Re: [PATCH] IPv6addr: removing libnet dependency [In reply to]

Hi,

2010/7/23 Lars Ellenberg <lars.ellenberg [at] linbit>:
> On Fri, Jul 23, 2010 at 03:04:20PM +0200, Andrew Beekhof wrote:
>> On Fri, Jul 23, 2010 at 5:09 AM, Simon Horman <horms [at] verge> wrote:
>> > Hi Mori-san,
>> >
>> > I will add that libnet seems to be more or less unmaintained.
>>
>> Someone recently picked it up again, but I'm in favor of the patch for
>> the reasons Mori-san already stated.
>>
>> > You seem to make using libnet optional, is there a reason
>> > not to just remove it? portability?
>>
>> Agreed, lets just drop it.
>
> Ack.

Thanks to Simon, Andrew and Lars for all of your constructive comments.

I've revised the patch so that it drops the old libnet code completely.
Please apply this into the repository.


By the way, do we have any plan to release the next
agents/glue/heartbeat packages from the Linux-HA project?
I think it's good time to consider them for the best use of pacemaker-1.0.9.


> BTW, is it correct that most of it could be done by "ip", similar as
> IPaddr2 does it?  The only think missing would be a send_arp v6.
> Anyone want to write an IPv6addr2? ;-)

"find_if" for IPv6 is also missing if you want to write a script based one.

Thanks,
--
Keisuke MORI
Attachments: IPv6addr-no-libnet-rev2.patch (6.72 KB)


lars.ellenberg at linbit

Jul 26, 2010, 4:21 AM

Post #10 of 22 (1385 views)
Permalink
Re: [PATCH] IPv6addr: removing libnet dependency [In reply to]

On Mon, Jul 26, 2010 at 06:39:50PM +0900, Keisuke MORI wrote:
> I've revised the patch so that it drops the old libnet code completely.
> Please apply this into the repository.
>
>
> By the way, do we have any plan to release the next
> agents/glue/heartbeat packages from the Linux-HA project?
> I think it's good time to consider them for the best use of pacemaker-1.0.9.

I think glue was released by dejan just before he went on vacation,
though the release announcement is missing (1.0.6).

Heartbeat does not have many changes (appart from some cleanup in the
build dependencies), so there is no urge to release a 3.0.4, but we
could do so any time.

Agents has a few fixes, but also has some big changes.
I have to take an other close look, but yes, I think we should release
an agents 1.0.4 within the next few weeks.


> > BTW, is it correct that most of it could be done by "ip", similar as
> > IPaddr2 does it?  The only thing missing would be a send_arp v6.
> > Anyone want to write an IPv6addr2? ;-)
>
> "find_if" for IPv6 is also missing if you want to write a script based one.

I'm sure that can be scripted itself around
ip -o -f inet6 a s | grep ...

but we already sort of agreed that this would
not be development time well spent.

--
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com

DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


horms at verge

Jul 26, 2010, 4:39 AM

Post #11 of 22 (1388 views)
Permalink
Re: [PATCH] IPv6addr: removing libnet dependency [In reply to]

On Mon, Jul 26, 2010 at 06:39:50PM +0900, Keisuke MORI wrote:
> Hi,
>
> 2010/7/23 Lars Ellenberg <lars.ellenberg [at] linbit>:
> > On Fri, Jul 23, 2010 at 03:04:20PM +0200, Andrew Beekhof wrote:
> >> On Fri, Jul 23, 2010 at 5:09 AM, Simon Horman <horms [at] verge> wrote:
> >> > Hi Mori-san,
> >> >
> >> > I will add that libnet seems to be more or less unmaintained.
> >>
> >> Someone recently picked it up again, but I'm in favor of the patch for
> >> the reasons Mori-san already stated.
> >>
> >> > You seem to make using libnet optional, is there a reason
> >> > not to just remove it? portability?
> >>
> >> Agreed, lets just drop it.
> >
> > Ack.
>
> Thanks to Simon, Andrew and Lars for all of your constructive comments.

This change looks good to me.

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


keisuke.mori+ha at gmail

Jul 26, 2010, 11:44 PM

Post #12 of 22 (1376 views)
Permalink
Re: [PATCH] IPv6addr: removing libnet dependency [In reply to]

2010/7/26 Lars Ellenberg <lars.ellenberg [at] linbit>:
> On Mon, Jul 26, 2010 at 06:39:50PM +0900, Keisuke MORI wrote:
>> By the way, do we have any plan to release the next
>> agents/glue/heartbeat packages from the Linux-HA project?
>> I think it's good time to consider them for the best use of pacemaker-1.0.9.
>
> I think glue was released by dejan just before he went on vacation,
> though the release announcement is missing (1.0.6).
>
> Heartbeat does not have many changes (appart from some cleanup in the
> build dependencies), so there is no urge to release a 3.0.4, but we
> could do so any time.
>
> Agents has a few fixes, but also has some big changes.
> I have to take an other close look, but yes, I think we should release
> an agents 1.0.4 within the next few weeks.

Great! Then let's go for the next release for agents/heartbeat along with glue.

My most concern about agents is LF#2378:
http://developerbugs.linux-foundation.org/show_bug.cgi?id=2378
It is a change but it's a necessary change to make the maintenance
mode work fine.

For heartbeat, I personally like "pacemaker on" in ha.cf :)


>> "find_if" for IPv6 is also missing if you want to write a script based one.
>
> I'm sure that can be scripted itself around
> ip -o -f inet6 a s | grep ...
>
> but we already sort of agreed that this would
> not be development time well spent.

find_if does more than just grepping. It has to do matching against
"the network address" calculated from the given address and the prefix
to find out which interface would be appropriate to be assigned the
virtual address. The current IPaddr2 also relies on find_if to do
this.

But anyway, I would also agree that we are not going to develop such.
Just off topic.


Thanks,
--
Keisuke MORI
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


keisuke.mori+ha at gmail

Jul 27, 2010, 12:12 AM

Post #13 of 22 (1378 views)
Permalink
Re: [PATCH] IPv6addr: removing libnet dependency [In reply to]

2010/7/27 Keisuke MORI <keisuke.mori+ha [at] gmail>:
> 2010/7/26 Lars Ellenberg <lars.ellenberg [at] linbit>:
>> On Mon, Jul 26, 2010 at 06:39:50PM +0900, Keisuke MORI wrote:
>> Heartbeat does not have many changes (appart from some cleanup in the
>> build dependencies), so there is no urge to release a 3.0.4, but we
>> could do so any time.
(...)
> For heartbeat, I personally like "pacemaker on" in ha.cf :)


I should have mentioned this too, the version number in the log file
from heartbeat 3.0.3 seems incorrect. I want to fix this soon to avoid
confusion.

----
Jul 20 14:08:50 srv01 heartbeat: [6299]: info: Configuration
validated. Starting heartbeat 3.0.2
----

Thanks,

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


horms at verge

Jul 27, 2010, 2:53 AM

Post #14 of 22 (1378 views)
Permalink
Re: [PATCH] IPv6addr: removing libnet dependency [In reply to]

On Tue, Jul 27, 2010 at 03:44:21PM +0900, Keisuke MORI wrote:
> 2010/7/26 Lars Ellenberg <lars.ellenberg [at] linbit>:
> > On Mon, Jul 26, 2010 at 06:39:50PM +0900, Keisuke MORI wrote:
> >> By the way, do we have any plan to release the next
> >> agents/glue/heartbeat packages from the Linux-HA project?
> >> I think it's good time to consider them for the best use of pacemaker-1.0.9.
> >
> > I think glue was released by dejan just before he went on vacation,
> > though the release announcement is missing (1.0.6).
> >
> > Heartbeat does not have many changes (appart from some cleanup in the
> > build dependencies), so there is no urge to release a 3.0.4, but we
> > could do so any time.
> >
> > Agents has a few fixes, but also has some big changes.
> > I have to take an other close look, but yes, I think we should release
> > an agents 1.0.4 within the next few weeks.
>
> Great! Then let's go for the next release for agents/heartbeat along with glue.
>
> My most concern about agents is LF#2378:
> http://developerbugs.linux-foundation.org/show_bug.cgi?id=2378
> It is a change but it's a necessary change to make the maintenance
> mode work fine.
>
> For heartbeat, I personally like "pacemaker on" in ha.cf :)
>
>
> >> "find_if" for IPv6 is also missing if you want to write a script based one.
> >
> > I'm sure that can be scripted itself around
> > ip -o -f inet6 a s | grep ...
> >
> > but we already sort of agreed that this would
> > not be development time well spent.
>
> find_if does more than just grepping. It has to do matching against
> "the network address" calculated from the given address and the prefix
> to find out which interface would be appropriate to be assigned the
> virtual address. The current IPaddr2 also relies on find_if to do
> this.
>
> But anyway, I would also agree that we are not going to develop such.
> Just off topic.

Personally I think find_if is an abomination to mankind.
But if one really wants such a thing, I wonder if it can be done like this:

ip -o addr show to PREFIX | cut -d ' ' -f 2

Where PREFIX can either be the address to be added:

ip -o addr show to 172.16.4.222/16 | cut -d ' ' -f 2
ip -o addr show to 172.16.4.222 | cut -d ' ' -f 2

Or the network to which the address is to be added:

ip -o addr show to 172.16.0.0/16 | cut -d ' ' -f 2

And this also works with IPv6

ip -o addr show to fe80::20c:76ff:fe24:932/64 | cut -d ' ' -f 2
ip -o addr show to fe80::20c:76ff:fe24:932 | cut -d ' ' -f 2
ip -o addr show to fe80::20c:76ff:0:0/64 | cut -d ' ' -f 2

Although I suspect its schemantics are slightly different that of find_if
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


andrew at beekhof

Jul 27, 2010, 5:07 AM

Post #15 of 22 (1375 views)
Permalink
Re: [PATCH] IPv6addr: removing libnet dependency [In reply to]

On Tue, Jul 27, 2010 at 8:44 AM, Keisuke MORI <keisuke.mori+ha [at] gmail> wrote:
> 2010/7/26 Lars Ellenberg <lars.ellenberg [at] linbit>:
>> On Mon, Jul 26, 2010 at 06:39:50PM +0900, Keisuke MORI wrote:
>>> By the way, do we have any plan to release the next
>>> agents/glue/heartbeat packages from the Linux-HA project?
>>> I think it's good time to consider them for the best use of pacemaker-1.0.9.
>>
>> I think glue was released by dejan just before he went on vacation,
>> though the release announcement is missing (1.0.6).
>>
>> Heartbeat does not have many changes (appart from some cleanup in the
>> build dependencies), so there is no urge to release a 3.0.4, but we
>> could do so any time.
>>
>> Agents has a few fixes, but also has some big changes.
>> I have to take an other close look, but yes, I think we should release
>> an agents 1.0.4 within the next few weeks.
>
> Great! Then let's go for the next release for agents/heartbeat along with glue.
>
> My most concern about agents is LF#2378:
> http://developerbugs.linux-foundation.org/show_bug.cgi?id=2378
> It is a change but it's a necessary change to make the maintenance
> mode work fine.
>
> For heartbeat, I personally like "pacemaker on" in ha.cf :)

One thing thats coming in 1.1.3 is an mcp (master control process) and
associated init script for pacemaker.
This means that Pacemaker is started/stopped independently of the
messaging layer.

Currently this is only written for corosync[1], but I've been toying
with the idea of extending it to Heartbeat.
In which case, if you're already changing the option, you might want
to make it: legacy on/off
Where "off" would be the equivalent of starting with -M (no resource
management) but wouldn't spawn any daemons.

Thoughts?


[1] Which has an API call which allows Pacemaker to prevent Corosync
from shutting down if its still running.
So "service corosync stop" will fail if you didnt already run
"service pacemaker stop"
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


lars.ellenberg at linbit

Jul 27, 2010, 5:13 AM

Post #16 of 22 (1374 views)
Permalink
Re: [PATCH] IPv6addr: removing libnet dependency [In reply to]

On Tue, Jul 27, 2010 at 04:12:34PM +0900, Keisuke MORI wrote:
> 2010/7/27 Keisuke MORI <keisuke.mori+ha [at] gmail>:
> > 2010/7/26 Lars Ellenberg <lars.ellenberg [at] linbit>:
> >> On Mon, Jul 26, 2010 at 06:39:50PM +0900, Keisuke MORI wrote:
> >> Heartbeat does not have many changes (appart from some cleanup in the
> >> build dependencies), so there is no urge to release a 3.0.4, but we
> >> could do so any time.
> (...)
> > For heartbeat, I personally like "pacemaker on" in ha.cf :)
>
>
> I should have mentioned this too, the version number in the log file
> from heartbeat 3.0.3 seems incorrect. I want to fix this soon to avoid
> confusion.
>
> ----
> Jul 20 14:08:50 srv01 heartbeat: [6299]: info: Configuration
> validated. Starting heartbeat 3.0.2

Yes, I know. Not a problem.
Needs to be changed in configure.ac before the 3.0.4 release.

--
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com

DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


horms at verge

Jul 30, 2010, 12:12 AM

Post #17 of 22 (1322 views)
Permalink
Re: [PATCH] IPv6addr: removing libnet dependency [In reply to]

On Mon, Jul 26, 2010 at 08:39:48PM +0900, Simon Horman wrote:
> On Mon, Jul 26, 2010 at 06:39:50PM +0900, Keisuke MORI wrote:
> > Hi,
> >
> > 2010/7/23 Lars Ellenberg <lars.ellenberg [at] linbit>:
> > > On Fri, Jul 23, 2010 at 03:04:20PM +0200, Andrew Beekhof wrote:
> > >> On Fri, Jul 23, 2010 at 5:09 AM, Simon Horman <horms [at] verge> wrote:
> > >> > Hi Mori-san,
> > >> >
> > >> > I will add that libnet seems to be more or less unmaintained.
> > >>
> > >> Someone recently picked it up again, but I'm in favor of the patch for
> > >> the reasons Mori-san already stated.
> > >>
> > >> > You seem to make using libnet optional, is there a reason
> > >> > not to just remove it? portability?
> > >>
> > >> Agreed, lets just drop it.
> > >
> > > Ack.
> >
> > Thanks to Simon, Andrew and Lars for all of your constructive comments.
>
> This change looks good to me.

I have applied the change.

http://hg.linux-ha.org/agents/rev/612e2966f372

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


keisuke.mori+ha at gmail

Jul 30, 2010, 2:42 AM

Post #18 of 22 (1312 views)
Permalink
Re: [PATCH] IPv6addr: removing libnet dependency [In reply to]

2010/7/27 Andrew Beekhof <andrew [at] beekhof>:
> On Tue, Jul 27, 2010 at 8:44 AM, Keisuke MORI <keisuke.mori+ha [at] gmail> wrote:
>> For heartbeat, I personally like "pacemaker on" in ha.cf :)
>
> One thing thats coming in 1.1.3 is an mcp (master control process) and
> associated init script for pacemaker.
> This means that Pacemaker is started/stopped independently of the
> messaging layer.
>
> Currently this is only written for corosync[1], but I've been toying
> with the idea of extending it to Heartbeat.
> In which case, if you're already changing the option, you might want
> to make it: legacy on/off
> Where "off" would be the equivalent of starting with -M (no resource
> management) but wouldn't spawn any daemons.
>
> Thoughts?

I have a several concerns with that change,

1) Is it possible to recover or cause a fail-over correctly when any
of the Pacemaker/Heartbeat process was failed?
(In particular, for the failure of the new mcp process of pacemaker
and for the current heartbeat's MCP process failure)

2) Would the daemons used with respawn directive such as hbagent(SNMP
daemon) or pingd work as compatible?

3) After all, what would be the benefit for end users with the change?
I feel like it's only adding some complexity to the operations and
the diagnostics by the end users.

I guess that I would only use "legacy on" on the heartbeat stack...

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


andrew at beekhof

Jul 30, 2010, 5:18 AM

Post #19 of 22 (1314 views)
Permalink
Re: [PATCH] IPv6addr: removing libnet dependency [In reply to]

On Fri, Jul 30, 2010 at 11:42 AM, Keisuke MORI
<keisuke.mori+ha [at] gmail> wrote:
> 2010/7/27 Andrew Beekhof <andrew [at] beekhof>:
>> On Tue, Jul 27, 2010 at 8:44 AM, Keisuke MORI <keisuke.mori+ha [at] gmail> wrote:
>>> For heartbeat, I personally like "pacemaker on" in ha.cf :)
>>
>> One thing thats coming in 1.1.3 is an mcp (master control process) and
>> associated init script for pacemaker.
>> This means that Pacemaker is started/stopped independently of the
>> messaging layer.
>>
>> Currently this is only written for corosync[1], but I've been toying
>> with the idea of extending it to Heartbeat.
>> In which case, if you're already changing the option, you might want
>> to make it: legacy on/off
>> Where "off" would be the equivalent of starting with -M (no resource
>> management) but wouldn't spawn any daemons.
>>
>> Thoughts?
>
> I have a several concerns with that change,
>
> 1) Is it possible to recover or cause a fail-over correctly when any
> of the Pacemaker/Heartbeat process was failed?
>   (In particular, for the failure of the new mcp process of pacemaker
> and for the current heartbeat's MCP process failure)

If the MCP dies, so will the crmd and cib (and by extension,
everything else except the PE and LRMd).
The types of failures are well tested.

Failure of heartbeat also result in the same types of secondary
failures and recovery as we see now.

>
> 2) Would the daemons used with respawn directive such as hbagent(SNMP
> daemon) or pingd work as compatible?

Pingd will no longer exist in 1.1, if I've not removed it already.
It is completely replaced by ocf:pacemaker:ping

hbagent might have to be a bit smarter about what to do when the cib
isn't around, but otherwise it shouldn't be a problem.

>
> 3) After all, what would be the benefit for end users with the change?

For corosync based clusters its a clear win - we get a much more
reliable startup/shutdown sequence.
Its also far more obvious what is happening at each stage, one can
also stop all resources on a node without taking the node offline.

If we changed it for heartbeat, it would be mostly for consistency.

>   I feel like it's only adding some complexity to the operations and
> the diagnostics by the end users.
>
> I guess that I would only use "legacy on" on the heartbeat stack...

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


lmb at novell

Aug 9, 2010, 3:17 PM

Post #20 of 22 (1211 views)
Permalink
Re: [PATCH] IPv6addr: removing libnet dependency [In reply to]

On 2010-07-30T16:12:24, Simon Horman <horms [at] verge> wrote:

> > This change looks good to me.
> I have applied the change.
>
> http://hg.linux-ha.org/agents/rev/612e2966f372

I've had to commit a small revision, because on IA64, the memory on the
stack is not aligned properly for the cast to struct nd_neighbor_advert
* - http://hg.linux-ha.org/agents/rev/d206bc8f1303

I apologize for the uglyness; it was the only way I could make gcc
shutup and get the alignment right. If someone can make the alignment
properly on the stack, I'm all ears ...


Regards,
Lars

--
Architect Storage/HA, OPS Engineering, Novell, Inc.
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
"Experience is the name everyone gives to their mistakes." -- Oscar Wilde

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


horms at verge

Aug 10, 2010, 8:12 AM

Post #21 of 22 (1199 views)
Permalink
Re: [PATCH] IPv6addr: removing libnet dependency [In reply to]

On Tue, Aug 10, 2010 at 12:17:05AM +0200, Lars Marowsky-Bree wrote:
> On 2010-07-30T16:12:24, Simon Horman <horms [at] verge> wrote:
>
> > > This change looks good to me.
> > I have applied the change.
> >
> > http://hg.linux-ha.org/agents/rev/612e2966f372
>
> I've had to commit a small revision, because on IA64, the memory on the
> stack is not aligned properly for the cast to struct nd_neighbor_advert
> * - http://hg.linux-ha.org/agents/rev/d206bc8f1303
>
> I apologize for the uglyness; it was the only way I could make gcc
> shutup and get the alignment right. If someone can make the alignment
> properly on the stack, I'm all ears ...

You are right, that is a bit ugly.
But I have no better ideas at this time :-(
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


keisuke.mori+ha at gmail

Aug 10, 2010, 7:24 PM

Post #22 of 22 (1200 views)
Permalink
Re: [PATCH] IPv6addr: removing libnet dependency [In reply to]

2010/8/11 Simon Horman <horms [at] verge>:
>> > http://hg.linux-ha.org/agents/rev/612e2966f372
>>
>> I've had to commit a small revision, because on IA64, the memory on the
>> stack is not aligned properly for the cast to struct nd_neighbor_advert
>> * - http://hg.linux-ha.org/agents/rev/d206bc8f1303
>>
>> I apologize for the uglyness; it was the only way I could make gcc
>> shutup and get the alignment right. If someone can make the alignment
>> properly on the stack, I'm all ears ...
>
> You are right, that is a bit ugly.
> But I have no better ideas at this time :-(

How about this patch or along this line?
It assumes GCC but ICC should have a similar feature if you want to support it.

Alternatively, having an union with an u_int8_t array and a struct
should make an alignment correctly, I think.

--
Keisuke MORI
Attachments: ipv6addr-alignment.patch (3.10 KB)

Linux-HA dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.