All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 11df5f06 authored by Alex Wang's avatar Alex Wang

netdev-linux: Make netdev_linux_get_in6() conform to API definition.

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

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: default avatarRonald Lee <>
Signed-off-by: default avatarAlex Wang <>
Acked-by: default avatarBen Pfaff <>
parent 4bf22388
......@@ -458,6 +458,7 @@ struct netdev_linux {
int netdev_policing_error; /* Cached error code from set policing. */
int get_features_error; /* Cached error code from ETHTOOL_GSET. */
int get_ifindex_error; /* Cached error code from SIOCGIFINDEX. */
int in6_error; /* Cached error code from reading in6 addr. */
enum netdev_features current; /* Cached from ETHTOOL_GSET. */
enum netdev_features advertised; /* Cached from ETHTOOL_GSET. */
......@@ -2481,12 +2482,14 @@ parse_if_inet6_line(const char *line,
/* 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;
if (!(netdev->cache_valid & VALID_IN6)) {
......@@ -2494,6 +2497,7 @@ netdev_linux_get_in6(const struct netdev *netdev_, struct in6_addr *in6)
char line[128];
netdev->in6 = in6addr_any;
netdev->in6_error = EADDRNOTAVAIL;
file = fopen("/proc/net/if_inet6", "r");
if (file != NULL) {
......@@ -2505,17 +2509,21 @@ netdev_linux_get_in6(const struct netdev *netdev_, struct in6_addr *in6)
&& !strcmp(name, ifname))
netdev->in6 = in6_tmp;
netdev->in6_error = 0;
} else {
netdev->in6_error = EOPNOTSUPP;
netdev->cache_valid |= VALID_IN6;
*in6 = netdev->in6;
error = netdev->in6_error;
return 0;
return error;
static void
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment