diff options
author | Tom Gundersen <teg@jklm.no> | 2013-11-21 20:44:29 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2013-11-26 01:32:25 +0100 |
commit | 33125ac50bafd93dd98934f5f6ff23a59da8d793 (patch) | |
tree | de64a2ef5ef21a15d94d3cecd7b27949902e5609 /src/libsystemd-rtnl/test-rtnl.c | |
parent | a9bc6d2df16c1d9f8a99d2cc9be2babf62bd173f (diff) |
rtnl: add preliminary support for containers
For now, we only support one container type IFLA_LINKINFO, and we
still lack support for parsing the containers again.
Diffstat (limited to 'src/libsystemd-rtnl/test-rtnl.c')
-rw-r--r-- | src/libsystemd-rtnl/test-rtnl.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/libsystemd-rtnl/test-rtnl.c b/src/libsystemd-rtnl/test-rtnl.c index 75a210d3fb..4b62c02361 100644 --- a/src/libsystemd-rtnl/test-rtnl.c +++ b/src/libsystemd-rtnl/test-rtnl.c @@ -206,6 +206,30 @@ static void test_pipe(int ifindex) { } } +static void test_container(void) { + _cleanup_sd_rtnl_message_unref_ sd_rtnl_message *m = NULL; + uint16_t type; + void *data; + + assert(sd_rtnl_message_link_new(RTM_NEWLINK, 0, 0, 0, &m) >= 0); + + assert(sd_rtnl_message_open_container(m, IFLA_LINKINFO) >= 0); + assert(sd_rtnl_message_open_container(m, IFLA_LINKINFO) == -EINVAL); + assert(sd_rtnl_message_append(m, IFLA_INFO_KIND, "kind") >= 0); + assert(sd_rtnl_message_close_container(m) >= 0); + assert(sd_rtnl_message_close_container(m) == -EINVAL); + + assert(sd_rtnl_message_read(m, &type, &data) == -EINVAL); + +/* TODO: add support for entering containers + assert(sd_rtnl_message_read(m, &type, &data) > 0); + assert(type == IFLA_INFO_KIND); + assert(streq("kind", (char *) data)); + + assert(sd_rtnl_message_read(m, &type, &data) == 0); +*/ +} + int main(void) { sd_rtnl *rtnl; sd_rtnl_message *m; @@ -220,6 +244,8 @@ int main(void) { test_route(); + test_container(); + assert(sd_rtnl_open(0, &rtnl) >= 0); assert(rtnl); |