Hello Martin!

Thanks for your bug report.

On Wed, Nov 18, 2009 at 06:56:10PM +0100, martin f krafft wrote:
> The following is correct syntax according to manpage and
> http://lartc.org/howto/lartc.rpdb.multiple-links.html#AEN298, but it
> doesn't seem to work for ipv6:
> 
> # ip -6 route add default nexthop via 2001:470:25:94::1 weight 1 nexthop via 
> 2001:41e0:ff00:47::1 weight 1
> Error: an IP address is expected rather than "2001:470:25:94::1"
> 

I think the problematic function has been located but I don't know if the
attached patch is the correct solution, your testing would be appreciated.

-- 
Andreas Henriksson
diff --git a/ip/iproute.c b/ip/iproute.c
index bf0f31b..20fce76 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -609,9 +609,14 @@ int parse_one_nh(struct rtattr *rta, struct rtnexthop *rtnh, int *argcp, char **
 
 	while (++argv, --argc > 0) {
 		if (strcmp(*argv, "via") == 0) {
+			inet_prefix addr;
+
 			NEXT_ARG();
-			rta_addattr32(rta, 4096, RTA_GATEWAY, get_addr32(*argv));
-			rtnh->rtnh_len += sizeof(struct rtattr) + 4;
+
+			get_addr(&addr, *argv, AF_UNSPEC);
+			rta_addattr_l(rta, 4096, RTA_GATEWAY,
+					addr.data, addr.bytelen);
+			rtnh->rtnh_len += sizeof(struct rtattr) + addr.bytelen;
 		} else if (strcmp(*argv, "dev") == 0) {
 			NEXT_ARG();
 			if ((rtnh->rtnh_ifindex = ll_name_to_index(*argv)) == 0) {

Attachment: signature.asc
Description: Digital signature

Reply via email to