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