Home | History | Annotate | Download | only in tests
      1 #include <netlink/netlink.h>
      2 #include <netlink/route/link.h>
      3 
      4 int main(int argc, char *argv[])
      5 {
      6 	struct rtnl_link *link;
      7 	struct nl_sock *sk;
      8 	int err;
      9 
     10 	sk = nl_socket_alloc();
     11 	if ((err = nl_connect(sk, NETLINK_ROUTE)) < 0) {
     12 		nl_perror(err, "Unable to connect socket");
     13 		return err;
     14 	}
     15 
     16 	link = rtnl_link_alloc();
     17 	rtnl_link_set_name(link, "my_bond");
     18 
     19 	if ((err = rtnl_link_delete(sk, link)) < 0) {
     20 		nl_perror(err, "Unable to delete link");
     21 		return err;
     22 	}
     23 
     24 	rtnl_link_put(link);
     25 	nl_close(sk);
     26 
     27 	return 0;
     28 }
     29