Hi,
I am trying to fix the broken test cases which was working
previously . With the new refactorization and I tryied to fix them with
the attached paatch does not work . Not sure I am doing something wrong
or sd-rtnl is broken.
--
Thanks !
Susant
>From 51e8b0a3d18f892c2e0bb86ca86fab99562700b8 Mon Sep 17 00:00:00 2001
From: Susant Sahani <[email protected]>
Date: Thu, 3 Apr 2014 13:35:56 +0530
Subject: [PATCH] sd-rtnl: fix broken test cases and add support for tunnel
This patch fixes the broken test-cases for sd-rtnl and add
support for ipip and sit tunnel
---
src/libsystemd/sd-rtnl/rtnl-types.c | 37 +++++++++++++++++++++++++++++++++++++
src/test/test-rtnl-manual.c | 8 ++++----
2 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c b/src/libsystemd/sd-rtnl/rtnl-types.c
index 29ee5bc..ed1aacd 100644
--- a/src/libsystemd/sd-rtnl/rtnl-types.c
+++ b/src/libsystemd/sd-rtnl/rtnl-types.c
@@ -30,6 +30,9 @@
#include <linux/if_addr.h>
#include <linux/if.h>
+#include <linux/ip.h>
+#include <linux/if_tunnel.h>
+
#include "macro.h"
#include "util.h"
@@ -98,12 +101,40 @@ static const NLType rtnl_link_info_data_bond_types[IFLA_BOND_MAX + 1] = {
#endif
};
+static const NLType rtnl_link_info_data_ipip_tunnel_types[IFLA_IPTUN_MAX + 1] = {
+ [IFLA_IPTUN_LINK] = { .type = NLA_U32 },
+ [IFLA_IPTUN_LOCAL] = { .type = NLA_U32 },
+ [IFLA_IPTUN_REMOTE] = { .type = NLA_U32 },
+ [IFLA_IPTUN_TTL] = { .type = NLA_U8 },
+ [IFLA_IPTUN_TOS] = { .type = NLA_U8 },
+ [IFLA_IPTUN_PMTUDISC] = { .type = NLA_U8 },
+};
+
+static const NLType rtnl_link_info_data_ipip6_tunnel_types[IFLA_IPTUN_MAX + 1] = {
+ [IFLA_IPTUN_LINK] = { .type = NLA_U32 },
+ [IFLA_IPTUN_LOCAL] = { .type = NLA_U32 },
+ [IFLA_IPTUN_REMOTE] = { .type = NLA_U32 },
+ [IFLA_IPTUN_TTL] = { .type = NLA_U8 },
+ [IFLA_IPTUN_TOS] = { .type = NLA_U8 },
+ [IFLA_IPTUN_PMTUDISC] = { .type = NLA_U8 },
+ [IFLA_IPTUN_FLAGS] = { .type = NLA_U16 },
+ [IFLA_IPTUN_PROTO] = { .type = NLA_U8 },
+ /*
+ [IFLA_IPTUN_6RD_PREFIX] = { .len = sizeof(struct in6_addr) },
+ [IFLA_IPTUN_6RD_RELAY_PREFIX] = { .type = NLA_U32 },
+ [IFLA_IPTUN_6RD_PREFIXLEN] = { .type = NLA_U16 },
+ [IFLA_IPTUN_6RD_RELAY_PREFIXLEN] = { .type = NLA_U16 },
+ */
+};
+
typedef enum NLUnionLinkInfoData {
NL_UNION_LINK_INFO_DATA_BOND,
NL_UNION_LINK_INFO_DATA_BRIDGE,
NL_UNION_LINK_INFO_DATA_VLAN,
NL_UNION_LINK_INFO_DATA_VETH,
NL_UNION_LINK_INFO_DATA_MACVLAN,
+ NL_UNION_LINK_INFO_DATA_IPIP_TUNNEL,
+ NL_UNION_LINK_INFO_DATA_IPIP6_TUNNEL,
_NL_UNION_LINK_INFO_DATA_MAX,
_NL_UNION_LINK_INFO_DATA_INVALID = -1
} NLUnionLinkInfoData;
@@ -117,6 +148,8 @@ static const char* const nl_union_link_info_data_table[_NL_UNION_LINK_INFO_DATA_
[NL_UNION_LINK_INFO_DATA_VLAN] = "vlan",
[NL_UNION_LINK_INFO_DATA_VETH] = "veth",
[NL_UNION_LINK_INFO_DATA_MACVLAN] = "macvlan",
+ [NL_UNION_LINK_INFO_DATA_IPIP_TUNNEL] = "ipip_tunnel",
+ [NL_UNION_LINK_INFO_DATA_IPIP6_TUNNEL] = "ipip6_tunnel",
};
DEFINE_STRING_TABLE_LOOKUP(nl_union_link_info_data, NLUnionLinkInfoData);
@@ -132,6 +165,10 @@ static const NLTypeSystem rtnl_link_info_data_type_systems[_NL_UNION_LINK_INFO_D
.types = rtnl_link_info_data_veth_types },
[NL_UNION_LINK_INFO_DATA_MACVLAN] = { .max = ELEMENTSOF(rtnl_link_info_data_macvlan_types) - 1,
.types = rtnl_link_info_data_macvlan_types },
+ [NL_UNION_LINK_INFO_DATA_IPIP_TUNNEL] = { .max = ELEMENTSOF(rtnl_link_info_data_ipip_tunnel_types) - 1,
+ .types = rtnl_link_info_data_ipip_tunnel_types },
+ [NL_UNION_LINK_INFO_DATA_IPIP6_TUNNEL] = { .max = ELEMENTSOF(rtnl_link_info_data_ipip6_tunnel_types) - 1,
+ .types = rtnl_link_info_data_ipip6_tunnel_types },
};
static const NLTypeSystemUnion rtnl_link_info_data_type_system_union = {
diff --git a/src/test/test-rtnl-manual.c b/src/test/test-rtnl-manual.c
index e76fb81..2a77bf7 100644
--- a/src/test/test-rtnl-manual.c
+++ b/src/test/test-rtnl-manual.c
@@ -84,10 +84,10 @@ static int test_tunnel_configure(sd_rtnl *rtnl) {
assert_se(sd_rtnl_message_new_link(rtnl, &m, RTM_NEWLINK, 0) >= 0);
assert_se(m);
- assert_se(sd_rtnl_message_append_string(m, IFLA_IFNAME, "eth0") >= 0);
+ assert_se(sd_rtnl_message_append_string(m, IFLA_IFNAME, "ipip-tunnel") >= 0);
assert_se(sd_rtnl_message_append_u32(m, IFLA_MTU, 1234)>= 0);
- assert_se(sd_rtnl_message_open_container(m, IFLA_LINKINFO) >= 0);
+ assert_se(sd_rtnl_message_open_container_union(m, IFLA_LINKINFO, "ipip_tunnel") >= 0);
assert_se(sd_rtnl_message_append_string(m, IFLA_INFO_KIND, "ipip") >= 0);
assert_se(sd_rtnl_message_open_container(m, IFLA_INFO_DATA) >= 0);
@@ -113,10 +113,10 @@ static int test_tunnel_configure(sd_rtnl *rtnl) {
assert_se(sd_rtnl_message_new_link(rtnl, &n, RTM_NEWLINK, 0) >= 0);
assert_se(n);
- assert_se(sd_rtnl_message_append_string(n, IFLA_IFNAME, "eth1") >= 0);
+ assert_se(sd_rtnl_message_append_string(n, IFLA_IFNAME, "sit-tunnel") >= 0);
assert_se(sd_rtnl_message_append_u32(n, IFLA_MTU, 1234)>= 0);
- assert_se(sd_rtnl_message_open_container(n, IFLA_LINKINFO) >= 0);
+ assert_se(sd_rtnl_message_open_container_union(n, IFLA_LINKINFO, "ipip6_tunnel") >= 0);
assert_se(sd_rtnl_message_append_string(n, IFLA_INFO_KIND, "sit") >= 0);
assert_se(sd_rtnl_message_open_container(n, IFLA_INFO_DATA) >= 0);
--
1.9.0
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel