You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.
I don't know if it's supposed to counter something from the kernel or not, but on the latest library version, with the latest kenel, those are indeed swapped.
Reproduction
Create a netns, e.g. test: ip netns add test
Create a veth peer from the default ns to the test ns. The test NS should have the peer and the default one the regular one.
use std::{fs::File, os::unix::prelude::AsRawFd};use rtnetlink::{
new_connection,
packet::nlas::link::{Info,InfoData,Nla,VethInfo},};use tokio::runtime::Builder;fnmain(){Builder::new_current_thread().enable_all().build().unwrap().block_on(async_main());}asyncfnasync_main(){let(worker, rtnl, _) = new_connection().unwrap();
tokio::spawn(worker);let ns = File::open("/var/run/netns/common").unwrap();letmut req = rtnl.link().add().veth("name".to_owned(),"peer".to_owned());for nla in&mut req.message_mut().nlas{ifletNla::Info(infos) = nla {for info in infos {ifletInfo::Data(InfoData::Veth(VethInfo::Peer(peer))) = info {
peer.nlas.push(Nla::NetNsFd(ns.as_raw_fd()));}}}}
req.execute().await.unwrap();}
Observe that the default ns contains the link named peer, while the test ns contains the one named name
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When creating a veth pair, the name and the peer name are swapped.
The odd thing is the sources actually contain a comment about it being swapped: https://github.com/little-dude/netlink/blob/master/rtnetlink/src/link/add.rs#L568.
I don't know if it's supposed to counter something from the kernel or not, but on the latest library version, with the latest kenel, those are indeed swapped.
Reproduction
test
:ip netns add test
peer
, while thetest
ns contains the one namedname
The text was updated successfully, but these errors were encountered: