diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2023-03-03 14:15:15 +0100 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2023-03-03 14:15:15 +0100 |
| commit | 5267a864db5717d61465d6bb73ee8005f3568c9f (patch) | |
| tree | e41d3f0be186ed050da102f064ed545e73dc2047 /core/net/interface_linux.odin | |
| parent | f02334237a055f8da5bb795032c872e555abaec7 (diff) | |
Coalesce more.
Diffstat (limited to 'core/net/interface_linux.odin')
| -rw-r--r-- | core/net/interface_linux.odin | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/core/net/interface_linux.odin b/core/net/interface_linux.odin index 255a96f0b..e889cfa97 100644 --- a/core/net/interface_linux.odin +++ b/core/net/interface_linux.odin @@ -24,10 +24,8 @@ package net import "core:os" import "core:strings" -/* - `enumerate_interfaces` retrieves a list of network interfaces with their associated properties. -*/ -enumerate_interfaces :: proc(allocator := context.allocator) -> (interfaces: []Network_Interface, err: Network_Error) { +@(private) +_enumerate_interfaces :: proc(allocator := context.allocator) -> (interfaces: []Network_Interface, err: Network_Error) { context.allocator = allocator head: ^os.ifaddrs @@ -40,7 +38,6 @@ enumerate_interfaces :: proc(allocator := context.allocator) -> (interfaces: []N Unlike Windows, *nix regrettably doesn't return all it knows about an interface in one big struct. We're going to have to iterate over a list and coalesce information as we go. */ - ifaces: map[string]^Network_Interface defer delete(ifaces) @@ -67,7 +64,7 @@ enumerate_interfaces :: proc(allocator := context.allocator) -> (interfaces: []N case os.AF_PACKET: /* - For some obscure reason the 64-bit `getifaddrs` calls returns a pointer to a + For some obscure reason the 64-bit `getifaddrs` call returns a pointer to a 32-bit `RTNL_LINK_STATS` structure, which of course means that tx/rx byte count is truncated beyond usefulness. @@ -123,7 +120,6 @@ enumerate_interfaces :: proc(allocator := context.allocator) -> (interfaces: []N if .LOOPBACK in ifaddr.flags { state |= {.Loopback} } - iface.link.state = state } @@ -140,6 +136,5 @@ enumerate_interfaces :: proc(allocator := context.allocator) -> (interfaces: []N append(&_interfaces, iface^) free(iface) } - return _interfaces[:], {} }
\ No newline at end of file |