Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exchange custom netlink fork for neli crate #13

Closed
wants to merge 2 commits into from

Conversation

marcelbuesing
Copy link
Contributor

This removes the custom netlink dependency in exchange for the neli-crate. I have tested bring_up and bring_down and it seems to work. There is a minor difference in the send that I have not figured out yet why sa_family is not added in neli or if that is even relevant since it has the intended effect.

strace -s 100 -f -x of

    let iface = CanInterface::open("vcan0").expect("Failed to lookup vcan0 iface");
    iface.bring_down().unwrap();

netlink-rs fork:

bind(3, {sa_family=AF_NETLINK, nl_pid=29418, nl_groups=00000000}, 16) = 0
sendto(3, {{len=32, type=RTM_NEWLINK, flags=NLM_F_REQUEST|NLM_F_ACK, seq=0, pid=0}, {ifi_family=AF_UNSPEC, ifi_type=ARPHRD_NETROM, ifi_index=if_nametoindex("vcan0"), ifi_flags=0, ifi_change=0x1}}, 32, 0, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 16) = 302
recvfrom(3, {{len=36, type=NLMSG_ERROR, flags=NLM_F_CAPPED, seq=0, pid=29418}, {error=0, msg={len=32, type=RTM_NEWLINK, flags=NLM_F_REQUEST|NLM_F_ACK, seq=0, pid=0}}}, 4096, 0, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, [16->12]) = 36

neli:

bind(3, {sa_family=AF_NETLINK, nl_pid=960, nl_groups=00000000}, 12) = 0
sendto(3, {{len=32, type=RTM_NEWLINK, flags=NLM_F_REQUEST|NLM_F_ACK, seq=0, pid=0}, {ifi_family=AF_UNSPEC, ifi_type=ARPHRD_NETROM, ifi_index=if_nametoindex("vcan0"), ifi_flags=0, ifi_change=0x1}}, 32, 0, NULL, 0) = 32
recvfrom(3, {{len=36, type=NLMSG_ERROR, flags=NLM_F_CAPPED, seq=0, pid=960}, {error=0, msg={len=32, type=RTM_NEWLINK, flags=NLM_F_REQUEST|NLM_F_ACK, seq=0, pid=0}}}, 32768, 0, NULL, NULL) = 36

WIP: since this is still waiting for merge of: jbaublitz/neli#61, I will exchange the git link for a version once that is released.

@marcelbuesing marcelbuesing changed the title [WIP] Exchange custom netlink fork for neli crate Exchange custom netlink fork for neli crate Jul 22, 2020
fpagliughi added a commit to fpagliughi/socketcan-rs that referenced this pull request Feb 21, 2021
…18 and latest dependencies. Errors now conforming to std::error::Error.
@fpagliughi
Copy link
Collaborator

I merged this into my fork at:
https://github.com/fpagliughi/socketcan-rs/tree/develop

There were a number of breaking changes in neli since this PR was done, but I fixed those up and hit a serialization error:
jbaublitz/neli#136

But now that's all working. I still need to re-implement the wait-for-ack functionality which changed in the library, but overall neli does look like a better choice for dealing with the Netlink stuff.

@marcelbuesing
Copy link
Contributor Author

I merged this into my fork at:
https://github.com/fpagliughi/socketcan-rs/tree/develop

There were a number of breaking changes in neli since this PR was done, but I fixed those up and hit a serialization error:
jbaublitz/neli#136

But now that's all working. I still need to re-implement the wait-for-ack functionality which changed in the library, but overall neli does look like a better choice for dealing with the Netlink stuff.

I think neli 0.5.3 that was released yesterday should contain the fix?

This was referenced Feb 15, 2022
@fpagliughi
Copy link
Collaborator

Included and updated by #20 . This can be closed if/when that one is merged.

@fpagliughi
Copy link
Collaborator

#20, which contained this PR was merged to master.

@fpagliughi fpagliughi closed this Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants