ClusterLabs/resource-agents — pull request #97 by kskmori (2012-05-31 06:20:00+00:00)
Title: [RFC] IPaddr2: Proposal patch to support the dual stack of IPv4 and IPv6.

This is a proposal enhancement of IPaddr2 to support IPv6 as well as IPv4.

I would appreciate your comments and suggestions for merging this into the upstream.

NOTE: This pull request is meant for reviewing the code and discussions, and not intended to be merged as is at this moment.

## Benefits:

* Unify the usage, behavior and the code maintenance between IPv4 and IPv6 on Linux.

The usage of IPaddr2 and IPv6addr are similar but they have different parameters and different behaviors.　In particular, they may choose a different interface depending on your configuration even if you provided similar parameters in the past.

IPv6addr is written in C and rather hard to make improvements. As /bin/ip already supports both IPv4 and IPv6, we can share the most of the code of IPaddr2 written in bash.

* usable for LVS on IPv6.

IPv6addr does not support lvs_support=true and unfortunately there is no possible way to use LVS on IPv6 right now.

IPaddr2(/bin/ip) works for LVS configurations without enabling lvs_support both for IPv4 and IPv6.

(You don't have to remove an address on the loopback interface if the virtual address is assigned by using /bin/ip.)

See also:
http://www.gossamer-threads.com/lists/linuxha/dev/76429#76429

* retire the old 'findif' binary.

'findif' binary is replaced by a shell script version of findif, originally developed by lge.
See ClusterLabs/resource-agents#53 : findif could be rewritten in shell

* easier support for other pending issues

These pending issues can be fix based on this new IPaddr2.
* ClusterLabs/resource-agents#68 : Allow ipv6addr to mark new address as deprecated
* ClusterLabs/resource-agents#77 : New RA that controls IPv6 address in loopback interface

## Notes / Changes:

* findif semantics changes

There are some incompatibility in deciding which interface to be used when your configuration is ambiguous. But in reality it should not be a problem as long as it's configured properly.

The changes mostly came from fixing a bug in the findif binary (returns a wrong broadcast) or merging the difference between (old)IPaddr2 and IPv6addr.
See the ofct test cases for details. (case No.6, No.9, No.10, No.12, No.15 in IPaddr2v4 test cases)

Other notable changes are described below.

* "broadcast" parameter for IPv4

"broadcast" parameter may be required along with "cidr_netmask" when you want use a different subnet mask from the static IP address. It's because doing such calculation is difficult in the shell
script version of findif.

See the ofct test cases for details. (case No.11, No.14, No.16, No.17 in IPaddr2v4 test cases)

This limitation may be eliminated if we would remove brd options from the /bin/ip command line.

* loopback(lo) now requires cidr_netmask or broadcast.

See the ofct test case in the IPaddr2 ocft script. The reason is similar to the previous one.

* loose error check for "nic" for a IPv6 link-local address.

IPv6addr was able to check this, but in the shell script it is hard to determine a link-local address (requires bitmask calculation). I do not think it's worth to implement it in shell.

* send_ua: a new binary

We need one new binary as a replacement of send_arp for IPv6 support. IPv6addr.c is reused to make this command.

Note that IPv6addr RA is still there and you can continue to use it for the backward compatibility.

## Acknowledgement

Thanks to Tomo Nozawa-san for his hard work for writing and testing this patch.

Thanks to Lars Ellenberg for the first findif.sh implementation.