Skip to content

Conversation

@richardstephens
Copy link
Contributor

@richardstephens richardstephens commented Feb 13, 2024

We're trying to enable vlan_filtering on an existing bridge, the equivalant of

# ip link set dev br0 type bridge vlan_filtering 1

After some back and forth manipulating the message and strace'ing iproute2 to eliminate all the differences, I got to the point where the only difference was that the flags used by iproute2 were NLM_F_REQUEST|NLM_F_ACK.

With this change, we are now able to successfully enable vlan filtering on a bridge like so:

    let (link_index, _) = find_link(&handle, "br0".to_string())
        .await
        .unwrap()
        .unwrap();

    let mut req: LinkAddRequest = handle.link().add().flags(0);
    let mut msg = req.message_mut();
    msg.header.index = link_index;
    msg.attributes.push(LinkAttribute::LinkInfo(vec![
        LinkInfo::Kind(InfoKind::Bridge),
        LinkInfo::Data(InfoData::Bridge(vec![InfoBridge::VlanFiltering(1)])),
    ]));
    req.execute().await.unwrap();

Questions

  • Does modifying LinkAddRequest to support sending these types of requests make sense? Perhaps a new Link...Request might be more appropriate
  • Might exposing this functionality in other request types also be helpful?

@richardstephens richardstephens changed the title feat: option to specify flags in link create request feat: option to specify netlink header flags in LinkAddRequest Feb 13, 2024
@cathay4t
Copy link
Member

Thanks for the contribution!

We are in the middle of design discussion on how we should handle this kind of requests at #57

Could you wait a little bit or even better join our discussion there?

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.

2 participants