Closed cgzones closed 1 year ago
Hi @cgzones, I apologize for the delay. Have you taken a look at the route listing example in the examples directory? I'll gladly investigate this further, but last time I tested that, it had no errors fetching the routes.
Is this still relevant?
Yes, it is.
The netlink response is received (by a forked thread) but not returned in the iterator of the send
result.
Maybe src/router/synchronous.rs:spawn_processing_thread()
mishandles the channels?
Example trace output (with some adjusted logging):
2023-08-15T15:08:39.947Z INFO [local_ip_address::linux] Created rt message: Rtmsg { rtm_family: Inet, rtm_dst_len: 32, rtm_src_len: 0, rtm_tos: 0, rtm_table: Unspec, rtm_protocol: Unspec, rtm_scope: Universe, rtm_type: Unspec, rtm_flags: RtmF(4096), rtattrs: RtBuffer([Rtattr { rta_len: 8, rta_type: Dst, rta_payload: Buffer }]) }
2023-08-15T15:08:39.947Z DEBUG [neli::socket::synchronous] Message sent:
Nlmsghdr { nl_len: 36, nl_type: Getroute, nl_flags: NlmF(1), nl_seq: 0, nl_pid: 67661, nl_payload: Payload(Rtmsg { rtm_family: Inet, rtm_dst_len: 32, rtm_src_len: 0, rtm_tos: 0, rtm_table: Unspec, rtm_protocol: Unspec, rtm_scope: Universe, rtm_type: Unspec, rtm_flags: RtmF(4096), rtattrs: RtBuffer([Rtattr { rta_len: 8, rta_type: Dst, rta_payload: Buffer }]) }) }
2023-08-15T15:08:39.947Z INFO [local_ip_address::linux] Send rt message
2023-08-15T15:08:39.947Z TRACE [neli::utils::synchronous] Semaphore acquired; current count is 1, available is 2
2023-08-15T15:08:39.947Z TRACE [neli::socket::synchronous] Buffer received: [112, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 77, 8, 1, 0, 2, 32, 0, 0, 254, 0, 0, 1, 0, 2, 0, 0, 8, 0, 15, 0, 254, 0, 0, 0, 8, 0, 1, 0, 192, 0, 2, 0, 8, 0, 4, 0, 2, 0, 0, 0, 8, 0, 7, 0, 192, 168, 24, 24, 8, 0, 5, 0, 192, 168, 24, 200, 8, 0, 25, 0, 232, 3, 0, 0, 36, 0, 12, 0, 2, 0, 0, 0, 106, 156, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
2023-08-15T15:08:39.947Z DEBUG [neli::iter] next() called
2023-08-15T15:08:39.947Z TRACE [neli::nl] Deserializing data type Nlmsghdr
2023-08-15T15:08:39.947Z TRACE [neli::nl] Deserializing field type u32
2023-08-15T15:08:39.947Z TRACE [neli::nl] Buffer to be deserialized: [112, 0, 0, 0]
2023-08-15T15:08:39.947Z TRACE [neli::nl] Field deserialized: 112
2023-08-15T15:08:39.947Z TRACE [neli::nl] Deserializing field type u16
2023-08-15T15:08:39.947Z TRACE [neli::nl] Buffer to be deserialized: [24, 0]
2023-08-15T15:08:39.947Z TRACE [neli::nl] Field deserialized: 24
2023-08-15T15:08:39.947Z TRACE [neli::nl] Deserializing field type neli::consts::nl::NlmF
2023-08-15T15:08:39.947Z TRACE [neli::nl] Buffer to be deserialized: [0, 0]
2023-08-15T15:08:39.947Z TRACE [neli::consts::nl] Deserializing data type NlmF
2023-08-15T15:08:39.947Z TRACE [neli::consts::nl] Deserializing field type u16
2023-08-15T15:08:39.947Z TRACE [neli::consts::nl] Buffer to be deserialized: [0, 0]
2023-08-15T15:08:39.947Z TRACE [neli::consts::nl] Field deserialized: 0
2023-08-15T15:08:39.947Z TRACE [neli::nl] Field deserialized: NlmF(0)
2023-08-15T15:08:39.947Z TRACE [neli::nl] Deserializing field type u32
2023-08-15T15:08:39.947Z TRACE [neli::nl] Buffer to be deserialized: [0, 0, 0, 0]
2023-08-15T15:08:39.947Z TRACE [neli::nl] Field deserialized: 0
2023-08-15T15:08:39.947Z TRACE [neli::nl] Deserializing field type u32
2023-08-15T15:08:39.947Z TRACE [neli::nl] Buffer to be deserialized: [77, 8, 1, 0]
2023-08-15T15:08:39.947Z TRACE [neli::nl] Field deserialized: 67661
2023-08-15T15:08:39.947Z TRACE [neli::nl] Deserializing field type neli::nl::NlPayload<u16, neli::types::Buffer>
2023-08-15T15:08:39.947Z TRACE [neli::nl] Buffer to be deserialized: [2, 32, 0, 0, 254, 0, 0, 1, 0, 2, 0, 0, 8, 0, 15, 0, 254, 0, 0, 0, 8, 0, 1, 0, 192, 0, 2, 0, 8, 0, 4, 0, 2, 0, 0, 0, 8, 0, 7, 0, 192, 168, 24, 24, 8, 0, 5, 0, 192, 168, 24, 200, 8, 0, 25, 0, 232, 3, 0, 0, 36, 0, 12, 0, 2, 0, 0, 0, 106, 156, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
2023-08-15T15:08:39.947Z TRACE [neli::nl] Deserializing data type neli::nl::NlPayload<u16, neli::types::Buffer>
2023-08-15T15:08:39.947Z TRACE [neli::types] Deserializing data type Buffer
2023-08-15T15:08:39.947Z TRACE [neli::types] Deserializing field type alloc::vec::Vec<u8>
2023-08-15T15:08:39.947Z TRACE [neli::types] Buffer to be deserialized: [2, 32, 0, 0, 254, 0, 0, 1, 0, 2, 0, 0, 8, 0, 15, 0, 254, 0, 0, 0, 8, 0, 1, 0, 192, 0, 2, 0, 8, 0, 4, 0, 2, 0, 0, 0, 8, 0, 7, 0, 192, 168, 24, 24, 8, 0, 5, 0, 192, 168, 24, 200, 8, 0, 25, 0, 232, 3, 0, 0, 36, 0, 12, 0, 2, 0, 0, 0, 106, 156, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
2023-08-15T15:08:39.947Z TRACE [neli::types] Field deserialized: [2, 32, 0, 0, 254, 0, 0, 1, 0, 2, 0, 0, 8, 0, 15, 0, 254, 0, 0, 0, 8, 0, 1, 0, 192, 0, 2, 0, 8, 0, 4, 0, 2, 0, 0, 0, 8, 0, 7, 0, 192, 168, 24, 24, 8, 0, 5, 0, 192, 168, 24, 200, 8, 0, 25, 0, 232, 3, 0, 0, 36, 0, 12, 0, 2, 0, 0, 0, 106, 156, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
2023-08-15T15:08:39.947Z TRACE [neli::nl] Field deserialized: Payload(Buffer)
2023-08-15T15:08:39.947Z DEBUG [neli::iter] Message received3: Nlmsghdr { nl_len: 112, nl_type: 24, nl_flags: NlmF(0), nl_seq: 0, nl_pid: 67661, nl_payload: Payload(Buffer) }
2023-08-15T15:08:39.947Z DEBUG [neli::iter] next() finished, got: Some(Ok(Nlmsghdr { nl_len: 112, nl_type: 24, nl_flags: NlmF(0), nl_seq: 0, nl_pid: 67661, nl_payload: Payload(Buffer) }))
2023-08-15T15:08:39.947Z TRACE [neli::router::synchronous] Message received1: Ok(Nlmsghdr { nl_len: 112, nl_type: 24, nl_flags: NlmF(0), nl_seq: 0, nl_pid: 67661, nl_payload: Payload(Buffer) })
2023-08-15T15:08:39.947Z DEBUG [neli::iter] next() called
2023-08-15T15:08:39.947Z DEBUG [neli::iter] next() finished, got: None
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Deserializing data type Rtmsg
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Deserializing field type neli::consts::rtnl::RtAddrFamily
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Buffer to be deserialized: [2]
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Field deserialized: Inet
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Deserializing field type u8
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Buffer to be deserialized: [32]
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Field deserialized: 32
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Deserializing field type u8
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Buffer to be deserialized: [0]
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Field deserialized: 0
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Deserializing field type u8
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Buffer to be deserialized: [0]
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Field deserialized: 0
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Deserializing field type neli::consts::rtnl::RtTable
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Buffer to be deserialized: [254]
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Field deserialized: Main
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Deserializing field type neli::consts::rtnl::Rtprot
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Buffer to be deserialized: [0]
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Field deserialized: Unspec
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Deserializing field type neli::consts::rtnl::RtScope
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Buffer to be deserialized: [0]
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Field deserialized: Universe
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Deserializing field type neli::consts::rtnl::Rtn
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Buffer to be deserialized: [1]
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Field deserialized: Unicast
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Deserializing field type neli::consts::rtnl::RtmF
2023-08-15T15:08:39.947Z TRACE [neli::rtnl] Buffer to be deserialized: [0, 2, 0, 0]
2023-08-15T15:08:39.947Z TRACE [neli::consts::rtnl] Deserializing data type RtmF
2023-08-15T15:08:39.948Z TRACE [neli::consts::rtnl] Deserializing field type u32
2023-08-15T15:08:39.948Z TRACE [neli::consts::rtnl] Buffer to be deserialized: [0, 2, 0, 0]
2023-08-15T15:08:39.948Z TRACE [neli::consts::rtnl] Field deserialized: 512
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Field deserialized: RtmF(512)
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing field type neli::types::RtBuffer<neli::consts::rtnl::Rta, neli::types::Buffer>
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Buffer to be deserialized: [8, 0, 15, 0, 254, 0, 0, 0, 8, 0, 1, 0, 192, 0, 2, 0, 8, 0, 4, 0, 2, 0, 0, 0, 8, 0, 7, 0, 192, 168, 24, 24, 8, 0, 5, 0, 192, 168, 24, 200, 8, 0, 25, 0, 232, 3, 0, 0, 36, 0, 12, 0, 2, 0, 0, 0, 106, 156, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
2023-08-15T15:08:39.948Z TRACE [neli::types] Deserializing data type RtBuffer
2023-08-15T15:08:39.948Z TRACE [neli::types] Deserializing field type alloc::vec::Vec<neli::rtnl::Rtattr<neli::consts::rtnl::Rta, neli::types::Buffer>>
2023-08-15T15:08:39.948Z TRACE [neli::types] Buffer to be deserialized: [8, 0, 15, 0, 254, 0, 0, 0, 8, 0, 1, 0, 192, 0, 2, 0, 8, 0, 4, 0, 2, 0, 0, 0, 8, 0, 7, 0, 192, 168, 24, 24, 8, 0, 5, 0, 192, 168, 24, 200, 8, 0, 25, 0, 232, 3, 0, 0, 36, 0, 12, 0, 2, 0, 0, 0, 106, 156, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing data type Rtattr
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing field type u16
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Buffer to be deserialized: [8, 0]
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Field deserialized: 8
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing field type neli::consts::rtnl::Rta
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Buffer to be deserialized: [15, 0]
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Field deserialized: Table
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing field type neli::types::Buffer
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Buffer to be deserialized: [254, 0, 0, 0]
2023-08-15T15:08:39.948Z TRACE [neli::types] Deserializing data type Buffer
2023-08-15T15:08:39.948Z TRACE [neli::types] Deserializing field type alloc::vec::Vec<u8>
2023-08-15T15:08:39.948Z TRACE [neli::types] Buffer to be deserialized: [254, 0, 0, 0]
2023-08-15T15:08:39.948Z TRACE [neli::types] Field deserialized: [254, 0, 0, 0]
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Field deserialized: Buffer
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing data type Rtattr
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing field type u16
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Buffer to be deserialized: [8, 0]
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Field deserialized: 8
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing field type neli::consts::rtnl::Rta
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Buffer to be deserialized: [1, 0]
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Field deserialized: Dst
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing field type neli::types::Buffer
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Buffer to be deserialized: [192, 0, 2, 0]
2023-08-15T15:08:39.948Z TRACE [neli::types] Deserializing data type Buffer
2023-08-15T15:08:39.948Z TRACE [neli::types] Deserializing field type alloc::vec::Vec<u8>
2023-08-15T15:08:39.948Z TRACE [neli::types] Buffer to be deserialized: [192, 0, 2, 0]
2023-08-15T15:08:39.948Z TRACE [neli::types] Field deserialized: [192, 0, 2, 0]
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Field deserialized: Buffer
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing data type Rtattr
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing field type u16
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Buffer to be deserialized: [8, 0]
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Field deserialized: 8
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing field type neli::consts::rtnl::Rta
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Buffer to be deserialized: [4, 0]
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Field deserialized: Oif
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing field type neli::types::Buffer
2023-08-15T15:08:39.948Z TRACE [neli::utils::synchronous] Semaphore released; current count is 0, available is 3
2023-08-15T15:08:39.948Z TRACE [neli::utils::synchronous] Semaphore acquired; current count is 1, available is 2
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Buffer to be deserialized: [2, 0, 0, 0]
2023-08-15T15:08:39.948Z TRACE [neli::types] Deserializing data type Buffer
2023-08-15T15:08:39.948Z TRACE [neli::types] Deserializing field type alloc::vec::Vec<u8>
2023-08-15T15:08:39.948Z TRACE [neli::types] Buffer to be deserialized: [2, 0, 0, 0]
2023-08-15T15:08:39.948Z TRACE [neli::types] Field deserialized: [2, 0, 0, 0]
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Field deserialized: Buffer
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing data type Rtattr
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing field type u16
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Buffer to be deserialized: [8, 0]
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Field deserialized: 8
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing field type neli::consts::rtnl::Rta
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Buffer to be deserialized: [7, 0]
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Field deserialized: Prefsrc
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing field type neli::types::Buffer
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Buffer to be deserialized: [192, 168, 24, 24]
2023-08-15T15:08:39.948Z TRACE [neli::types] Deserializing data type Buffer
2023-08-15T15:08:39.948Z TRACE [neli::types] Deserializing field type alloc::vec::Vec<u8>
2023-08-15T15:08:39.948Z TRACE [neli::types] Buffer to be deserialized: [192, 168, 24, 24]
2023-08-15T15:08:39.948Z TRACE [neli::types] Field deserialized: [192, 168, 24, 24]
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Field deserialized: Buffer
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing data type Rtattr
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing field type u16
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Buffer to be deserialized: [8, 0]
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Field deserialized: 8
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing field type neli::consts::rtnl::Rta
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Buffer to be deserialized: [5, 0]
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Field deserialized: Gateway
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing field type neli::types::Buffer
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Buffer to be deserialized: [192, 168, 24, 200]
2023-08-15T15:08:39.948Z TRACE [neli::types] Deserializing data type Buffer
2023-08-15T15:08:39.948Z TRACE [neli::types] Deserializing field type alloc::vec::Vec<u8>
2023-08-15T15:08:39.948Z TRACE [neli::types] Buffer to be deserialized: [192, 168, 24, 200]
2023-08-15T15:08:39.948Z TRACE [neli::types] Field deserialized: [192, 168, 24, 200]
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Field deserialized: Buffer
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing data type Rtattr
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing field type u16
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Buffer to be deserialized: [8, 0]
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Field deserialized: 8
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing field type neli::consts::rtnl::Rta
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Buffer to be deserialized: [25, 0]
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Field deserialized: Uid
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing field type neli::types::Buffer
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Buffer to be deserialized: [232, 3, 0, 0]
2023-08-15T15:08:39.948Z TRACE [neli::types] Deserializing data type Buffer
2023-08-15T15:08:39.948Z TRACE [neli::types] Deserializing field type alloc::vec::Vec<u8>
2023-08-15T15:08:39.948Z TRACE [neli::types] Buffer to be deserialized: [232, 3, 0, 0]
2023-08-15T15:08:39.948Z TRACE [neli::types] Field deserialized: [232, 3, 0, 0]
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Field deserialized: Buffer
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing data type Rtattr
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing field type u16
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Buffer to be deserialized: [36, 0]
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Field deserialized: 36
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing field type neli::consts::rtnl::Rta
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Buffer to be deserialized: [12, 0]
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Field deserialized: Cacheinfo
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Deserializing field type neli::types::Buffer
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Buffer to be deserialized: [2, 0, 0, 0, 106, 156, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
2023-08-15T15:08:39.948Z TRACE [neli::types] Deserializing data type Buffer
2023-08-15T15:08:39.948Z TRACE [neli::types] Deserializing field type alloc::vec::Vec<u8>
2023-08-15T15:08:39.948Z TRACE [neli::types] Buffer to be deserialized: [2, 0, 0, 0, 106, 156, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
2023-08-15T15:08:39.948Z TRACE [neli::types] Field deserialized: [2, 0, 0, 0, 106, 156, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Field deserialized: Buffer
2023-08-15T15:08:39.948Z TRACE [neli::types] Field deserialized: [Rtattr { rta_len: 8, rta_type: Table, rta_payload: Buffer }, Rtattr { rta_len: 8, rta_type: Dst, rta_payload: Buffer }, Rtattr { rta_len: 8, rta_type: Oif, rta_payload: Buffer }, Rtattr { rta_len: 8, rta_type: Prefsrc, rta_payload: Buffer }, Rtattr { rta_len: 8, rta_type: Gateway, rta_payload: Buffer }, Rtattr { rta_len: 8, rta_type: Uid, rta_payload: Buffer }, Rtattr { rta_len: 36, rta_type: Cacheinfo, rta_payload: Buffer }]
2023-08-15T15:08:39.948Z TRACE [neli::rtnl] Field deserialized: RtBuffer([Rtattr { rta_len: 8, rta_type: Table, rta_payload: Buffer }, Rtattr { rta_len: 8, rta_type: Dst, rta_payload: Buffer }, Rtattr { rta_len: 8, rta_type: Oif, rta_payload: Buffer }, Rtattr { rta_len: 8, rta_type: Prefsrc, rta_payload: Buffer }, Rtattr { rta_len: 8, rta_type: Gateway, rta_payload: Buffer }, Rtattr { rta_len: 8, rta_type: Uid, rta_payload: Buffer }, Rtattr { rta_len: 36, rta_type: Cacheinfo, rta_payload: Buffer }])
2023-08-15T15:08:39.948Z WARN [local_ip_address::linux] using fallback...
See https://github.com/cgzones/local-ip-address/blob/neli/src/linux.rs for the usage.
As I mentioned, this works in the example in the examples directory of neli. I took a look at what you're doing and I'm pretty confident this is a user error as you're not providing the correct netlink flags to the request as is provided in the example I pointed you to. When I remove NlmF::DUMP
from the flags in my example, I also get responses from the netlink socket but route-list
doesn't display any routes. Adding in NlmF::DUMP
causes the routes to show up in the example program.
As a general rule of thumb, NlmF::ACK
is a good flag for requests where you're "doing" something. When listing multiple resources like routes, you generally want NlmF::DUMP
. Can you check if adding that to the request resolves your issue?
I'm going to keep looking into why we're getting responses even without that flag as I don't want to rule out that this could be a bug, but try that first and see if it resolves your issue.
My usage is a bit different: I don't want to dump all routes, I want to lookup the route with a specific destination IP address. Thus I use the flag RTM_F_LOOKUP_TABLE
and provide a payload.
With NlmF::DUMP
instead of NlmF::REQUEST
there is also no result:
2023-08-15T17:42:35.143Z INFO [local_ip_address::linux] Created rt message: Rtmsg { rtm_family: Inet, rtm_dst_len: 32, rtm_src_len: 0, rtm_tos: 0, rtm_table: Unspec, rtm_protocol: Unspec, rtm_scope: Universe, rtm_type: Unspec, rtm_flags: RtmF(4096), rtattrs: RtBuffer([Rtattr { rta_len: 8, rta_type: Dst, rta_payload: Buffer }]) }
2023-08-15T17:42:35.143Z DEBUG [neli::socket::synchronous] Message sent:
Nlmsghdr { nl_len: 36, nl_type: Getroute, nl_flags: NlmF(769), nl_seq: 0, nl_pid: 94408, nl_payload: Payload(Rtmsg { rtm_family: Inet, rtm_dst_len: 32, rtm_src_len: 0, rtm_tos: 0, rtm_table: Unspec, rtm_protocol: Unspec, rtm_scope: Universe, rtm_type: Unspec, rtm_flags: RtmF(4096), rtattrs: RtBuffer([Rtattr { rta_len: 8, rta_type: Dst, rta_payload: Buffer }]) }) }
2023-08-15T17:42:35.143Z INFO [local_ip_address::linux] Send rt message
2023-08-15T17:42:35.143Z TRACE [neli::utils::synchronous] Semaphore acquired; current count is 1, available is 2
2023-08-15T17:42:35.143Z TRACE [neli::socket::synchronous] Buffer received: [20, 0, 0, 0, 3, 0, 2, 0, 0, 0, 0, 0, 200, 112, 1, 0, 234, 255, 255, 255]
2023-08-15T17:42:35.144Z DEBUG [neli::iter] next() called
2023-08-15T17:42:35.144Z TRACE [neli::nl] Deserializing data type Nlmsghdr
2023-08-15T17:42:35.144Z TRACE [neli::nl] Deserializing field type u32
2023-08-15T17:42:35.144Z TRACE [neli::nl] Buffer to be deserialized: [20, 0, 0, 0]
2023-08-15T17:42:35.144Z TRACE [neli::nl] Field deserialized: 20
2023-08-15T17:42:35.144Z TRACE [neli::nl] Deserializing field type u16
2023-08-15T17:42:35.144Z TRACE [neli::nl] Buffer to be deserialized: [3, 0]
2023-08-15T17:42:35.144Z TRACE [neli::nl] Field deserialized: 3
2023-08-15T17:42:35.144Z TRACE [neli::nl] Deserializing field type neli::consts::nl::NlmF
2023-08-15T17:42:35.144Z TRACE [neli::nl] Buffer to be deserialized: [2, 0]
2023-08-15T17:42:35.144Z TRACE [neli::consts::nl] Deserializing data type NlmF
2023-08-15T17:42:35.144Z TRACE [neli::consts::nl] Deserializing field type u16
2023-08-15T17:42:35.144Z TRACE [neli::consts::nl] Buffer to be deserialized: [2, 0]
2023-08-15T17:42:35.144Z TRACE [neli::consts::nl] Field deserialized: 2
2023-08-15T17:42:35.144Z TRACE [neli::nl] Field deserialized: NlmF(2)
2023-08-15T17:42:35.144Z TRACE [neli::nl] Deserializing field type u32
2023-08-15T17:42:35.144Z TRACE [neli::nl] Buffer to be deserialized: [0, 0, 0, 0]
2023-08-15T17:42:35.144Z TRACE [neli::nl] Field deserialized: 0
2023-08-15T17:42:35.144Z TRACE [neli::nl] Deserializing field type u32
2023-08-15T17:42:35.144Z TRACE [neli::nl] Buffer to be deserialized: [200, 112, 1, 0]
2023-08-15T17:42:35.144Z TRACE [neli::nl] Field deserialized: 94408
2023-08-15T17:42:35.144Z TRACE [neli::nl] Deserializing field type neli::nl::NlPayload<u16, neli::types::Buffer>
2023-08-15T17:42:35.144Z TRACE [neli::nl] Buffer to be deserialized: [234, 255, 255, 255]
2023-08-15T17:42:35.144Z TRACE [neli::nl] Deserializing data type neli::nl::NlPayload<u16, neli::types::Buffer>
2023-08-15T17:42:35.144Z TRACE [neli::nl] Received empty payload
2023-08-15T17:42:35.144Z TRACE [neli::nl] Padding: [234, 255, 255, 255]
2023-08-15T17:42:35.144Z TRACE [neli::nl] Field deserialized: Empty
2023-08-15T17:42:35.144Z DEBUG [neli::iter] Message received3: Nlmsghdr { nl_len: 20, nl_type: 3, nl_flags: NlmF(2), nl_seq: 0, nl_pid: 94408, nl_payload: Empty }
2023-08-15T17:42:35.144Z DEBUG [neli::iter] next() finished, got: Some(Ok(Nlmsghdr { nl_len: 20, nl_type: 3, nl_flags: NlmF(2), nl_seq: 0, nl_pid: 94408, nl_payload: Empty }))
2023-08-15T17:42:35.144Z TRACE [neli::router::synchronous] Message received1: Ok(Nlmsghdr { nl_len: 20, nl_type: 3, nl_flags: NlmF(2), nl_seq: 0, nl_pid: 94408, nl_payload: Empty })
2023-08-15T17:42:35.144Z DEBUG [neli::iter] next() called
2023-08-15T17:42:35.144Z DEBUG [neli::iter] next() finished, got: None
thread 'main' panicked at 'using fallback...', src/linux.rs:157:5
It works with NlmF::REQUEST | NlmF::ACK
.
But if I am reading netlink(7) correctly the ACK flag should be optional.
Okay, then this is definitely a bug. Let me look into this when I get a moment. I will try to take some time to do a deeper dive into this this weekend at the latest. Thanks for the report!
@cgzones I think this is a duplicate of #223 actually. Please test #227 as I believe based on my testing of your example code that it should resolve your issue.
Version of neli git main branch
Describe the bug Creating a
GETROUTE
request via(edit:
dst_len
needs to be the size of the family address length)results in no responses. Via strace(8) the response seems to arrive in a spawned helper fork:
Main process (pid 132773):
Fork (pid 132774):
Maybe
nlmsg_pid
must not be set, or the payload attribute causes timing issues?GETADDR
works fine:Main process (pid 132773):
Fork (pid 132775):