On 04/07/2014 10:05 AM, Susant Sahani wrote:
On 04/04/2014 10:00 PM, Tom Gundersen wrote:
Hi Susant,
Hi Tom,

+ log_error_netdev(netdev,
+ "Could not append IFLA_IPTUN_LINK attribute: %s",
+                                 strerror(-r));
+                return r;
+        }
+
+ r = sd_rtnl_message_append_u32(m, IFLA_IPTUN_LOCAL, netdev->tunnel_local.s_addr);
+        if (r < 0) {
+                log_error_netdev(netdev,
+ "Could not append IFLA_IPTUN_LOCAL attribute: %s",
+                                 strerror(-r));
+                return r;
+        }
+
+ r = sd_rtnl_message_append_u32(m, IFLA_IPTUN_REMOTE, netdev->tunnel_remote.s_addr);
+        if (r < 0) {
+                log_error_netdev(netdev,
+ "Could not append IFLA_IPTUN_REMOTE attribute: %s",
+                                 strerror(-r));
+                return r;
+        }
Hm, I guess these should be _append_in_addr() to get the typesafety
right (might need to verify that we are using the right types for this
in rtnl-types.c.
 I am missing something in the code . with the current rtnl code
it does not get appended.  Could you please give a example.

r= sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_LOCAL, (const struct in_addr *)
&netdev->tunnel_local.s_addr);

Could not append IFLA_IPTUN_LOCAL attribute: Invalid argument

I just figured out this should do .

git diff rtnl-types.c
diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c b/src/libsystemd/sd-rtnl/rtnl-types.c
index 27b7d04..585edc6 100644
--- a/src/libsystemd/sd-rtnl/rtnl-types.c
+++ b/src/libsystemd/sd-rtnl/rtnl-types.c
@@ -103,8 +103,8 @@ static const NLType rtnl_link_info_data_bond_types[IFLA_BOND_MAX + 1] = {

static const NLType rtnl_link_info_data_iptun_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_LOCAL]               = { .type = NLA_IN_ADDR },
+        [IFLA_IPTUN_REMOTE]              = { .type = NLA_IN_ADDR },
         [IFLA_IPTUN_TTL]                 = { .type = NLA_U8 },
         [IFLA_IPTUN_TOS]                 = { .type = NLA_U8 },
         [IFLA_IPTUN_PMTUDISC]            = { .type = NLA_U8 },
Thanks
Susant

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to