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

Delete address example #80

Open
joseph-henry opened this issue Oct 1, 2024 · 0 comments
Open

Delete address example #80

joseph-henry opened this issue Oct 1, 2024 · 0 comments

Comments

@joseph-henry
Copy link

Hello. Nice little library you have here. I'm still a rust novice and while I was able to add addresses to a link I cannot figure out how to remove an address and there is no example showing this process.

The closest thing I can come up with is:

  pub async fn del_addr(link_name: &str, ip: IpNetwork) -> Result<(), Error> {
      let (connection, handle, _) = new_connection().unwrap();
      tokio::spawn(connection);

      let mut links = handle.link().get().match_name(link_name.to_string()).execute();

      let mut req = handle.address().get().set_address_filter(ip.ip());
      let mut msg = req.message_mut();

      if let Some(link) = links.try_next().await? {
          if let Err(e) = handle.address().del(msg.clone()).execute().await
          {
              eprintln!("{e}");
          }
      }
      Ok(())
  }

This results in Error 95 "Operation Not Supported"

Can somebody point me in the right direction? Thanks.

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

No branches or pull requests

1 participant