diff --git a/erts/emulator/nifs/common/prim_net_nif.c b/erts/emulator/nifs/common/prim_net_nif.c index 579e5c7b0e51..fb927d7d7573 100644 --- a/erts/emulator/nifs/common/prim_net_nif.c +++ b/erts/emulator/nifs/common/prim_net_nif.c @@ -3449,28 +3449,10 @@ ERL_NIF_TERM encode_if_admin_status(ErlNifEnv* env, { ERL_NIF_TERM estatus; - switch (status) { - case IF_OPER_STATUS_NON_OPERATIONAL: - estatus = atom_non_operational; - break; - case IF_OPER_STATUS_UNREACHABLE: - estatus = atom_unreachable; - break; - case IF_OPER_STATUS_DISCONNECTED: - estatus = atom_disconnected; - break; - case IF_OPER_STATUS_CONNECTING: - estatus = esock_atom_connecting; - break; - case IF_OPER_STATUS_CONNECTED: - estatus = esock_atom_connected; - break; - case IF_OPER_STATUS_OPERATIONAL: - estatus = atom_operational; - break; - default: - estatus = MKUI(env, status); - break; + if (status) { + estatus = esock_atom_enabled; + } else { + estatus = esock_atom_disabled; } return estatus; diff --git a/erts/emulator/nifs/common/prim_socket_nif.c b/erts/emulator/nifs/common/prim_socket_nif.c index d6e0ca437979..3fe99af5f71b 100644 --- a/erts/emulator/nifs/common/prim_socket_nif.c +++ b/erts/emulator/nifs/common/prim_socket_nif.c @@ -2029,6 +2029,7 @@ static const struct in6_addr in6addr_loopback = GLOBAL_ATOM_DECL(delayed_ack_time); \ GLOBAL_ATOM_DECL(dgram); \ GLOBAL_ATOM_DECL(dhcprunning); \ + GLOBAL_ATOM_DECL(disabled); \ GLOBAL_ATOM_DECL(disable_fragments); \ GLOBAL_ATOM_DECL(dlci); \ GLOBAL_ATOM_DECL(dma); \ @@ -2047,6 +2048,7 @@ static const struct in6_addr in6addr_loopback = GLOBAL_ATOM_DECL(eether); \ GLOBAL_ATOM_DECL(efile); \ GLOBAL_ATOM_DECL(egp); \ + GLOBAL_ATOM_DECL(enabled); \ GLOBAL_ATOM_DECL(enotsup); \ GLOBAL_ATOM_DECL(eor); \ GLOBAL_ATOM_DECL(error); \ diff --git a/erts/emulator/nifs/common/socket_int.h b/erts/emulator/nifs/common/socket_int.h index 4a27c6d0f2de..ac0492202f53 100644 --- a/erts/emulator/nifs/common/socket_int.h +++ b/erts/emulator/nifs/common/socket_int.h @@ -285,6 +285,7 @@ typedef long ssize_t; GLOBAL_ATOM_DEF(delayed_ack_time); \ GLOBAL_ATOM_DEF(dgram); \ GLOBAL_ATOM_DEF(dhcprunning); \ + GLOBAL_ATOM_DEF(disabled); \ GLOBAL_ATOM_DEF(disable_fragments); \ GLOBAL_ATOM_DEF(dlci); \ GLOBAL_ATOM_DEF(dma); \ @@ -303,6 +304,7 @@ typedef long ssize_t; GLOBAL_ATOM_DEF(eether); \ GLOBAL_ATOM_DEF(efile); \ GLOBAL_ATOM_DEF(egp); \ + GLOBAL_ATOM_DEF(enabled); \ GLOBAL_ATOM_DEF(enotsup); \ GLOBAL_ATOM_DEF(eor); \ GLOBAL_ATOM_DEF(error); \ diff --git a/erts/preloaded/ebin/prim_net.beam b/erts/preloaded/ebin/prim_net.beam index 62ce59d5fe07..a67b1c49faa1 100644 Binary files a/erts/preloaded/ebin/prim_net.beam and b/erts/preloaded/ebin/prim_net.beam differ diff --git a/erts/preloaded/src/prim_net.erl b/erts/preloaded/src/prim_net.erl index 7dc3b0b5f7bf..d90b9dcbc372 100644 --- a/erts/preloaded/src/prim_net.erl +++ b/erts/preloaded/src/prim_net.erl @@ -112,12 +112,7 @@ -type if_type() :: other | ethernet_csmacd | iso88025_tokenring | fddi | ppp | software_loopback | atm | ieee80211 | tunnel | ieee1394 | ieee80216_wman | wwanpp | wwanpp2. --type if_admin_status() :: non_operational | - unreachable | - disconnected | - connecting | connected | - operational | - non_neg_integer(). +-type if_admin_status() :: enabled | disabled. -type internal_if_oper_status() :: non_operational | unreachable | disconnected | diff --git a/lib/kernel/src/net.erl b/lib/kernel/src/net.erl index 5804408bd57c..a62933c2195d 100644 --- a/lib/kernel/src/net.erl +++ b/lib/kernel/src/net.erl @@ -593,7 +593,7 @@ win_getifaddrs_iat3(Name, bcast_addr := _BCastAddr} = _IpAddr, #{type := Type, admin_status := AStatus, - internal_oper_status := _OStatus, + internal_oper_status := OStatus, phys_addr := PhysAddr, index := Idx} = _IfEntry) -> Flags1 = case Type of @@ -605,16 +605,19 @@ win_getifaddrs_iat3(Name, [] end, Flags2 = case AStatus of - non_operational -> - []; - connecting -> - [up, pointtopoint]; - connected -> - [up, runnning, pointtopoint]; - operational -> - [up, running]; - _ -> - [up] + enabled -> + case OStatus of + connecting -> + [up, pointtopoint]; + connected -> + [up, runnning, pointtopoint]; + operational -> + [up, running]; + _ -> + [up] + end; + disabled -> + [] end, Flags = lists:sort(Flags1 ++ Flags2), HaType = type2hatype(Type), @@ -690,7 +693,7 @@ win_getifaddrs_aa3(Name, prefixes := Prefixes} = _AdAddrs, #{type := Type, admin_status := AStatus, - internal_oper_status := _OStatus, + internal_oper_status := OStatus, phys_addr := PhysAddr, index := Idx} = _IfEntry) -> Flags1 = @@ -708,16 +711,19 @@ win_getifaddrs_aa3(Name, [] end, Flags3 = case AStatus of - non_operational -> - []; - connecting -> - [up, pointtopoint]; - connected -> - [up, runnning, pointtopoint]; - operational -> - [up, running]; - _ -> - [up] + enabled -> + case OStatus of + connecting -> + [up, pointtopoint]; + connected -> + [up, runnning, pointtopoint]; + operational -> + [up, running]; + _ -> + [up] + end; + disabled -> + [] end, Flags = lists:sort(Flags1 ++ Flags2 ++ Flags3), HaType = type2hatype(Type),