diff options
author | Cong Wang <xiyou.wangcong@gmail.com> | 2014-07-21 19:27:32 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-07-24 17:58:35 (GMT) |
commit | 944b982cc50efd1fd478f5544b4e5e963af30214 (patch) | |
tree | 8d323abb4814a328b0e5e3156ba4cd5f92fb9fac /tests | |
parent | 956b758f7e58f683a3c6a20118cf8d4d203f8085 (diff) | |
download | libnl-944b982cc50efd1fd478f5544b4e5e963af30214.zip libnl-944b982cc50efd1fd478f5544b4e5e963af30214.tar.gz libnl-944b982cc50efd1fd478f5544b4e5e963af30214.tar.bz2 |
link: add ifb device support
Cc: Thomas Graf <tgraf@suug.ch>
Cc: Thomas Haller <thaller@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/.gitignore | 1 | ||||
-rw-r--r-- | tests/Makefile.am | 2 | ||||
-rw-r--r-- | tests/test-create-ifb.c | 29 |
3 files changed, 32 insertions, 0 deletions
diff --git a/tests/.gitignore b/tests/.gitignore index 6b77cac..7894d5a 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -15,6 +15,7 @@ /test-create-veth /test-create-vlan /test-create-vxlan +/test-create-ifb /test-delete-link /test-genl /test-nf-cache-mngr diff --git a/tests/Makefile.am b/tests/Makefile.am index 255033d..85d93b8 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -29,6 +29,7 @@ check_PROGRAMS = \ test-create-ipip \ test-create-ipvti \ test-create-sit \ + test-create-ifb \ test-delete-link \ test-socket-creation \ test-complex-HTB-with-hash-filters \ @@ -52,6 +53,7 @@ test_create_vlan_SOURCES = test-create-vlan.c test_create_vxlan_SOURCES = test-create-vxlan.c test_create_veth_SOURCES = test-create-veth.c test_create_bridge_SOURCES = test-create-bridge.c +test_create_ifb_SOURCES = test-create-ifb.c test_delete_link_SOURCES = test-delete-link.c test_genl_SOURCES = test-genl.c test_nf_cache_mngr_SOURCES = test-nf-cache-mngr.c diff --git a/tests/test-create-ifb.c b/tests/test-create-ifb.c new file mode 100644 index 0000000..99336f5 --- /dev/null +++ b/tests/test-create-ifb.c @@ -0,0 +1,29 @@ +#include <netlink/netlink.h> +#include <netlink/route/link.h> + +int main(int argc, char *argv[]) +{ + struct rtnl_link *link; + struct nl_sock *sk; + int err; + + sk = nl_socket_alloc(); + if ((err = nl_connect(sk, NETLINK_ROUTE)) < 0) { + nl_perror(err, "Unable to connect socket"); + return err; + } + + link = rtnl_link_alloc(); + rtnl_link_set_type(link, "ifb"); + rtnl_link_set_name(link, "ifb1"); + + if ((err = rtnl_link_add(sk, link, NLM_F_CREATE)) < 0) { + nl_perror(err, "Unable to add link"); + return err; + } + + rtnl_link_put(link); + nl_close(sk); + + return 0; +} |