Skip to content

Commit

Permalink
Merge branch 'bmk/kernel/20241119/27/net_getifaddrs_no_running_flag/O…
Browse files Browse the repository at this point in the history
…TP-19366'
  • Loading branch information
bmk committed Nov 27, 2024
2 parents 6583ba7 + 9ecfd47 commit 4e55a43
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 50 deletions.
26 changes: 4 additions & 22 deletions erts/emulator/nifs/common/prim_net_nif.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions erts/emulator/nifs/common/prim_socket_nif.c
Original file line number Diff line number Diff line change
Expand Up @@ -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); \
Expand All @@ -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); \
Expand Down
2 changes: 2 additions & 0 deletions erts/emulator/nifs/common/socket_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -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); \
Expand All @@ -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); \
Expand Down
Binary file modified erts/preloaded/ebin/prim_net.beam
Binary file not shown.
7 changes: 1 addition & 6 deletions erts/preloaded/src/prim_net.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
50 changes: 28 additions & 22 deletions lib/kernel/src/net.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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),
Expand Down Expand Up @@ -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 =
Expand All @@ -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),
Expand Down

0 comments on commit 4e55a43

Please sign in to comment.