The get_in6() API defined in netdev-provider.h requires the return of error values when the 'netdev' has no assigned IPv6 address or the 'netdev' does not support IPv6. However, the netdev_linux_get_in6() implementation does not follow this (always return 0). And this causes the a bug in deleting vlan interfaces created for vlan splinter.
This commit makes netdev_linux_get_in6() conform to the API definition and returns the specified error value when failing to get IPv6 address. VMware-BZ: #1485521 Reported-by: Ronald Lee <ronald...@vmware.com> Signed-off-by: Alex Wang <al...@nicira.com> --- lib/netdev-linux.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 18a1399..1dd1f4c 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -2439,12 +2439,14 @@ parse_if_inet6_line(const char *line, ifname); } -/* If 'netdev' has an assigned IPv6 address, sets '*in6' to that address (if - * 'in6' is non-null) and returns true. Otherwise, returns false. */ +/* If 'netdev' has an assigned IPv6 address, sets '*in6' to that address. + * Otherwise, sets '*in6' to 'in6addr_any' and returns the corresponding + * error. */ static int netdev_linux_get_in6(const struct netdev *netdev_, struct in6_addr *in6) { struct netdev_linux *netdev = netdev_linux_cast(netdev_); + int error = 0; ovs_mutex_lock(&netdev->mutex); if (!(netdev->cache_valid & VALID_IN6)) { @@ -2463,17 +2465,20 @@ netdev_linux_get_in6(const struct netdev *netdev_, struct in6_addr *in6) && !strcmp(name, ifname)) { netdev->in6 = in6_tmp; + netdev->cache_valid |= VALID_IN6; break; } } + error = (netdev->cache_valid & VALID_IN6) ? 0 : EADDRNOTAVAIL; fclose(file); + } else { + error = EOPNOTSUPP; } - netdev->cache_valid |= VALID_IN6; } *in6 = netdev->in6; ovs_mutex_unlock(&netdev->mutex); - return 0; + return error; } static void -- 1.7.9.5 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev